From f16983e668724d4fea1f248cb3e36509e1b5962e Mon Sep 17 00:00:00 2001 From: Matt Bhagat-Conway Date: Tue, 18 Jun 2024 09:51:51 -0400 Subject: [PATCH] build libosrm as a monolithic library, alternate fix #6954/#6955 --- CMakeLists.txt | 126 +++++++++++++------------------------------------ 1 file changed, 33 insertions(+), 93 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1876d6b85c7..d2f305ef6b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,7 +130,7 @@ configure_file( ) file(GLOB UtilGlob src/util/*.cpp src/util/*/*.cpp) file(GLOB ExtractorGlob src/extractor/*.cpp src/extractor/*/*.cpp) -file(GLOB GuidanceGlob src/guidance/*.cpp src/extractor/intersection/*.cpp) +file(GLOB GuidanceGlob src/guidance/*.cpp) file(GLOB PartitionerGlob src/partitioner/*.cpp) file(GLOB CustomizerGlob src/customize/*.cpp) file(GLOB ContractorGlob src/contractor/*.cpp) @@ -138,7 +138,7 @@ file(GLOB UpdaterGlob src/updater/*.cpp) file(GLOB StorageGlob src/storage/*.cpp) file(GLOB ServerGlob src/server/*.cpp src/server/**/*.cpp) file(GLOB EngineGlob src/engine/*.cpp src/engine/**/*.cpp) -file(GLOB ErrorcodesGlob src/osrm/errorcodes.cpp) +file(GLOB OSRMGlob src/osrm/*.cpp) add_library(UTIL OBJECT ${UtilGlob}) add_library(EXTRACTOR OBJECT ${ExtractorGlob}) @@ -162,14 +162,19 @@ add_executable(osrm-partition src/tools/partition.cpp) add_executable(osrm-customize src/tools/customize.cpp) add_executable(osrm-contract src/tools/contract.cpp) add_executable(osrm-datastore src/tools/store.cpp $ $) -add_library(osrm src/osrm/osrm.cpp $ $ $ $) -add_library(osrm_contract src/osrm/contractor.cpp $ $) -add_library(osrm_extract src/osrm/extractor.cpp $ $ $) -add_library(osrm_guidance $ $) -add_library(osrm_partition src/osrm/partitioner.cpp $ $ $) -add_library(osrm_customize src/osrm/customizer.cpp $ $ $) -add_library(osrm_update $ $ $) -add_library(osrm_store $ $ $) +add_library(osrm + ${OSRMGlob} + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + ) # Explicitly set the build type to Release if no other type is specified # on the command line. Without this, cmake defaults to an unoptimized, @@ -489,87 +494,29 @@ set(BOOST_ENGINE_LIBRARIES ${BOOST_BASE_LIBRARIES}) # Binaries -target_link_libraries(osrm-datastore osrm_store ${Boost_PROGRAM_OPTIONS_LIBRARY}) -target_link_libraries(osrm-extract osrm_extract ${Boost_PROGRAM_OPTIONS_LIBRARY}) -target_link_libraries(osrm-partition osrm_partition ${Boost_PROGRAM_OPTIONS_LIBRARY}) -target_link_libraries(osrm-customize osrm_customize ${Boost_PROGRAM_OPTIONS_LIBRARY}) -target_link_libraries(osrm-contract osrm_contract ${Boost_PROGRAM_OPTIONS_LIBRARY}) +target_link_libraries(osrm-datastore osrm ${Boost_PROGRAM_OPTIONS_LIBRARY}) +target_link_libraries(osrm-extract osrm ${Boost_PROGRAM_OPTIONS_LIBRARY}) +target_link_libraries(osrm-partition osrm ${Boost_PROGRAM_OPTIONS_LIBRARY}) +target_link_libraries(osrm-customize osrm ${Boost_PROGRAM_OPTIONS_LIBRARY}) +target_link_libraries(osrm-contract osrm ${Boost_PROGRAM_OPTIONS_LIBRARY}) if (BUILD_ROUTED) target_link_libraries(osrm-routed osrm ${Boost_PROGRAM_OPTIONS_LIBRARY} ${OPTIONAL_SOCKET_LIBS} ${ZLIB_LIBRARY}) endif() -set(EXTRACTOR_LIBRARIES - ${BZIP2_LIBRARIES} - ${Boost_REGEX_LIBRARY} - ${BOOST_BASE_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} - ${EXPAT_LIBRARIES} - ${LUA_LIBRARIES} - ${OSMIUM_LIBRARIES} - ${TBB_LIBRARIES} - ${ZLIB_LIBRARY} - ${MAYBE_COVERAGE_LIBRARIES}) -set(GUIDANCE_LIBRARIES - ${BOOST_BASE_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} - ${LUA_LIBRARIES} - ${TBB_LIBRARIES} - ${MAYBE_COVERAGE_LIBRARIES}) -set(PARTITIONER_LIBRARIES - ${BOOST_ENGINE_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} - ${TBB_LIBRARIES} - ${MAYBE_RT_LIBRARY} - ${MAYBE_COVERAGE_LIBRARIES} - ${ZLIB_LIBRARY}) -set(CUSTOMIZER_LIBRARIES - ${BOOST_ENGINE_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} - ${TBB_LIBRARIES} - ${MAYBE_RT_LIBRARY} - ${MAYBE_COVERAGE_LIBRARIES}) -set(UPDATER_LIBRARIES - ${BOOST_BASE_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} - ${TBB_LIBRARIES} - ${MAYBE_RT_LIBRARY} - ${MAYBE_COVERAGE_LIBRARIES} - ${ZLIB_LIBRARY}) -set(CONTRACTOR_LIBRARIES - ${BOOST_BASE_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} - ${LUA_LIBRARIES} - ${TBB_LIBRARIES} - ${MAYBE_RT_LIBRARY} - ${MAYBE_COVERAGE_LIBRARIES}) -set(ENGINE_LIBRARIES - ${BOOST_ENGINE_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} - ${TBB_LIBRARIES} - ${MAYBE_RT_LIBRARY} - ${MAYBE_COVERAGE_LIBRARIES} - ${ZLIB_LIBRARY}) -set(STORAGE_LIBRARIES - ${BOOST_BASE_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} - ${TBB_LIBRARIES} - ${MAYBE_RT_LIBRARY} - ${MAYBE_COVERAGE_LIBRARIES}) -set(UTIL_LIBRARIES - ${BOOST_BASE_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} - ${TBB_LIBRARIES} - ${MAYBE_COVERAGE_LIBRARIES} - ${ZLIB_LIBRARY}) - # Libraries -target_link_libraries(osrm ${ENGINE_LIBRARIES}) -target_link_libraries(osrm_update ${UPDATER_LIBRARIES}) -target_link_libraries(osrm_contract ${CONTRACTOR_LIBRARIES} osrm_update osrm_store) -target_link_libraries(osrm_extract osrm_guidance ${EXTRACTOR_LIBRARIES}) -target_link_libraries(osrm_partition ${PARTITIONER_LIBRARIES}) -target_link_libraries(osrm_customize ${CUSTOMIZER_LIBRARIES} osrm_update osrm_store) -target_link_libraries(osrm_store ${STORAGE_LIBRARIES}) +target_link_libraries(osrm + ${BZIP2_LIBRARIES} + ${Boost_REGEX_LIBRARY} + ${BOOST_BASE_LIBRARIES} + ${BOOST_ENGINE_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} + ${EXPAT_LIBRARIES} + ${LUA_LIBRARIES} + ${OSMIUM_LIBRARIES} + ${TBB_LIBRARIES} + ${MAYBE_RT_LIBRARY} + ${ZLIB_LIBRARY} + ${MAYBE_COVERAGE_LIBRARIES}) # BUILD_COMPONENTS add_executable(osrm-components src/tools/components.cpp $ $) @@ -634,13 +581,6 @@ if (BUILD_ROUTED) install(TARGETS osrm-routed DESTINATION bin) endif() install(TARGETS osrm DESTINATION lib) -install(TARGETS osrm_extract DESTINATION lib) -install(TARGETS osrm_partition DESTINATION lib) -install(TARGETS osrm_customize DESTINATION lib) -install(TARGETS osrm_update DESTINATION lib) -install(TARGETS osrm_contract DESTINATION lib) -install(TARGETS osrm_store DESTINATION lib) -install(TARGETS osrm_guidance DESTINATION lib) # Install profiles and support library to /usr/local/share/osrm/profiles by default