Skip to content

Commit

Permalink
cmake cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizux committed Dec 16, 2024
1 parent 84e6fc0 commit 4198271
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 42 deletions.
3 changes: 1 addition & 2 deletions ortools/constraint_solver/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ target_compile_definitions(pywrapcp PUBLIC "PY3")
if(APPLE)
set_target_properties(pywrapcp PROPERTIES
SUFFIX ".so"
INSTALL_RPATH "@loader_path;@loader_path/../../${PROJECT_NAME}/.libs"
)
INSTALL_RPATH "@loader_path;@loader_path/../../${PROJECT_NAME}/.libs")
target_link_options(pywrapcp PRIVATE "LINKER:-undefined,dynamic_lookup")
elseif(UNIX)
set_target_properties(pywrapcp PROPERTIES
Expand Down
6 changes: 2 additions & 4 deletions ortools/init/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ set_target_properties(init_pybind11 PROPERTIES
if(APPLE)
set_target_properties(init_pybind11 PROPERTIES
SUFFIX ".so"
INSTALL_RPATH "@loader_path;@loader_path/../../../${PYTHON_PROJECT}/.libs"
)
INSTALL_RPATH "@loader_path;@loader_path/../../../${PYTHON_PROJECT}/.libs")
elseif(UNIX)
set_target_properties(init_pybind11 PROPERTIES
INSTALL_RPATH "$ORIGIN:$ORIGIN/../../../${PYTHON_PROJECT}/.libs"
)
INSTALL_RPATH "$ORIGIN:$ORIGIN/../../../${PYTHON_PROJECT}/.libs")
endif()

target_link_libraries(init_pybind11 PRIVATE ${PROJECT_NAMESPACE}::ortools)
Expand Down
12 changes: 4 additions & 8 deletions ortools/linear_solver/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ target_compile_definitions(pywraplp PUBLIC "PY3")
if(APPLE)
set_target_properties(pywraplp PROPERTIES
SUFFIX ".so"
INSTALL_RPATH "@loader_path;@loader_path/../../${PROJECT_NAME}/.libs"
)
INSTALL_RPATH "@loader_path;@loader_path/../../${PROJECT_NAME}/.libs")
target_link_options(pywraplp PRIVATE "LINKER:-undefined,dynamic_lookup")
elseif(UNIX)
set_target_properties(pywraplp PROPERTIES
Expand All @@ -57,19 +56,16 @@ target_include_directories(model_builder_helper_pybind11 PRIVATE
if(APPLE)
set_target_properties(model_builder_helper_pybind11 PROPERTIES
SUFFIX ".so"
INSTALL_RPATH "@loader_path;@loader_path/../../../${PYTHON_PROJECT}/.libs"
)
INSTALL_RPATH "@loader_path;@loader_path/../../../${PYTHON_PROJECT}/.libs")
elseif(UNIX)
set_target_properties(model_builder_helper_pybind11 PROPERTIES
INSTALL_RPATH "$ORIGIN:$ORIGIN/../../../${PYTHON_PROJECT}/.libs"
)
INSTALL_RPATH "$ORIGIN:$ORIGIN/../../../${PYTHON_PROJECT}/.libs")
endif()

target_link_libraries(model_builder_helper_pybind11 PRIVATE
${PROJECT_NAMESPACE}::ortools
pybind11_native_proto_caster
Eigen3::Eigen
)
Eigen3::Eigen)
add_library(${PROJECT_NAMESPACE}::model_builder_helper_pybind11 ALIAS model_builder_helper_pybind11)

if(BUILD_TESTING)
Expand Down
9 changes: 3 additions & 6 deletions ortools/math_opt/core/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,19 @@ if(APPLE)
set_target_properties(math_opt_pybind11 PROPERTIES
SUFFIX ".so"
INSTALL_RPATH
"@loader_path;@loader_path/../../../../${PYTHON_PROJECT}/.libs;@loader_path/../../../../pybind11_abseil"
)
"@loader_path;@loader_path/../../../../${PYTHON_PROJECT}/.libs;@loader_path/../../../../pybind11_abseil")
elseif(UNIX)
set_target_properties(math_opt_pybind11 PROPERTIES
INSTALL_RPATH
"$ORIGIN:$ORIGIN/../../../../${PYTHON_PROJECT}/.libs:$ORIGIN/../../../../pybind11_abseil"
)
"$ORIGIN:$ORIGIN/../../../../${PYTHON_PROJECT}/.libs:$ORIGIN/../../../../pybind11_abseil")
endif()

target_link_libraries(math_opt_pybind11 PRIVATE
${PROJECT_NAMESPACE}::ortools
pybind11_abseil::absl_casters
pybind11_abseil::status_casters
pybind11_native_proto_caster
protobuf::libprotobuf
)
protobuf::libprotobuf)
add_library(${PROJECT_NAMESPACE}::math_opt_pybind11 ALIAS math_opt_pybind11)

