From 7b83eac94312574cf6019ae7da12850c7b2626d9 Mon Sep 17 00:00:00 2001 From: Donny Lawrence Date: Fri, 24 Apr 2020 19:52:15 -0500 Subject: [PATCH] CMake: Build deploy-stub Closes #918 Co-authored-by: rdb --- pandatool/CMakeLists.txt | 1 + pandatool/src/deploy-stub/CMakeLists.txt | 41 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 pandatool/src/deploy-stub/CMakeLists.txt diff --git a/pandatool/CMakeLists.txt b/pandatool/CMakeLists.txt index 8f26fb2d9a..d3f6347736 100644 --- a/pandatool/CMakeLists.txt +++ b/pandatool/CMakeLists.txt @@ -8,6 +8,7 @@ add_subdirectory(src/bam) add_subdirectory(src/converter) add_subdirectory(src/daeegg) add_subdirectory(src/daeprogs) +add_subdirectory(src/deploy-stub) add_subdirectory(src/dxf) add_subdirectory(src/dxfegg) add_subdirectory(src/dxfprogs) diff --git a/pandatool/src/deploy-stub/CMakeLists.txt b/pandatool/src/deploy-stub/CMakeLists.txt new file mode 100644 index 0000000000..851bc9ac4c --- /dev/null +++ b/pandatool/src/deploy-stub/CMakeLists.txt @@ -0,0 +1,41 @@ +if(NOT HAVE_PYTHON) + return() +endif() + +add_executable(deploy-stub deploy-stub.c) + +if(IS_OSX) + target_link_options(deploy-stub PRIVATE -sectcreate __PANDA __panda /dev/null) + set_target_properties(deploy-stub PROPERTIES + INSTALL_RPATH "@executable_path" + BUILD_WITH_INSTALL_RPATH ON) + +elseif(WIN32) + target_sources(deploy-stub PRIVATE frozen_dllmain.c) + +elseif(IS_LINUX OR IS_FREEBSD) + set_target_properties(deploy-stub PROPERTIES + INSTALL_RPATH "$ORIGIN" + BUILD_WITH_INSTALL_RPATH ON) + target_link_options(deploy-stub PRIVATE -Wl,-z,origin -rdynamic) +endif() + +target_link_libraries(deploy-stub Python::Python) +install(TARGETS deploy-stub) + +if(WIN32 OR IS_OSX) + add_executable(deploy-stubw WIN32 deploy-stub.c) + + if(IS_OSX) + target_link_options(deploy-stubw PRIVATE -sectcreate __PANDA __panda /dev/null) + set_target_properties(deploy-stubw PROPERTIES + INSTALL_RPATH "@executable_path/../Frameworks" + BUILD_WITH_INSTALL_RPATH ON) + target_compile_definitions(deploy-stubw PRIVATE MACOS_APP_BUNDLE=1) + elseif(WIN32) + target_sources(deploy-stubw PRIVATE frozen_dllmain.c) + endif() + + target_link_libraries(deploy-stubw Python::Python) + install(TARGETS deploy-stubw) +endif()