From 18b3bde0c00cf0b7b538da73c0759c50edf858af Mon Sep 17 00:00:00 2001 From: Tim Harder Date: Mon, 29 Apr 2019 20:45:42 +0200 Subject: [PATCH 2/3] Allow building of just glxtrace library (without GUI tools) Patch was rebased multiple times from 1.0 to 8.0 now. Signed-off-by: Andreas Sturmlechner --- CMakeLists.txt | 18 ++++++++++++++++++ retrace/CMakeLists.txt | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 36879db6..65be2d72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,6 +47,8 @@ if (ANDROID) message (FATAL_ERROR "Android is no longer supported (https://git.io/vH2gW)") endif () +option (BUILD_LIB_ONLY "Build the glxtrace library only" OFF) + # Proprietary Linux games often ship their own libraries (zlib, libstdc++, # etc.) in order to ship a single set of binaries across multiple # distributions. Given that apitrace wrapper modules will be loaded into those @@ -109,6 +111,8 @@ endif () find_package (Threads) +if (NOT BUILD_LIB_ONLY) + if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT ENABLE_STATIC_EXE) find_package (procps) if (PROCPS_FOUND) @@ -116,6 +120,8 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT ENABLE_STATIC_EXE) endif () endif () +endif (NOT BUILD_LIB_ONLY) + if (ENABLE_GUI) if (NOT (ENABLE_GUI STREQUAL "AUTO")) set (REQUIRE_GUI REQUIRED) @@ -186,11 +192,15 @@ elseif (ENABLE_X11) endif () endif () +if (NOT BUILD_LIB_ONLY) + if (ENABLE_EGL AND ENABLE_WAFFLE) # Use Waffle for eglretrace find_package (Waffle REQUIRED) endif () +endif (NOT BUILD_LIB_ONLY) + ############################################################################## # Set global build options @@ -459,6 +469,8 @@ set (WRAPPER_INSTALL_DIR ${LIB_ARCH_INSTALL_DIR}/wrappers) include_directories (${CMAKE_CURRENT_SOURCE_DIR}/compat) +if (NOT BUILD_LIB_ONLY OR ENABLE_CLI) + if (NOT ENABLE_STATIC_SNAPPY) find_package (SNAPPY) endif () @@ -486,6 +498,10 @@ if (NOT ZLIB_FOUND) endif () include_directories (${ZLIB_INCLUDE_DIRS}) +endif (NOT BUILD_LIB_ONLY OR ENABLE_CLI) + +if (NOT BUILD_LIB_ONLY) + # FindPNG.cmake will search ZLIB internally (without requiring any particular # version), adding its include dirs and libraries, and overwriting ZLIB_FOUND. # So if the system's ZLIB was did not meet the our requirements, then there's @@ -501,6 +517,8 @@ if (NOT PNG_FOUND) add_subdirectory (thirdparty/libpng) endif () +endif (NOT BUILD_LIB_ONLY) + if (MSVC) add_subdirectory (thirdparty/getopt) include_directories (${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/getopt) diff --git a/retrace/CMakeLists.txt b/retrace/CMakeLists.txt index 76dc8362..e1bad990 100644 --- a/retrace/CMakeLists.txt +++ b/retrace/CMakeLists.txt @@ -15,6 +15,8 @@ include_directories ( add_definitions (-DRETRACE) +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 @@ -343,3 +345,5 @@ if (WIN32) install (TARGETS d3dretrace RUNTIME DESTINATION bin) install_pdb (d3dretrace DESTINATION bin) endif () + +endif (NOT BUILD_LIB_ONLY) -- 2.21.0