Skip to content

Commit 7f940f0

Browse files
ElektrikAkarclaude
andcommitted
Fix CI: add POSITION_INDEPENDENT_CODE for Linux shared library linking
The dtwc++ static library is linked into the Python .so extension. On Linux, static libraries linked into shared objects must be compiled with -fPIC. Set POSITION_INDEPENDENT_CODE ON for both dtwc++ and mip-solvers targets. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ee47be2 commit 7f940f0

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

dtwc/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.21)
22

33
add_library(dtwc++ STATIC)
44

5+
# Required for linking into the Python shared library (.so) on Linux
6+
set_target_properties(dtwc++ PROPERTIES POSITION_INDEPENDENT_CODE ON)
7+
58
add_subdirectory(mip)
69

710
target_sources(dtwc++

dtwc/mip/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
cmake_minimum_required(VERSION 3.21)
22
add_library(mip-solvers OBJECT)
3+
set_target_properties(mip-solvers PROPERTIES POSITION_INDEPENDENT_CODE ON)
34

45
target_sources(mip-solvers
56
PRIVATE

0 commit comments

Comments
 (0)