--- apitrace-apitrace-de9f3e5/CMakeLists.txt +++ apitrace-apitrace-de9f3e5/CMakeLists.txt @@ -19,6 +19,8 @@ set (ENABLE_EGL "AUTO" CACHE STRING "Enable EGL support.") +option (BUILD_LIB_ONLY "Build the glxtrace library only" OFF) + ############################################################################## # Find dependencies @@ -159,7 +161,13 @@ include_directories (${ZLIB_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zlib) link_libraries (${ZLIB_LIBRARIES}) -find_package (SNAPPY REQUIRED) +if (BUILD_LIB_ONLY) + set (SNAPPY_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/snappy) + set (SNAPPY_LIBRARIES snappy_bundled) + add_subdirectory (thirdparty/snappy EXCLUDE_FROM_ALL) +else (BUILD_LIB_ONLY) + find_package (SNAPPY REQUIRED) +endif (BUILD_LIB_ONLY) include_directories (${SNAPPY_INCLUDE_DIRS}) link_libraries (${SNAPPY_LIBRARIES}) @@ -182,6 +190,8 @@ # By bundling the QJSON source, we make it much more easier to build the GUI on # Windows and MacOSX. But we only use the bundled sources when ENABLE_GUI is # AUTO. +if (NOT BUILD_LIB_ONLY) + if (QT4_FOUND AND NOT QJSON_FOUND AND (ENABLE_GUI STREQUAL "AUTO")) add_subdirectory (thirdparty/qjson EXCLUDE_FROM_ALL) set (QJSON_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty) @@ -190,6 +200,8 @@ set (QJSON_FOUND TRUE) endif () +endif (NOT BUILD_LIB_ONLY) + # For glext headers. Needs to be before system includes as often system's GL # headers bundle and include glext.h and glxext.h include_directories (BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/glext) @@ -497,6 +513,8 @@ ############################################################################## # API retracers +if (NOT BUILD_LIB_ONLY) + add_custom_command ( OUTPUT glretrace_gl.cpp COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glretrace.py > ${CMAKE_CURRENT_BINARY_DIR}/glretrace_gl.cpp @@ -624,6 +642,8 @@ add_subdirectory(gui) endif () +endif (NOT BUILD_LIB_ONLY) + ############################################################################## # Packaging