diff --git a/ortools/algorithms/python/CMakeLists.txt b/ortools/algorithms/python/CMakeLists.txt index 332fec6d56e..7d532ac35bf 100644 --- a/ortools/algorithms/python/CMakeLists.txt +++ b/ortools/algorithms/python/CMakeLists.txt @@ -22,9 +22,6 @@ if(APPLE) SUFFIX ".so" INSTALL_RPATH "@loader_path;@loader_path/../../../${PYTHON_PROJECT}/.libs" ) - set_property(TARGET knapsack_solver_pybind11 APPEND PROPERTY - LINK_FLAGS "-flat_namespace -undefined suppress" - ) elseif(UNIX) set_target_properties(knapsack_solver_pybind11 PROPERTIES INSTALL_RPATH "$ORIGIN:$ORIGIN/../../../${PYTHON_PROJECT}/.libs" @@ -45,9 +42,6 @@ if(APPLE) SUFFIX ".so" INSTALL_RPATH "@loader_path;@loader_path/../../../${PYTHON_PROJECT}/.libs" ) - set_property(TARGET set_cover_pybind11 APPEND PROPERTY - LINK_FLAGS "-flat_namespace -undefined suppress" - ) elseif(UNIX) set_target_properties(set_cover_pybind11 PROPERTIES INSTALL_RPATH "$ORIGIN:$ORIGIN/../../../${PYTHON_PROJECT}/.libs" diff --git a/ortools/constraint_solver/python/CMakeLists.txt b/ortools/constraint_solver/python/CMakeLists.txt index a9b9569b64f..2ede9d92727 100644 --- a/ortools/constraint_solver/python/CMakeLists.txt +++ b/ortools/constraint_solver/python/CMakeLists.txt @@ -20,21 +20,15 @@ set_target_properties(constraint_solver_pybind11 PROPERTIES if(APPLE) set_target_properties(constraint_solver_pybind11 PROPERTIES SUFFIX ".so" - INSTALL_RPATH "@loader_path;@loader_path/../../../${PYTHON_PROJECT}/.libs" - ) - set_property(TARGET constraint_solver_pybind11 APPEND PROPERTY - LINK_FLAGS "-flat_namespace -undefined suppress" - ) + INSTALL_RPATH "@loader_path;@loader_path/../../../${PYTHON_PROJECT}/.libs") elseif(UNIX) set_target_properties(constraint_solver_pybind11 PROPERTIES - INSTALL_RPATH "$ORIGIN:$ORIGIN/../../../${PYTHON_PROJECT}/.libs" - ) + INSTALL_RPATH "$ORIGIN:$ORIGIN/../../../${PYTHON_PROJECT}/.libs") endif() target_link_libraries(constraint_solver_pybind11 PRIVATE ${PROJECT_NAMESPACE}::ortools - pybind11_native_proto_caster -) + pybind11_native_proto_caster) add_library(${PROJECT_NAMESPACE}::constraint_solver_pybind11 ALIAS constraint_solver_pybind11) # legacy pywrapcp @@ -58,8 +52,7 @@ if(APPLE) set_target_properties(pywrapcp PROPERTIES SUFFIX ".so" INSTALL_RPATH "@loader_path;@loader_path/../../${PROJECT_NAME}/.libs") - set_property(TARGET pywrapcp APPEND PROPERTY - LINK_FLAGS "-flat_namespace -undefined suppress") + target_link_options(pywrapcp PRIVATE "LINKER:-undefined,dynamic_lookup") elseif(UNIX) set_target_properties(pywrapcp PROPERTIES INSTALL_RPATH "$ORIGIN:$ORIGIN/../../${PROJECT_NAME}/.libs") diff --git a/ortools/graph/python/CMakeLists.txt b/ortools/graph/python/CMakeLists.txt index 834732c5a1c..3ac194b613e 100644 --- a/ortools/graph/python/CMakeLists.txt +++ b/ortools/graph/python/CMakeLists.txt @@ -19,7 +19,6 @@ if(APPLE) set_target_properties(linear_sum_assignment_pybind11 PROPERTIES SUFFIX ".so" INSTALL_RPATH "@loader_path;@loader_path/../../../${PYTHON_PROJECT}/.libs" - LINK_FLAGS "-flat_namespace -undefined suppress" ) elseif(UNIX) set_target_properties(linear_sum_assignment_pybind11 PROPERTIES @@ -37,7 +36,6 @@ if(APPLE) set_target_properties(max_flow_pybind11 PROPERTIES SUFFIX ".so" INSTALL_RPATH "@loader_path;@loader_path/../../../${PYTHON_PROJECT}/.libs" - LINK_FLAGS "-flat_namespace -undefined suppress" ) elseif(UNIX) set_target_properties(max_flow_pybind11 PROPERTIES @@ -55,7 +53,6 @@ if(APPLE) set_target_properties(min_cost_flow_pybind11 PROPERTIES SUFFIX ".so" INSTALL_RPATH "@loader_path;@loader_path/../../../${PYTHON_PROJECT}/.libs" - LINK_FLAGS "-flat_namespace -undefined suppress" ) elseif(UNIX) set_target_properties(min_cost_flow_pybind11 PROPERTIES diff --git a/ortools/init/python/CMakeLists.txt b/ortools/init/python/CMakeLists.txt index 954c385b43c..ff471b294fc 100644 --- a/ortools/init/python/CMakeLists.txt +++ b/ortools/init/python/CMakeLists.txt @@ -19,15 +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" - ) - set_property(TARGET init_pybind11 APPEND PROPERTY - LINK_FLAGS "-flat_namespace -undefined suppress" - ) + 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) diff --git a/ortools/linear_solver/python/CMakeLists.txt b/ortools/linear_solver/python/CMakeLists.txt index 5f7738f72ca..c33c9a43c09 100644 --- a/ortools/linear_solver/python/CMakeLists.txt +++ b/ortools/linear_solver/python/CMakeLists.txt @@ -30,8 +30,7 @@ if(APPLE) set_target_properties(pywraplp PROPERTIES SUFFIX ".so" INSTALL_RPATH "@loader_path;@loader_path/../../${PROJECT_NAME}/.libs") - set_property(TARGET pywraplp APPEND PROPERTY - LINK_FLAGS "-flat_namespace -undefined suppress") + target_link_options(pywraplp PRIVATE "LINKER:-undefined,dynamic_lookup") elseif(UNIX) set_target_properties(pywraplp PROPERTIES INSTALL_RPATH "$ORIGIN:$ORIGIN/../../${PROJECT_NAME}/.libs") @@ -57,22 +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" - ) - set_property(TARGET model_builder_helper_pybind11 APPEND PROPERTY - LINK_FLAGS "-flat_namespace -undefined suppress" - ) + 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) diff --git a/ortools/math_opt/core/python/CMakeLists.txt b/ortools/math_opt/core/python/CMakeLists.txt index 8d6b7cb67d3..0b50e8d60f4 100644 --- a/ortools/math_opt/core/python/CMakeLists.txt +++ b/ortools/math_opt/core/python/CMakeLists.txt @@ -20,16 +20,11 @@ if(APPLE) set_target_properties(math_opt_pybind11 PROPERTIES SUFFIX ".so" INSTALL_RPATH - "@loader_path;@loader_path/../../../../${PYTHON_PROJECT}/.libs;@loader_path/../../../../pybind11_abseil" - ) - set_property(TARGET math_opt_pybind11 APPEND PROPERTY - LINK_FLAGS "-flat_namespace -undefined suppress" - ) + "@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 @@ -37,8 +32,7 @@ target_link_libraries(math_opt_pybind11 PRIVATE 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) diff --git a/ortools/pdlp/python/CMakeLists.txt b/ortools/pdlp/python/CMakeLists.txt index f01299634a0..2dc9532a311 100644 --- a/ortools/pdlp/python/CMakeLists.txt +++ b/ortools/pdlp/python/CMakeLists.txt @@ -18,19 +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" - LINK_FLAGS "-flat_namespace -undefined suppress" - ) + 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) diff --git a/ortools/routing/BUILD.bazel b/ortools/routing/BUILD.bazel index d4fb4888b3a..7e41bf9b16c 100644 --- a/ortools/routing/BUILD.bazel +++ b/ortools/routing/BUILD.bazel @@ -291,4 +291,3 @@ cc_library( "@com_google_protobuf//:protobuf", ], ) - diff --git a/ortools/routing/python/CMakeLists.txt b/ortools/routing/python/CMakeLists.txt index 264e2288175..a85484bdae4 100644 --- a/ortools/routing/python/CMakeLists.txt +++ b/ortools/routing/python/CMakeLists.txt @@ -20,15 +20,10 @@ set_target_properties(routing_pybind11 PROPERTIES if(APPLE) set_target_properties(routing_pybind11 PROPERTIES SUFFIX ".so" - INSTALL_RPATH "@loader_path;@loader_path/../../../${PYTHON_PROJECT}/.libs" - ) - set_property(TARGET routing_pybind11 APPEND PROPERTY - LINK_FLAGS "-flat_namespace -undefined suppress" - ) + INSTALL_RPATH "@loader_path;@loader_path/../../../${PYTHON_PROJECT}/.libs") elseif(UNIX) set_target_properties(routing_pybind11 PROPERTIES - INSTALL_RPATH "$ORIGIN:$ORIGIN/../../../${PYTHON_PROJECT}/.libs" - ) + INSTALL_RPATH "$ORIGIN:$ORIGIN/../../../${PYTHON_PROJECT}/.libs") endif() target_link_libraries(routing_pybind11 PRIVATE @@ -58,8 +53,7 @@ if(APPLE) set_target_properties(pywraprouting PROPERTIES SUFFIX ".so" INSTALL_RPATH "@loader_path;@loader_path/../../${PROJECT_NAME}/.libs") - set_property(TARGET pywraprouting APPEND PROPERTY - LINK_FLAGS "-flat_namespace -undefined suppress") + target_link_options(pywraprouting PRIVATE "LINKER:-undefined,dynamic_lookup") elseif(UNIX) set_target_properties(pywraprouting PROPERTIES INSTALL_RPATH "$ORIGIN:$ORIGIN/../../${PROJECT_NAME}/.libs") diff --git a/ortools/sat/python/CMakeLists.txt b/ortools/sat/python/CMakeLists.txt index a1f46fc7d85..cf3e7d8d6a6 100644 --- a/ortools/sat/python/CMakeLists.txt +++ b/ortools/sat/python/CMakeLists.txt @@ -19,21 +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" - ) - set_property(TARGET swig_helper_pybind11 APPEND PROPERTY - LINK_FLAGS "-flat_namespace -undefined suppress" - ) + 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) diff --git a/ortools/scheduling/python/CMakeLists.txt b/ortools/scheduling/python/CMakeLists.txt index 386f6c28568..cccb40194e6 100644 --- a/ortools/scheduling/python/CMakeLists.txt +++ b/ortools/scheduling/python/CMakeLists.txt @@ -19,21 +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" - ) - set_property(TARGET rcpsp_pybind11 APPEND PROPERTY - LINK_FLAGS "-flat_namespace -undefined suppress" - ) + 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) diff --git a/ortools/util/python/CMakeLists.txt b/ortools/util/python/CMakeLists.txt index 3dc463b71e6..d4cac301cbc 100644 --- a/ortools/util/python/CMakeLists.txt +++ b/ortools/util/python/CMakeLists.txt @@ -19,15 +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" - ) - set_property(TARGET sorted_interval_list_pybind11 APPEND PROPERTY - LINK_FLAGS "-flat_namespace -undefined suppress" - ) + 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)