@@ -13,21 +13,27 @@ set(CMAKE_SWIG_FLAGS -py3)
1313
1414# Determine filename suffix for python extension
1515if (WIN32 )
16- set (Python_EXTENSION ". ${Python_SOABI} . pyd" )
16+ set (LIB_EXT " pyd" )
1717else ()
18- set (Python_EXTENSION ". ${Python_SOABI} . so" )
18+ set (LIB_EXT " so" )
1919endif ()
2020
21+ set (Python_EXTENSION ".${Python_SOABI} .${LIB_EXT} " )
22+
2123
2224# Location of package at runtime on MacOS/Linux
2325if (APPLE )
24- set (PACKAGE_RPATH "@loader_path/../../../..;@loader_path/../../../../extern " )
26+ set (LIB_ROOT "@loader_path" )
2527else ()
26- set (PACKAGE_RPATH "$ORIGIN/../../../..;$ORIGIN/../../../../extern " )
28+ set (LIB_ROOT "$ORIGIN" )
2729endif ()
2830
31+ set (PACKAGE_RPATH "${LIB_ROOT} /../../../..;${LIB_ROOT} /../../../../extern" )
32+
2933
30- ####### OUTPUT TARGET #######
34+ #############################################################
35+ #################### OUTPUT TARGET ####################
36+ #############################################################
3137
3238set_property (SOURCE output .i
3339 PROPERTY
@@ -48,9 +54,14 @@ target_link_options(output
4854 $<$<BOOL :${APPLE} >:-undefineddynamic_lookup>
4955)
5056
57+ target_include_directories (output
58+ PUBLIC
59+ ${Python_INCLUDE_DIRS}
60+ )
61+
5162target_link_libraries (output
5263 PUBLIC
53- Python::Module
64+ $<$< BOOL :$<C_COMPILER_ID: MSVC >>: Python::Module>
5465 swmm-output
5566)
5667
@@ -82,8 +93,9 @@ install(
8293 "src/swmm/toolkit"
8394)
8495
85-
86- ####### SOLVER TARGET #######
96+ #############################################################
97+ #################### SOLVER TARGET ####################
98+ #############################################################
8799
88100set_property (SOURCE solver.i
89101 PROPERTY
@@ -104,9 +116,14 @@ target_link_options(solver
104116 $<$<BOOL :${APPLE} >:-undefineddynamic_lookup>
105117)
106118
119+ target_include_directories (solver
120+ PUBLIC
121+ ${Python_INCLUDE_DIRS}
122+ )
123+
107124target_link_libraries (solver
108125 PUBLIC
109- Python::Module
126+ $<$< BOOL :$<C_COMPILER_ID: MSVC >>: Python::Module>
110127 swmm5
111128)
112129
0 commit comments