Skip to content

Commit

Permalink
feat: add lanelet2_python
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Nov 21, 2023
1 parent e55d298 commit 8f1bf9a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
add_compile_definitions(_USE_MATH_DEFINES)
endif ()

Expand All @@ -21,6 +22,6 @@ add_subdirectory(lanelet2_traffic_rules)
add_subdirectory(lanelet2_routing)
add_subdirectory(lanelet2_validation)
#add_subdirectory(lanelet2_examples)
#add_subdirectory(lanelet2_python)
add_subdirectory(lanelet2_python)
add_subdirectory(lanelet2_maps)
add_subdirectory(lanelet2_matching)
25 changes: 16 additions & 9 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,28 @@ class Lanelet2Conan(ConanFile):
# Optional metadata
license = "BSD"
url = "https://github.com/wu-vincent/lanelet2"
description = "Your favorite map handling framework for automated driving, now standalone and with cross-platform support."
description = (
"Your favorite map handling framework for automated driving, now standalone and with cross-platform support."
)

# Binary configuration
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True]}
default_options = {"shared": False, "fPIC": True} # "boost/*:shared": True
default_options = {
"shared": False,
"fPIC": True,
# "boost/*:shared": True,
"boost/*:without_python": False,
}

proj_list = [
'lanelet2_core',
'lanelet2_io',
'lanelet2_matching',
'lanelet2_projection',
'lanelet2_traffic_rules',
'lanelet2_routing',
'lanelet2_validation'
"lanelet2_core",
"lanelet2_io",
"lanelet2_matching",
"lanelet2_projection",
"lanelet2_traffic_rules",
"lanelet2_routing",
"lanelet2_validation",
]

exports_sources = ["CMakeLists.txt"] + [f"{proj}/*" for proj in proj_list]
Expand Down
10 changes: 7 additions & 3 deletions lanelet2_python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,30 @@ project(lanelet2_python)
## Find packages ##
###################
find_package(Boost REQUIRED COMPONENTS python)
find_package(PythonLibs REQUIRED)
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)

########################
## Build python modules ##
########################
file(GLOB PROJECT_PYTHON_SOURCE_FILES_SRC "${CMAKE_SOURCE_DIR}/python_api/*.cpp")
file(GLOB PROJECT_PYTHON_SOURCE_FILES_SRC "${CMAKE_CURRENT_SOURCE_DIR}/python_api/*.cpp")
foreach (PROJECT_PYTHON_SOURCE_FILE ${PROJECT_PYTHON_SOURCE_FILES_SRC})
get_filename_component(PYTHON_MODULE_NAME ${PROJECT_PYTHON_SOURCE_FILE} NAME_WE)
add_library(${PYTHON_MODULE_NAME} SHARED ${PROJECT_PYTHON_SOURCE_FILE})
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 lanelet2_core lanelet2_io lanelet2_projection lanelet2_traffic_rules lanelet2_routing lanelet2_matching)
target_link_libraries(${PYTHON_MODULE_NAME} PUBLIC Boost::python Python3::Python)
set_target_properties(${PYTHON_MODULE_NAME} PROPERTIES PREFIX "")
endforeach ()

#############
## Install ##
#############
# Install all targets, headers by default and scripts and other files if specified (folders or files).

# TODO:

#############
## Testing ##
#############
# Add test targets for cpp and python tests
# TODO:

0 comments on commit 8f1bf9a

Please sign in to comment.