From b15422f4c117b3ec93eb9472cc674ee94b2c721d Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 19 Dec 2017 18:05:25 +0000 Subject: [PATCH] Re-arrange CMakeLists.txt a bit to separate qrenderdoc & pyrenderdoc * Now you can build the python modules without building the full UI, which is mostly useful for docs builds so we can do a minimal compile and still generate the docs. --- CMakeLists.txt | 10 ++++++++- qrenderdoc/CMakeLists.txt | 25 +++++++++++++--------- qrenderdoc/Code/pyrenderdoc/CMakeLists.txt | 4 ++-- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f94f9b1b8..6a88e2f86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,6 +117,7 @@ option(ENABLE_GLES "Enable GL ES driver" OFF) option(ENABLE_VULKAN "Enable Vulkan driver" ON) option(ENABLE_RENDERDOCCMD "Enable renderdoccmd" ON) option(ENABLE_QRENDERDOC "Enable qrenderdoc" ON) +option(ENABLE_PYRENDERDOC "Enable renderdoc python modules" ON) option(ENABLE_XLIB "Enable xlib windowing support" ON) option(ENABLE_XCB "Enable xcb windowing support" ON) @@ -161,6 +162,10 @@ if(ANDROID) message(STATUS "Disabling qrenderdoc for android build") set(ENABLE_QRENDERDOC OFF CACHE BOOL "" FORCE) + # Android also doesn't support the python modules + message(STATUS "Disabling renderdoc python modules for android build") + set(ENABLE_PYRENDERDOC OFF CACHE BOOL "" FORCE) + message(STATUS "Using Android ABI ${ANDROID_ABI}") message(STATUS "Using Android native API level ${ANDROID_NATIVE_API_LEVEL}") @@ -257,7 +262,10 @@ if(ENABLE_RENDERDOCCMD) add_subdirectory(renderdoccmd) endif() -if(ENABLE_QRENDERDOC) +# these variables are handled within the CMakeLists.txt in qrenderdoc, +# but we need to add it if either is enabled since the swig bindings +# are handled in common +if(ENABLE_QRENDERDOC OR ENABLE_PYRENDERDOC) add_subdirectory(qrenderdoc) endif() diff --git a/qrenderdoc/CMakeLists.txt b/qrenderdoc/CMakeLists.txt index 63535ff97..28041bd23 100644 --- a/qrenderdoc/CMakeLists.txt +++ b/qrenderdoc/CMakeLists.txt @@ -210,21 +210,19 @@ foreach(in ${swig_interfaces}) list(APPEND swig_output ${swig_file}.py.c) endforeach() +add_custom_target(swig-bindings ALL DEPENDS ${swig_output}) + +if(ENABLE_QRENDERDOC) + # The case here is deliberately not matching the executable name # This means the custom command doesn't create this output file, # which causes CMake to rerun this target every time so that Qt # can do dependency checking and rebuild anything necessary. add_custom_command(OUTPUT QRenderDoc - COMMAND ${QMAKE_QT5_COMMAND} "CMAKE_DIR=${CMAKE_BINARY_DIR}" ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND $(MAKE) - DEPENDS RenderDoc.icns - DEPENDS ${swig_output}) -add_custom_target(build-qrenderdoc ALL DEPENDS QRenderDoc DEPENDS renderdoc) - -# Build python modules - primarily used for constructing documentation -if(UNIX AND NOT APPLE) - add_subdirectory(Code/pyrenderdoc) -endif() + COMMAND ${QMAKE_QT5_COMMAND} "CMAKE_DIR=${CMAKE_BINARY_DIR}" ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND $(MAKE) + DEPENDS RenderDoc.icns) +add_custom_target(build-qrenderdoc ALL DEPENDS QRenderDoc DEPENDS renderdoc DEPENDS swig-bindings) install (PROGRAMS ${CMAKE_BINARY_DIR}/bin/qrenderdoc DESTINATION bin) @@ -245,3 +243,10 @@ install (CODE "MESSAGE(\"sudo update-menus\")") install (CODE "MESSAGE(\"sudo update-mime-database /usr/share/mime/\")") install (CODE "MESSAGE(\"sudo gtk-update-icon-cache /usr/share/icons/hicolor/\")") install (CODE "MESSAGE(\"NB: Your paths may vary.\")") + +endif() # if(ENABLE_QRENDERDOC) + +# Build python modules - primarily used for constructing documentation +if(ENABLE_PYRENDERDOC AND UNIX AND NOT APPLE) + add_subdirectory(Code/pyrenderdoc) +endif() diff --git a/qrenderdoc/Code/pyrenderdoc/CMakeLists.txt b/qrenderdoc/Code/pyrenderdoc/CMakeLists.txt index a9f5f8074..002e238d9 100644 --- a/qrenderdoc/Code/pyrenderdoc/CMakeLists.txt +++ b/qrenderdoc/Code/pyrenderdoc/CMakeLists.txt @@ -78,8 +78,8 @@ set_target_properties(_renderdoc PROPERTIES PREFIX "") set_target_properties(_qrenderdoc PROPERTIES PREFIX "") # Make sure we build after the wrappers are generated -add_dependencies(_renderdoc build-qrenderdoc) -add_dependencies(_qrenderdoc build-qrenderdoc) +add_dependencies(_renderdoc swig-bindings) +add_dependencies(_qrenderdoc swig-bindings) # Copy in the .py wrappers from qrenderdoc's build add_custom_command(