diff --git a/3party/osrm/osrm-backend/CMakeLists.txt b/3party/osrm/osrm-backend/CMakeLists.txt index 17c815c897..3f6e602e59 100755 --- a/3party/osrm/osrm-backend/CMakeLists.txt +++ b/3party/osrm/osrm-backend/CMakeLists.txt @@ -12,9 +12,11 @@ include(CheckCXXCompilerFlag) include(FindPackageHandleStandardArgs) set(OMIM_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../.." CACHE PATH "Path to the root of omim repository") -set(OMIM_STORAGE_PATH "${OMIM_PATH}/storage/") -set(OMIM_DEBUG_PATH "${OMIM_PATH}/../omim-build-debug/out/debug" CACHE PATH "Path to the debug build of omim") -set(OMIM_RELEASE_PATH "${OMIM_PATH}/../omim-build-release/out/release" CACHE PATH "Path to the release build of omim") +if(CMAKE_BUILD_TYPE MATCHES Debug) + set(OMIM_BUILD_PATH "${OMIM_PATH}/../omim-build-debug/out/debug" CACHE PATH "Path to the debug build of omim") +else() + set(OMIM_BUILD_PATH "${OMIM_PATH}/../omim-build-release/out/release" CACHE PATH "Path to the release build of omim") +endif() set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) @@ -38,7 +40,7 @@ option(ENABLE_JSON_LOGGING "Adds additional JSON debug logging to the response" option(WITH_TOOLS "Build OSRM tools" OFF) option(BUILD_TOOLS "Build OSRM tools" OFF) -include_directories(${OMIM_STORAGE_PATH}/../) +include_directories(${OMIM_PATH}/) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third_party/) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/include/) @@ -88,7 +90,7 @@ file(GLOB AlgorithmTestsGlob unit_tests/algorithms/*.cpp) file(GLOB MapsMeSources mapsme/*.cpp) file(GLOB MapsMeHeaders mapsme/*.h) -file(GLOB MapsMeGenerator "${OMIM_STORAGE_PATH}/country.cpp" "${OMIM_STORAGE_PATH}/country_decl.cpp" "${OMIM_STORAGE_PATH}/country_info.cpp") +file(GLOB MapsMeGenerator "${OMIM_PATH}/storage/country.cpp" "${OMIM_PATH}/storage/country_decl.cpp" "${OMIM_PATH}/storage/country_info.cpp") set( OSRMSources @@ -224,42 +226,22 @@ if(NOT Boost_FOUND) endif() include_directories(${Boost_INCLUDE_DIRS}) +#Common libraries from omim +set(OMIM_LIBRARIES + "${OMIM_BUILD_PATH}/librouting.a" + "${OMIM_BUILD_PATH}/libindexer.a" + "${OMIM_BUILD_PATH}/libgeometry.a" + "${OMIM_BUILD_PATH}/libcoding.a" + "${OMIM_BUILD_PATH}/libbase.a" + "${OMIM_BUILD_PATH}/libjansson.a" +) + target_link_libraries(OSRM ${Boost_LIBRARIES}) target_link_libraries(osrm-extract ${Boost_LIBRARIES}) target_link_libraries(osrm-prepare ${Boost_LIBRARIES}) target_link_libraries(osrm-datastore ${Boost_LIBRARIES}) - -if(CMAKE_BUILD_TYPE MATCHES Debug) - target_link_libraries(osrm-routed ${Boost_LIBRARIES} ${OPTIONAL_SOCKET_LIBS} OSRM - "${OMIM_DEBUG_PATH}/libcoding.a" - "${OMIM_DEBUG_PATH}/libbase.a" - "${OMIM_DEBUG_PATH}/libgeometry.a" - "${OMIM_DEBUG_PATH}/libindexer.a" - "${OMIM_DEBUG_PATH}/libjansson.a" - ) - target_link_libraries(osrm-mapsme ${Boost_LIBRARIES} OSRM - "${OMIM_DEBUG_PATH}/libcoding.a" - "${OMIM_DEBUG_PATH}/libbase.a" - "${OMIM_DEBUG_PATH}/librouting.a" - "${OMIM_DEBUG_PATH}/libgeometry.a" - "${OMIM_DEBUG_PATH}/libindexer.a" - ) -else() - target_link_libraries(osrm-routed ${Boost_LIBRARIES} ${OPTIONAL_SOCKET_LIBS} OSRM - "${OMIM_RELEASE_PATH}/libcoding.a" - "${OMIM_RELEASE_PATH}/libgeometry.a" - "${OMIM_RELEASE_PATH}/libindexer.a" - "${OMIM_RELEASE_PATH}/libjansson.a" - "${OMIM_RELEASE_PATH}/libbase.a" - ) - target_link_libraries(osrm-mapsme ${Boost_LIBRARIES} OSRM - "${OMIM_RELEASE_PATH}/libcoding.a" - "${OMIM_RELEASE_PATH}/libbase.a" - "${OMIM_RELEASE_PATH}/librouting.a" - "${OMIM_RELEASE_PATH}/libgeometry.a" - "${OMIM_RELEASE_PATH}/libindexer.a" - ) -endif() +target_link_libraries(osrm-routed ${Boost_LIBRARIES} ${OPTIONAL_SOCKET_LIBS} OSRM ${OMIM_LIBRARIES}) +target_link_libraries(osrm-mapsme ${Boost_LIBRARIES} OSRM ${OMIM_LIBRARIES}) find_package(Threads REQUIRED) target_link_libraries(osrm-extract ${CMAKE_THREAD_LIBS_INIT} ${OPTIONAL_OMP_LIB}) diff --git a/tools/unix/build_omim.sh b/tools/unix/build_omim.sh index 7fa9b4dfd7..5d225b4ac5 100755 --- a/tools/unix/build_omim.sh +++ b/tools/unix/build_omim.sh @@ -66,10 +66,10 @@ fi # OS-specific parameters if [ "$(uname -s)" == "Darwin" ]; then - SPEC=macx-clang + SPEC=${SPEC:-macx-clang} PROCESSES=$(sysctl -n hw.ncpu) else - SPEC=linux-clang-libc++ + SPEC=${SPEC:-linux-clang-libc++} PROCESSES=$(nproc) fi @@ -137,7 +137,7 @@ build_osrm() OSRM_OMIM_LIBS="omim-build/out/$OSRM_OMIM_CONF" ( cd "$OSRM_TARGET" - "$CMAKE" "-DBOOST_ROOT=$BOOST_PATH" -DCMAKE_BUILD_TYPE=$OSRM_CONF "-DOMIM_DEBUG_PATH=$OSRM_OMIM_LIBS" "-DOMIM_RELEASE_PATH=$OSRM_OMIM_LIBS" "$BACKEND" + "$CMAKE" "-DBOOST_ROOT=$BOOST_PATH" -DCMAKE_BUILD_TYPE=$OSRM_CONF "-DOMIM_BUILD_PATH=$OSRM_OMIM_LIBS" "$BACKEND" make clean make )