Skip to content

Commit

Permalink
Remove ext objs
Browse files Browse the repository at this point in the history
  • Loading branch information
JarrettSJohnson committed May 11, 2024
1 parent 61fc7ea commit 9c98253
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
18 changes: 4 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
$<TARGET_OBJECTS:ext_obj>
${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}
Expand Down
9 changes: 1 addition & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down Expand Up @@ -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"

Expand All @@ -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
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 9c98253

Please sign in to comment.