if(BUILD_TESTING)
Expand Down
9 changes: 3 additions & 6 deletions ortools/pdlp/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,15 @@ set_target_properties(pdlp_pybind11 PROPERTIES
if(APPLE)
set_target_properties(pdlp_pybind11 PROPERTIES
SUFFIX ".so"
INSTALL_RPATH "@loader_path;@loader_path/../../../${PYTHON_PROJECT}/.libs"
)
INSTALL_RPATH "@loader_path;@loader_path/../../../${PYTHON_PROJECT}/.libs")
elseif(UNIX)
set_target_properties(pdlp_pybind11 PROPERTIES
INSTALL_RPATH "$ORIGIN:$ORIGIN/../../../${PYTHON_PROJECT}/.libs"
)
INSTALL_RPATH "$ORIGIN:$ORIGIN/../../../${PYTHON_PROJECT}/.libs")
endif()
target_link_libraries(pdlp_pybind11 PRIVATE
${PROJECT_NAMESPACE}::ortools
pybind11_native_proto_caster
protobuf::libprotobuf
)
protobuf::libprotobuf)
target_include_directories(pdlp_pybind11 PRIVATE ${protobuf_SOURCE_DIR})
add_library(${PROJECT_NAMESPACE}::pdlp_pybind11 ALIAS pdlp_pybind11)

Expand Down
9 changes: 3 additions & 6 deletions ortools/sat/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,15 @@ set_target_properties(swig_helper_pybind11 PROPERTIES
if(APPLE)
set_target_properties(swig_helper_pybind11 PROPERTIES
SUFFIX ".so"
INSTALL_RPATH "@loader_path;@loader_path/../../../${PYTHON_PROJECT}/.libs"
)
INSTALL_RPATH "@loader_path;@loader_path/../../../${PYTHON_PROJECT}/.libs")
elseif(UNIX)
set_target_properties(swig_helper_pybind11 PROPERTIES
INSTALL_RPATH "$ORIGIN:$ORIGIN/../../../${PYTHON_PROJECT}/.libs"
)
INSTALL_RPATH "$ORIGIN:$ORIGIN/../../../${PYTHON_PROJECT}/.libs")
endif()
target_link_libraries(swig_helper_pybind11 PRIVATE
${PROJECT_NAMESPACE}::ortools
pybind11_native_proto_caster
protobuf::libprotobuf
)
protobuf::libprotobuf)

target_include_directories(swig_helper_pybind11 PRIVATE ${protobuf_SOURCE_DIR})
add_library(${PROJECT_NAMESPACE}::swig_helper_pybind11 ALIAS swig_helper_pybind11)
Expand Down
9 changes: 3 additions & 6 deletions ortools/scheduling/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,15 @@ set_target_properties(rcpsp_pybind11 PROPERTIES
if(APPLE)
set_target_properties(rcpsp_pybind11 PROPERTIES
SUFFIX ".so"
INSTALL_RPATH "@loader_path;@loader_path/../../../${PYTHON_PROJECT}/.libs"
)
INSTALL_RPATH "@loader_path;@loader_path/../../../${PYTHON_PROJECT}/.libs")
elseif(UNIX)
set_target_properties(rcpsp_pybind11 PROPERTIES
INSTALL_RPATH "$ORIGIN:$ORIGIN/../../../${PYTHON_PROJECT}/.libs"
)
INSTALL_RPATH "$ORIGIN:$ORIGIN/../../../${PYTHON_PROJECT}/.libs")
endif()
target_link_libraries(rcpsp_pybind11 PRIVATE
${PROJECT_NAMESPACE}::ortools
pybind11_native_proto_caster
protobuf::libprotobuf
)
protobuf::libprotobuf)

target_include_directories(rcpsp_pybind11 PRIVATE ${protobuf_SOURCE_DIR})
add_library(${PROJECT_NAMESPACE}::rcpsp_pybind11 ALIAS rcpsp_pybind11)
Expand Down
6 changes: 2 additions & 4 deletions ortools/util/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ set_target_properties(sorted_interval_list_pybind11 PROPERTIES
if(APPLE)
set_target_properties(sorted_interval_list_pybind11 PROPERTIES
SUFFIX ".so"
INSTALL_RPATH "@loader_path;@loader_path/../../../${PYTHON_PROJECT}/.libs"
)
INSTALL_RPATH "@loader_path;@loader_path/../../../${PYTHON_PROJECT}/.libs")
elseif(UNIX)
set_target_properties(sorted_interval_list_pybind11 PROPERTIES
INSTALL_RPATH "$ORIGIN:$ORIGIN/../../../${PYTHON_PROJECT}/.libs"
)
INSTALL_RPATH "$ORIGIN:$ORIGIN/../../../${PYTHON_PROJECT}/.libs")
endif()

target_link_libraries(sorted_interval_list_pybind11 PRIVATE ${PROJECT_NAMESPACE}::ortools)
Expand Down

0 comments on commit 4198271

Please sign in to comment.