Skip to content

Commit

Permalink
Test no linkage macos
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetanserre committed Nov 25, 2024
1 parent fc8566d commit 3567fe6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: False
matrix:
os: [ ubuntu-latest, macos-14 ]
os: [ ubuntu-latest, macos-latest ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
21 changes: 16 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ project(gkls)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_FLAGS "-fPIC -O3")

# Detect platform
if(UNIX AND NOT APPLE)
set(LINUX TRUE)
elseif(UNIX)
Expand All @@ -11,19 +12,29 @@ else()
set(WINDOWS TRUE)
endif()

# Find Python
if(APPLE)
find_package(Python COMPONENTS Development REQUIRED)
link_libraries(${Python_LIBRARIES})
find_package(Python COMPONENTS Development.Module REQUIRED)
else()
find_package(Python COMPONENTS Development.Module REQUIRED)
endif()

message(STATUS "Python_INCLUDE_DIRS: ${Python_INCLUDE_DIRS}")

# Source files
file(GLOB_RECURSE SRC_FILES src/*.cc)

# Include directories
include_directories(include ${Python_INCLUDE_DIRS})

# Add the shared library
add_library(${EXT_NAME} SHARED ${SRC_FILES} ${CYTHON_CPP_FILE})

# link_libraries(${EXT_NAME} ${Python_LIBRARIES})

# add_executable(example src/example.cc)
# Set macOS-specific linker flags
if(APPLE)
set_target_properties(
${EXT_NAME}
PROPERTIES
LINK_FLAGS "-undefined dynamic_lookup"
)
endif()

0 comments on commit 3567fe6

Please sign in to comment.