Skip to content

Commit cf0da2e

Browse files
committed
Add some more features to build_pybundle for PyObjC
1 parent 7cdc505 commit cf0da2e

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

CMakeLists.txt

+13-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ include(CMakeParseArguments)
44
include(darling_bundle)
55

66
function(build_pybundle name)
7-
cmake_parse_arguments(BUNDLE "FAT" "PYTHON_VERSION;DESTINATION" "SOURCES" ${ARGN})
7+
cmake_parse_arguments(BUNDLE "FAT" "PYTHON_VERSION;DESTINATION;OUTPUT_NAME" "SOURCES;DEPENDS" ${ARGN})
8+
9+
if(NOT BUNDLE_OUTPUT_NAME)
10+
set(BUNDLE_OUTPUT_NAME "${name}")
11+
endif()
812

913
# Apple has removed Python 2.6 support, so disable this codepath
1014
#
@@ -33,18 +37,21 @@ function(build_pybundle name)
3337
message(FATAL_ERROR "Unknown Python version set: ${BUNDLE_PYTHON_VERSION}")
3438
endif()
3539

36-
set(full_name "${name}_${suffix}")
40+
set(full_name "${name}${suffix}")
3741
add_darling_bundle("${full_name}" "" ${BUNDLE_SOURCES})
3842

3943
if (BUNDLE_FAT)
4044
make_fat("${full_name}")
4145
endif (BUNDLE_FAT)
4246

43-
set_property(TARGET "${full_name}" APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-flat_namespace -Wl,-undefined,suppress ")
47+
set_property(TARGET "${full_name}" APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-undefined,dynamic_lookup ")
4448

45-
target_link_libraries("${full_name}" system)
46-
install(TARGETS "${full_name}" DESTINATION "${BUNDLE_DESTINATION}")
47-
install(CODE "execute_process(COMMAND mv ${full_name} ${name}.so WORKING_DIRECTORY ${BUNDLE_DESTINATION})")
49+
target_link_libraries("${full_name}" system "${BUNDLE_DEPENDS}")
50+
install(
51+
PROGRAMS "$<TARGET_FILE:${full_name}>"
52+
DESTINATION "${BUNDLE_DESTINATION}"
53+
RENAME "${BUNDLE_OUTPUT_NAME}.so"
54+
)
4855
endfunction(build_pybundle)
4956

5057
function(easyinstall python_version package_name package_version)

0 commit comments

Comments
 (0)