mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-13 02:56:59 +00:00
16f64a5ace
* These .py wrappers are relevant for the non-builtin path, but since we use -builtin they serve no purpose except to make things more complex. * So instead we make the module directly exported as 'module' instead of '_module'. * On windows there's no conflict because we have renderdoc.dll vs renderdoc.pyd. On linux it's librenderdoc.so vs renderdoc.so. * To prevent supporting files like .lib / .pdb from conflicting on windows we build the python modules into a subdirectory. They're not ever used by the UI (it links in the bindings directly).
88 lines
3.1 KiB
CMake
88 lines
3.1 KiB
CMake
# Build as C++14 for the python bindings template-fu
|
|
if (CMAKE_VERSION VERSION_LESS "3.1")
|
|
set (CMAKE_CXX_FLAGS "--std=c++14 ${CMAKE_CXX_FLAGS}")
|
|
else ()
|
|
set (CMAKE_CXX_STANDARD 14)
|
|
endif ()
|
|
|
|
# Fetch the include and libs parameters for Qt
|
|
execute_process(
|
|
COMMAND pkg-config --cflags Qt5Widgets Qt5Core Qt5Gui
|
|
OUTPUT_VARIABLE QT5_INCLUDE
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
execute_process(
|
|
COMMAND pkg-config --libs Qt5Widgets Qt5Core Qt5Gui
|
|
OUTPUT_VARIABLE QT5_LIBS
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
if(STATIC_QRENDERDOC)
|
|
set(QT5_LIBS "${QT5_LIBS} -lqtpcre")
|
|
endif()
|
|
|
|
# include paths for qrenderdoc, the internal renderdoc API, and Python
|
|
set(MODULE_INCLUDES
|
|
PRIVATE ${CMAKE_SOURCE_DIR}/qrenderdoc
|
|
PRIVATE ${CMAKE_SOURCE_DIR}/renderdoc/api/replay
|
|
PRIVATE ${PYTHON_INCLUDE_DIR})
|
|
|
|
# preprocessor definitions for compiling
|
|
set(MODULE_DEFINES
|
|
PRIVATE -DRENDERDOC_PLATFORM_LINUX)
|
|
|
|
# Set up rpath to find librenderdoc.so
|
|
set(CMAKE_SKIP_BUILD_RPATH TRUE)
|
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
|
set(CMAKE_INSTALL_RPATH "$ORIGIN/:$ORIGIN/../lib${LIB_SUFFIX}/${LIB_SUBFOLDER_TRAIL_SLASH}")
|
|
|
|
# Add python library
|
|
set (CMAKE_SHARED_LINKER_FLAGS "${PYTHON_LIBRARY} ${CMAKE_SHARED_LINKER_FLAGS}")
|
|
|
|
add_library(_renderdoc SHARED
|
|
${CMAKE_BINARY_DIR}/qrenderdoc/renderdoc_python.cxx
|
|
pyrenderdoc_stub.cpp)
|
|
|
|
set_source_files_properties(${CMAKE_BINARY_DIR}/qrenderdoc/renderdoc_python.cxx
|
|
PROPERTIES GENERATED TRUE)
|
|
|
|
target_compile_definitions(_renderdoc ${MODULE_DEFINES})
|
|
target_include_directories(_renderdoc ${MODULE_INCLUDES})
|
|
target_link_libraries(_renderdoc PRIVATE renderdoc)
|
|
|
|
add_library(_qrenderdoc SHARED
|
|
${CMAKE_BINARY_DIR}/qrenderdoc/renderdoc_python.cxx
|
|
${CMAKE_BINARY_DIR}/qrenderdoc/qrenderdoc_python.cxx
|
|
../Interface/CommonPipelineState.cpp
|
|
../Interface/PersistantConfig.cpp
|
|
../Interface/QRDInterface.cpp
|
|
../Interface/RemoteHost.cpp
|
|
pyrenderdoc_stub.cpp
|
|
qrenderdoc_stub.cpp)
|
|
|
|
set_source_files_properties(${CMAKE_BINARY_DIR}/qrenderdoc/qrenderdoc_python.cxx
|
|
PROPERTIES GENERATED TRUE)
|
|
|
|
# Add in Qt includes and libraries
|
|
set (CMAKE_CXX_FLAGS "${QT5_INCLUDE} ${CMAKE_CXX_FLAGS}")
|
|
set (CMAKE_SHARED_LINKER_FLAGS "${QT5_LIBS} ${CMAKE_SHARED_LINKER_FLAGS}")
|
|
set (MODULE_LIBRARIES
|
|
PRIVATE renderdoc
|
|
${QT5_LIBS})
|
|
|
|
target_compile_definitions(_qrenderdoc ${MODULE_DEFINES})
|
|
target_include_directories(_qrenderdoc ${MODULE_INCLUDES})
|
|
target_link_libraries(_qrenderdoc ${MODULE_LIBRARIES})
|
|
|
|
# Don't prefix with lib, python expects a bare .so.
|
|
# Also rename to non-underscore due to this (We couldn't call the
|
|
# python library 'renderdoc' since htat would clash with the
|
|
# prefixed target)
|
|
set_target_properties(_renderdoc PROPERTIES PREFIX "")
|
|
set_target_properties(_qrenderdoc PROPERTIES PREFIX "")
|
|
set_target_properties(_renderdoc PROPERTIES OUTPUT_NAME "renderdoc")
|
|
set_target_properties(_qrenderdoc PROPERTIES OUTPUT_NAME "qrenderdoc")
|
|
|
|
# Make sure we build after the wrappers are generated
|
|
add_dependencies(_renderdoc swig-bindings)
|
|
add_dependencies(_qrenderdoc swig-bindings)
|