Skip to content

Commit

Permalink
refactor: code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Nov 21, 2023
1 parent f6708f5 commit b28e5bd
Show file tree
Hide file tree
Showing 21 changed files with 69 additions and 615 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
*.pyc
setup.py
CMakeLists.txt.user

CMakeUserPresets.json
build/*
.idea
63 changes: 13 additions & 50 deletions lanelet2_core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,87 +1,50 @@
#set(MRT_PKG_VERSION 4.0.0)
# Modify only if you know what you are doing!
cmake_minimum_required(VERSION 3.5.1)
project(lanelet2_core)

###################
## Find packages ##
###################
#find_package(mrt_cmake_modules REQUIRED)
#include(UseMrtStdCompilerFlags)
#include(GatherDeps)

# You can add a custom.cmake in order to add special handling for this package. E.g. you can do:
# list(REMOVE_ITEM DEPENDEND_PACKAGES <package name 1> <package name 2> ...)
# To remove libs which cannot be found automatically. You can also "find_package" other, custom dependencies there.
# You can also set PROJECT_INSTALL_FILES to install files that are not installed by default.
#if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/custom.cmake")
# include("${CMAKE_CURRENT_SOURCE_DIR}/custom.cmake")
#endif()
#
#find_package(AutoDeps REQUIRED COMPONENTS ${DEPENDEND_PACKAGES})
#
#mrt_parse_package_xml()
find_package(Boost REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(GTest REQUIRED)

########################
## Add python modules ##
########################
# This adds a python module if located under src/{PROJECT_NAME)
#mrt_python_module_setup()

#mrt_glob_files(PROJECT_PYTHON_SOURCE_FILES_SRC "python_api/*.cpp")
#if (PROJECT_PYTHON_SOURCE_FILES_SRC)
# # Add a cpp-python api library. Make sure there are no name collisions with python modules in this project
# mrt_add_python_api( ${PROJECT_NAME}
# FILES ${PROJECT_PYTHON_SOURCE_FILES_SRC}
# )
#endif()
# Add python modules if located under src/{PROJECT_NAME)

############################
## Read source code files ##
############################
file(GLOB PROJECT_SOURCE_FILES_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
#mrt_glob_files_recurse(PROJECT_HEADER_FILES_INC "include/*.h" "include/*.hpp" "include/*.cuh")
#mrt_glob_files(PROJECT_SOURCE_FILES_INC "src/*.h" "src/*.hpp" "src/*.cuh")
#mrt_glob_files(PROJECT_SOURCE_FILES_SRC "src/*.cpp" "src/*.cu")


###########
## Build ##
###########
# Declare a cpp library
#mrt_add_library(${PROJECT_NAME}
# INCLUDES ${PROJECT_HEADER_FILES_INC} ${PROJECT_SOURCE_FILES_INC}
# SOURCES ${PROJECT_SOURCE_FILES_SRC}
# )
find_package(Boost REQUIRED)
find_package(Eigen3 REQUIRED)
add_library(${PROJECT_NAME} SHARED ${PROJECT_SOURCE_FILES_SRC})
target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(${PROJECT_NAME} PUBLIC Boost::boost Eigen3::Eigen)
target_link_libraries(${PROJECT_NAME} PUBLIC Boost::graph Eigen3::Eigen)

#############
## Install ##
#############
# Install all targets, headers by default and scripts and other files if specified (folders or files).
# This command also exports libraries and config files for dependent packages and this supersedes catkin_package.
#mrt_install(PROGRAMS scripts FILES res data ${PROJECT_INSTALL_FILES})
include(GNUInstallDirs)
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${PROJECT_INSTALL_FILES}
LIBRARY DESTINATION ${PROJECT_INSTALL_FILES}
RUNTIME DESTINATION ${PROJECT_INSTALL_FILES})
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(DIRECTORY doc/ DESTINATION "doc/${PROJECT_NAME}")
install(DIRECTORY scripts/ DESTINATION "scripts/")

#############
## Testing ##
#############
# Add test targets for cpp and python tests
#if (CATKIN_ENABLE_TESTING)
# mrt_add_tests(test)
# mrt_add_nosetests(test)
#endif ()

if(LANELET2_ENABLE_TESTING)
if (LANELET2_ENABLE_TESTING)
include(GoogleTest)
find_package(GTest REQUIRED)
file(GLOB PROJECT_SOURCE_FILES_TEST "${CMAKE_CURRENT_SOURCE_DIR}/test/*.cpp")
add_executable("${PROJECT_NAME}_test" ${PROJECT_SOURCE_FILES_TEST})
target_link_libraries("${PROJECT_NAME}_test" PRIVATE GTest::gtest_main ${PROJECT_NAME})
Expand Down
27 changes: 0 additions & 27 deletions lanelet2_core/package.xml

This file was deleted.

File renamed without changes.
File renamed without changes.
56 changes: 9 additions & 47 deletions lanelet2_io/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,59 +1,27 @@
#set(MRT_PKG_VERSION 4.0.0)
# Modify only if you know what you are doing!
cmake_minimum_required(VERSION 3.5.1)
project(lanelet2_io)

###################
## Find packages ##
###################
#find_package(mrt_cmake_modules REQUIRED)
#include(UseMrtStdCompilerFlags)
#include(GatherDeps)

# You can add a custom.cmake in order to add special handling for this package. E.g. you can do:
# list(REMOVE_ITEM DEPENDEND_PACKAGES <package name 1> <package name 2> ...)
# To remove libs which cannot be found automatically. You can also "find_package" other, custom dependencies there.
# You can also set PROJECT_INSTALL_FILES to install files that are not installed by default.
#if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/custom.cmake")
# include("${CMAKE_CURRENT_SOURCE_DIR}/custom.cmake")
#endif()
#
#find_package(AutoDeps REQUIRED COMPONENTS ${DEPENDEND_PACKAGES})
#
#mrt_parse_package_xml()
find_package(Boost REQUIRED)
find_package(pugixml REQUIRED)
find_package(GTest REQUIRED)

########################
## Add python modules ##
########################
# This adds a python module if located under src/{PROJECT_NAME)
#mrt_python_module_setup()
#
#mrt_glob_files(PROJECT_PYTHON_SOURCE_FILES_SRC "python_api/*.cpp")
#if (PROJECT_PYTHON_SOURCE_FILES_SRC)
# # Add a cpp-python api library. Make sure there are no name collisions with python modules in this project
# mrt_add_python_api( ${PROJECT_NAME}
# FILES ${PROJECT_PYTHON_SOURCE_FILES_SRC}
# )
#endif()
# Add python modules if located under src/{PROJECT_NAME)

############################
## Read source code files ##
############################
#mrt_glob_files_recurse(PROJECT_HEADER_FILES_INC "include/*.h" "include/*.hpp" "include/*.cuh")
#mrt_glob_files(PROJECT_SOURCE_FILES_INC "src/*.h" "src/*.hpp" "src/*.cuh")
#mrt_glob_files(PROJECT_SOURCE_FILES_SRC "src/*.cpp" "src/*.cu")
file(GLOB PROJECT_SOURCE_FILES_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")

###########
## Build ##
###########
# Declare a cpp library
#mrt_add_library(${PROJECT_NAME}
# INCLUDES ${PROJECT_HEADER_FILES_INC} ${PROJECT_SOURCE_FILES_INC}
# SOURCES ${PROJECT_SOURCE_FILES_SRC}
# )
find_package(Boost REQUIRED)
find_package(pugixml REQUIRED)
add_library(${PROJECT_NAME} SHARED ${PROJECT_SOURCE_FILES_SRC})
target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(${PROJECT_NAME} PUBLIC lanelet2_core Boost::filesystem Boost::serialization pugixml::pugixml)
Expand All @@ -62,25 +30,19 @@ target_link_libraries(${PROJECT_NAME} PUBLIC lanelet2_core Boost::filesystem Boo
## Install ##
#############
# Install all targets, headers by default and scripts and other files if specified (folders or files).
# This command also exports libraries and config files for dependent packages and this supersedes catkin_package.
#mrt_install(PROGRAMS scripts FILES res data ${PROJECT_INSTALL_FILES})
include(GNUInstallDirs)
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${PROJECT_INSTALL_FILES}
LIBRARY DESTINATION ${PROJECT_INSTALL_FILES}
RUNTIME DESTINATION ${PROJECT_INSTALL_FILES})
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

#############
## Testing ##
#############
# Add test targets for cpp and python tests
#if (CATKIN_ENABLE_TESTING)
# mrt_add_tests(test)
# mrt_add_nosetests(test)
#endif()

if (LANELET2_ENABLE_TESTING)
include(GoogleTest)
find_package(GTest REQUIRED)
file(GLOB PROJECT_SOURCE_FILES_TEST "${CMAKE_CURRENT_SOURCE_DIR}/test/*.cpp")
add_executable("${PROJECT_NAME}_test" ${PROJECT_SOURCE_FILES_TEST})
target_link_libraries("${PROJECT_NAME}_test" PRIVATE GTest::gtest_main ${PROJECT_NAME})
Expand Down
27 changes: 0 additions & 27 deletions lanelet2_io/package.xml

This file was deleted.

59 changes: 2 additions & 57 deletions lanelet2_maps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,56 +1,9 @@
#set(MRT_PKG_VERSION 4.0.0)
# Modify only if you know what you are doing!
cmake_minimum_required(VERSION 3.5.1)
project(lanelet2_maps)

###################
## Find packages ##
###################
#find_package(mrt_cmake_modules REQUIRED)
#include(UseMrtStdCompilerFlags)
#include(GatherDeps)

# You can add a custom.cmake in order to add special handling for this package. E.g. you can do:
# list(REMOVE_ITEM DEPENDEND_PACKAGES <package name 1> <package name 2> ...)
# To remove libs which cannot be found automatically. You can also "find_package" other, custom dependencies there.
# You can also set PROJECT_INSTALL_FILES to install files that are not installed by default.
#if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/custom.cmake")
# include("${CMAKE_CURRENT_SOURCE_DIR}/custom.cmake")
#endif()
#
#find_package(AutoDeps REQUIRED COMPONENTS ${DEPENDEND_PACKAGES})
#
#mrt_parse_package_xml()

########################
## Add python modules ##
########################
# This adds a python module if located under src/{PROJECT_NAME)
#mrt_python_module_setup()
#
#mrt_glob_files(PROJECT_PYTHON_SOURCE_FILES_SRC "python_api/*.cpp")
#if (PROJECT_PYTHON_SOURCE_FILES_SRC)
# # Add a cpp-python api library. Make sure there are no name collisions with python modules in this project
# mrt_add_python_api( ${PROJECT_NAME}
# FILES ${PROJECT_PYTHON_SOURCE_FILES_SRC}
# )
#endif()

############################
## Read source code files ##
############################
#mrt_glob_files_recurse(PROJECT_HEADER_FILES_INC "include/*.h" "include/*.hpp" "include/*.cuh")
#mrt_glob_files(PROJECT_SOURCE_FILES_INC "src/*.h" "src/*.hpp" "src/*.cuh")
#mrt_glob_files(PROJECT_SOURCE_FILES_SRC "src/*.cpp" "src/*.cu")

###########
## Build ##
###########
# Declare a cpp library
#mrt_add_library(${PROJECT_NAME}
# INCLUDES ${PROJECT_HEADER_FILES_INC} ${PROJECT_SOURCE_FILES_INC}
# SOURCES ${PROJECT_SOURCE_FILES_SRC}
# )
add_custom_target(${PROJECT_NAME})
add_custom_command(
TARGET ${PROJECT_NAME}
Expand All @@ -62,13 +15,5 @@ add_custom_command(
#############
# Install all targets, headers by default and scripts and other files if specified (folders or files).
# This command also exports libraries and config files for dependent packages and this supersedes catkin_package.
#mrt_install(PROGRAMS scripts FILES res data ${PROJECT_INSTALL_FILES})

#############
## Testing ##
#############
# Add test targets for cpp and python tests
#if (CATKIN_ENABLE_TESTING)
# mrt_add_tests(test)
# mrt_add_nosetests(test)
#endif ()
install(DIRECTORY res/ DESTINATION "res/")
install(DIRECTORY josm/ DESTINATION "res/" PATTERN ".gitignore" EXCLUDE)
22 changes: 0 additions & 22 deletions lanelet2_maps/package.xml

This file was deleted.

Loading

0 comments on commit b28e5bd

Please sign in to comment.