Skip to content

Commit

Permalink
feat: update CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Nov 23, 2023
1 parent e80788d commit 2cd7db4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ if (MSVC)
add_compile_definitions(_USE_MATH_DEFINES)
endif ()

if (SKBUILD)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
# set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_INSTALL_RPATH "${CMAKE_SOURCE_DIR}/build/lib")
endif ()

option(LANELET2_ENABLE_TESTING "Build the tests." ON)
if (LANELET2_ENABLE_TESTING)
enable_testing()
Expand Down
7 changes: 6 additions & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from conan import ConanFile
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps

from conan.tools.files import copy
from lanelet2_python.src.lanelet2 import __version__


Expand Down Expand Up @@ -93,6 +93,11 @@ def generate(self):
tc = CMakeToolchain(self)
tc.generate()

for dep in self.dependencies.values():
copy(self, "*.dylib*", dep.cpp_info.libdirs[0], str(self.source_path / "build" / "lib"))
copy(self, "*.so*", dep.cpp_info.libdirs[0], str(self.source_path / "build" / "lib"))
copy(self, "*.dll", dep.cpp_info.bindirs[0], str(self.source_path / "build" / "lib"))

def build(self):
cmake = CMake(self)
cmake.configure()
Expand Down
7 changes: 0 additions & 7 deletions lanelet2_python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ foreach (PROJECT_PYTHON_SOURCE_FILE ${PROJECT_PYTHON_SOURCE_FILES_SRC})
target_include_directories(${PYTHON_MODULE_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_include_directories(${PYTHON_MODULE_NAME} PRIVATE ${Python3_INCLUDE_DIRS})
target_link_libraries(${PYTHON_MODULE_NAME} PUBLIC Boost::python lanelet2_core lanelet2_io lanelet2_projection lanelet2_traffic_rules lanelet2_routing lanelet2_matching)

if (DEFINED SKBUILD AND NOT WIN32)
set_target_properties(${PYTHON_MODULE_NAME} PROPERTIES
BUILD_WITH_INSTALL_RPATH TRUE
INSTALL_RPATH_USE_LINK_PATH TRUE
INSTALL_RPATH "${CMAKE_SOURCE_DIR}/build/lib")
endif ()
endforeach ()

#############
Expand Down

0 comments on commit 2cd7db4

Please sign in to comment.