From 9c98253e19a472593d1f9c262831f3d5fb786bf0 Mon Sep 17 00:00:00 2001 From: Jarrett Johnson Date: Fri, 10 May 2024 21:00:14 -0400 Subject: [PATCH] Remove ext objs --- CMakeLists.txt | 18 ++++-------------- setup.py | 9 +-------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 22a699711..26abf10b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,24 +29,14 @@ target_link_directories(${TARGET_NAME} PUBLIC ${ALL_LIB_DIR} ) -if (DEFINED ALL_EXT_OBJ) - add_library(ext_obj OBJECT IMPORTED PRIVATE) - set_target_properties(ext_obj PROPERTIES - IMPORTED_OBJECTS ${ALL_EXT_OBJ} - ) - target_link_libraries(${TARGET_NAME} - ${ALL_LIB} - $ - ${ALL_EXT_LINK} -) -else() - target_link_libraries(${TARGET_NAME} +if(APPLE) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup") +endif() +target_link_libraries(${TARGET_NAME} ${ALL_LIB} ${ALL_EXT_LINK} - "-undefined dynamic_lookup" ) -endif() target_compile_definitions(${TARGET_NAME} PUBLIC ${ALL_DEF} diff --git a/setup.py b/setup.py index ea5fa310c..5657d49f6 100644 --- a/setup.py +++ b/setup.py @@ -139,8 +139,7 @@ def __init__(self, library_dirs=[], define_macros=[], extra_link_args=[], - extra_compile_args=[], - extra_objects=[]): + extra_compile_args=[]): # don't invoke the original build_ext for this special extension super().__init__(name, sources=[]) self.sources = sources @@ -150,7 +149,6 @@ def __init__(self, self.define_macros = define_macros self.extra_link_args = extra_link_args self.extra_compile_args = extra_compile_args - self.extra_objects = extra_objects class build_ext_pymol(build_ext): @@ -189,7 +187,6 @@ def concat_paths(paths): all_comp_args = ''.join(f"{arg};" for arg in ext.extra_compile_args) all_lib_dirs = concat_paths(ext.library_dirs) all_inc_dirs = concat_paths(ext.include_dirs) - all_ext_objs = concat_paths(ext.extra_objects) lib_mode = "RUNTIME" if WIN else "LIBRARY" @@ -209,9 +206,6 @@ def concat_paths(paths): f"-DSHARED_SUFFIX={shared_suffix}" ] - if all_ext_objs: - cmake_args.append("-DALL_EXT_OBJ=" + all_ext_objs) - # example of build args build_args = ['--config', config] if not WIN: # Win /MP flag on compilation level @@ -622,7 +616,6 @@ def get_packages(base, parent='', r=None): define_macros=def_macros, extra_link_args=ext_link_args, extra_compile_args=ext_comp_args, - extra_objects=ext_objects, ), CMakeExtension(