diff --git a/CMakeLists.txt b/CMakeLists.txt index dd6fb7d86..7090ff2ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,13 +7,15 @@ This process created the file `CMakeCache.txt' and the directory `CMakeFiles'. P endif() project(OSRM C CXX) +set(OSRM_VERSION_MAJOR 4) +set(OSRM_VERSION_MINOR 8) +set(OSRM_VERSION_PATCH 0) + set(CMAKE_EXPORT_COMPILE_COMMANDS ON) include(CheckCXXCompilerFlag) include(FindPackageHandleStandardArgs) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -include(GetGitRevisionDescription) -git_describe(GIT_DESCRIPTION) set(bitness 32) if(CMAKE_SIZEOF_VOID_P EQUAL 8) @@ -46,8 +48,8 @@ add_custom_target(benchmarks DEPENDS rtree-bench) set(BOOST_COMPONENTS date_time filesystem iostreams program_options regex system thread unit_test_framework) configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/util/git_sha.cpp.in - ${CMAKE_CURRENT_SOURCE_DIR}/util/git_sha.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/util/version.hpp.in + ${CMAKE_CURRENT_SOURCE_DIR}/util/version.hpp ) file(GLOB ExtractorGlob extractor/*.cpp) file(GLOB ImporterGlob data_structures/import_edge.cpp data_structures/external_memory_node.cpp data_structures/raster_source.cpp) @@ -60,7 +62,7 @@ add_library(MERCATOR OBJECT util/mercator.cpp) add_library(ANGLE OBJECT util/compute_angle.cpp) set(ExtractorSources extract.cpp ${ExtractorGlob}) -add_executable(osrm-extract ${ExtractorSources} $ $ $ $ $ $ $) +add_executable(osrm-extract ${ExtractorSources} $ $ $ $ $ $) add_library(RESTRICTION OBJECT data_structures/restriction_map.cpp) add_library(COMPRESSEDEDGE OBJECT data_structures/compressed_edge_container.cpp) @@ -68,7 +70,7 @@ add_library(GRAPHCOMPRESSOR OBJECT algorithms/graph_compressor.cpp) file(GLOB PrepareGlob contractor/*.cpp data_structures/hilbert_value.cpp {RestrictionMapGlob}) set(PrepareSources prepare.cpp ${PrepareGlob}) -add_executable(osrm-prepare ${PrepareSources} $ $ $ $ $ $ $ $ $ $ $) +add_executable(osrm-prepare ${PrepareSources} $ $ $ $ $ $ $ $ $ $) file(GLOB ServerGlob server/*.cpp) file(GLOB DescriptorGlob descriptors/*.cpp) @@ -90,8 +92,7 @@ set( ) add_library(COORDINATE OBJECT ${CoordinateGlob}) -add_library(GITDESCRIPTION OBJECT util/git_sha.cpp) -add_library(OSRM ${OSRMSources} $ $ $ $ $ $ $ $ $ $ $) +add_library(OSRM ${OSRMSources} $ $ $ $ $ $ $ $ $ $) add_library(FINGERPRINT OBJECT util/fingerprint.cpp) add_dependencies(FINGERPRINT FingerPrintConfigure) @@ -99,7 +100,7 @@ add_dependencies(OSRM FingerPrintConfigure) set_target_properties(FINGERPRINT PROPERTIES LINKER_LANGUAGE CXX) add_executable(osrm-routed routed.cpp ${ServerGlob} $) -add_executable(osrm-datastore datastore.cpp $ $ $ $ $ $) +add_executable(osrm-datastore datastore.cpp $ $ $ $ $) # Unit tests add_executable(datastructure-tests EXCLUDE_FROM_ALL unit_tests/datastructure_tests.cpp ${DataStructureTestsGlob} $ $ $ $ $ $ $ $ $) @@ -339,16 +340,16 @@ if(BUILD_TOOLS) add_executable(osrm-cli tools/simpleclient.cpp $ $ $) target_link_libraries(osrm-cli ${Boost_LIBRARIES} ${OPTIONAL_SOCKET_LIBS} OSRM) target_link_libraries(osrm-cli ${TBB_LIBRARIES}) - add_executable(osrm-io-benchmark tools/io-benchmark.cpp $ $ $) + add_executable(osrm-io-benchmark tools/io-benchmark.cpp $ $) target_link_libraries(osrm-io-benchmark ${Boost_LIBRARIES}) - add_executable(osrm-unlock-all tools/unlock_all_mutexes.cpp $ $ $) + add_executable(osrm-unlock-all tools/unlock_all_mutexes.cpp $ $) target_link_libraries(osrm-unlock-all ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) if(UNIX AND NOT APPLE) target_link_libraries(osrm-unlock-all rt) endif() add_executable(osrm-check-hsgr tools/check-hsgr.cpp $ $ $ $) target_link_libraries(osrm-check-hsgr ${Boost_LIBRARIES} ${TBB_LIBRARIES}) - add_executable(osrm-springclean tools/springclean.cpp $ $ $ $) + add_executable(osrm-springclean tools/springclean.cpp $ $ $) target_link_libraries(osrm-springclean ${Boost_LIBRARIES}) install(TARGETS osrm-cli DESTINATION bin) diff --git a/cmake/GetGitRevisionDescription.cmake b/cmake/GetGitRevisionDescription.cmake deleted file mode 100644 index 1bf023008..000000000 --- a/cmake/GetGitRevisionDescription.cmake +++ /dev/null @@ -1,123 +0,0 @@ -# - Returns a version string from Git -# -# These functions force a re-configure on each git commit so that you can -# trust the values of the variables in your build system. -# -# get_git_head_revision( [ ...]) -# -# Returns the refspec and sha hash of the current head revision -# -# git_describe( [ ...]) -# -# Returns the results of git describe on the source tree, and adjusting -# the output so that it tests false if an error occurs. -# -# git_get_exact_tag( [ ...]) -# -# Returns the results of git describe --exact-match on the source tree, -# and adjusting the output so that it tests false if there was no exact -# matching tag. -# -# Requires CMake 2.6 or newer (uses the 'function' command) -# -# Original Author: -# 2009-2010 Ryan Pavlik -# http://academic.cleardefinition.com -# Iowa State University HCI Graduate Program/VRAC -# -# Copyright Iowa State University 2009-2010. -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -if(__get_git_revision_description) - return() -endif() -set(__get_git_revision_description YES) - -# We must run the following at "include" time, not at function call time, -# to find the path to this module rather than the path to a calling list file -get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) - -function(get_git_head_revision _refspecvar _hashvar) - set(GIT_PARENT_DIR "${CMAKE_SOURCE_DIR}") - set(GIT_DIR "${GIT_PARENT_DIR}/.git") - while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories - set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}") - get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH) - if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT) - # We have reached the root directory, we are not in git - set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE) - set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE) - return() - endif() - set(GIT_DIR "${GIT_PARENT_DIR}/.git") - endwhile() - set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data") - if(NOT EXISTS "${GIT_DATA}") - file(MAKE_DIRECTORY "${GIT_DATA}") - endif() - - if(NOT EXISTS "${GIT_DIR}/HEAD") - return() - endif() - set(HEAD_FILE "${GIT_DATA}/HEAD") - configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY) - - configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in" - "${GIT_DATA}/grabRef.cmake" - @ONLY) - include("${GIT_DATA}/grabRef.cmake") - - set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE) - set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE) -endfunction() - -function(git_describe _var) - if(NOT GIT_FOUND) - find_package(Git QUIET) - endif() - get_git_head_revision(refspec hash) - if(NOT GIT_FOUND) - set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) - return() - endif() - if(NOT hash) - set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) - return() - endif() - - # TODO sanitize - #if((${ARGN}" MATCHES "&&") OR - # (ARGN MATCHES "||") OR - # (ARGN MATCHES "\\;")) - # message("Please report the following error to the project!") - # message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}") - #endif() - - #message(STATUS "Arguments to execute_process: ${ARGN}") - - execute_process(COMMAND - "${GIT_EXECUTABLE}" - describe - ${hash} - ${ARGN} - WORKING_DIRECTORY - "${CMAKE_SOURCE_DIR}" - RESULT_VARIABLE - res - OUTPUT_VARIABLE - out - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - if(NOT res EQUAL 0) - set(out "${out}-${res}-NOTFOUND") - endif() - - set(${_var} "${out}" PARENT_SCOPE) -endfunction() - -function(git_get_exact_tag _var) - git_describe(out --exact-match ${ARGN}) - set(${_var} "${out}" PARENT_SCOPE) -endfunction() diff --git a/cmake/GetGitRevisionDescription.cmake.in b/cmake/GetGitRevisionDescription.cmake.in deleted file mode 100644 index 888ce13aa..000000000 --- a/cmake/GetGitRevisionDescription.cmake.in +++ /dev/null @@ -1,38 +0,0 @@ -# -# Internal file for GetGitRevisionDescription.cmake -# -# Requires CMake 2.6 or newer (uses the 'function' command) -# -# Original Author: -# 2009-2010 Ryan Pavlik -# http://academic.cleardefinition.com -# Iowa State University HCI Graduate Program/VRAC -# -# Copyright Iowa State University 2009-2010. -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -set(HEAD_HASH) - -file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) - -string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) -if(HEAD_CONTENTS MATCHES "ref") - # named branch - string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") - if(EXISTS "@GIT_DIR@/${HEAD_REF}") - configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) - elseif(EXISTS "@GIT_DIR@/logs/${HEAD_REF}") - configure_file("@GIT_DIR@/logs/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) - set(HEAD_HASH "${HEAD_REF}") - endif() -else() - # detached HEAD - configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) -endif() - -if(NOT HEAD_HASH) - file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) - string(STRIP "${HEAD_HASH}" HEAD_HASH) -endif() diff --git a/cmake/pkgconfig.in b/cmake/pkgconfig.in index e81febad8..eec21d81d 100644 --- a/cmake/pkgconfig.in +++ b/cmake/pkgconfig.in @@ -4,7 +4,7 @@ libdir=${prefix}/lib Name: libOSRM Description: Project OSRM library -Version: @GIT_DESCRIPTION@ +Version: v@OSRM_VERSION_MAJOR@.@OSRM_VERSION_MINOR@.@OSRM_VERSION_PATCH@ Requires: Libs: -L${libdir} -lOSRM Libs.private: @BOOST_LIBRARY_LISTING@ diff --git a/contractor/contractor_options.cpp b/contractor/contractor_options.cpp index f0d434a91..f2aeb0b3e 100644 --- a/contractor/contractor_options.cpp +++ b/contractor/contractor_options.cpp @@ -27,7 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "contractor_options.hpp" -#include "../util/git_sha.hpp" +#include "../util/version.hpp" #include "../util/simple_logger.hpp" #include @@ -102,7 +102,7 @@ ContractorOptions::ParseArguments(int argc, char *argv[], ContractorConfig &cont if (option_variables.count("version")) { - SimpleLogger().Write() << g_GIT_DESCRIPTION; + SimpleLogger().Write() << OSRM_VERSION; return return_code::exit; } diff --git a/contractor/processing_chain.cpp b/contractor/processing_chain.cpp index 574aea733..bc9695b51 100644 --- a/contractor/processing_chain.cpp +++ b/contractor/processing_chain.cpp @@ -36,7 +36,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../data_structures/static_rtree.hpp" #include "../data_structures/restriction_map.hpp" -#include "../util/git_sha.hpp" #include "../util/graph_loader.hpp" #include "../util/integer_range.hpp" #include "../util/lua_util.hpp" diff --git a/extractor/extractor.cpp b/extractor/extractor.cpp index cc920bab4..6355bde0a 100644 --- a/extractor/extractor.cpp +++ b/extractor/extractor.cpp @@ -35,7 +35,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "scripting_environment.hpp" #include "../data_structures/raster_source.hpp" -#include "../util/git_sha.hpp" #include "../util/make_unique.hpp" #include "../util/simple_logger.hpp" #include "../util/timing_util.hpp" diff --git a/extractor/extractor_options.cpp b/extractor/extractor_options.cpp index 23cbacc74..b0c5c9eff 100644 --- a/extractor/extractor_options.cpp +++ b/extractor/extractor_options.cpp @@ -27,7 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "extractor_options.hpp" -#include "../util/git_sha.hpp" +#include "../util/version.hpp" #include "../util/ini_file.hpp" #include "../util/simple_logger.hpp" @@ -90,7 +90,7 @@ ExtractorOptions::ParseArguments(int argc, char *argv[], ExtractorConfig &extrac option_variables); if (option_variables.count("version")) { - SimpleLogger().Write() << g_GIT_DESCRIPTION; + SimpleLogger().Write() << OSRM_VERSION; return return_code::exit; } diff --git a/routed.cpp b/routed.cpp index c8186f7c9..89a9b3a18 100644 --- a/routed.cpp +++ b/routed.cpp @@ -27,7 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "library/osrm.hpp" #include "server/server.hpp" -#include "util/git_sha.hpp" +#include "util/version.hpp" #include "util/routed_options.hpp" #include "util/simple_logger.hpp" @@ -97,7 +97,7 @@ int main(int argc, const char *argv[]) SimpleLogger().Write(logWARNING) << argv[0] << " could not be locked to RAM"; } #endif - SimpleLogger().Write() << "starting up engines, " << g_GIT_DESCRIPTION; + SimpleLogger().Write() << "starting up engines, " << OSRM_VERSION; if (lib_config.use_shared_memory) { diff --git a/tools/io-benchmark.cpp b/tools/io-benchmark.cpp index ae76327e2..a4d85ee32 100644 --- a/tools/io-benchmark.cpp +++ b/tools/io-benchmark.cpp @@ -25,7 +25,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "../util/git_sha.hpp" +#include "../util/version.hpp" #include "../util/osrm_exception.hpp" #include "../util/simple_logger.hpp" #include "../util/timing_util.hpp" @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) boost::filesystem::path test_path; try { - SimpleLogger().Write() << "starting up engines, " << g_GIT_DESCRIPTION; + SimpleLogger().Write() << "starting up engines, " << OSRM_VERSION; if (1 == argc) { diff --git a/tools/simpleclient.cpp b/tools/simpleclient.cpp index ce590ccd8..3fe8d0c8a 100644 --- a/tools/simpleclient.cpp +++ b/tools/simpleclient.cpp @@ -26,7 +26,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "../library/osrm.hpp" -#include "../util/git_sha.hpp" +#include "../util/version.hpp" #include "../util/json_renderer.hpp" #include "../util/routed_options.hpp" #include "../util/simple_logger.hpp" @@ -59,7 +59,7 @@ int main(int argc, const char *argv[]) { return 1; } - SimpleLogger().Write() << "starting up engines, " << g_GIT_DESCRIPTION; + SimpleLogger().Write() << "starting up engines, " << OSRM_VERSION; OSRM routing_machine(lib_config); diff --git a/tools/springclean.cpp b/tools/springclean.cpp index 2d8910621..91657d335 100644 --- a/tools/springclean.cpp +++ b/tools/springclean.cpp @@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../data_structures/shared_memory_factory.hpp" #include "../server/data_structures/shared_datatype.hpp" -#include "../util/git_sha.hpp" +#include "../util/version.hpp" #include "../util/simple_logger.hpp" void delete_region(const SharedDataType region) @@ -77,7 +77,7 @@ int main() LogPolicy::GetInstance().Unmute(); try { - SimpleLogger().Write() << "starting up engines, " << g_GIT_DESCRIPTION << "\n\n"; + SimpleLogger().Write() << "starting up engines, " << OSRM_VERSION << "\n\n"; SimpleLogger().Write() << "Releasing all locks"; SimpleLogger().Write() << "ATTENTION! BE CAREFUL!"; SimpleLogger().Write() << "----------------------"; diff --git a/tools/unlock_all_mutexes.cpp b/tools/unlock_all_mutexes.cpp index 299aa61f5..f6a660cd9 100644 --- a/tools/unlock_all_mutexes.cpp +++ b/tools/unlock_all_mutexes.cpp @@ -25,7 +25,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "../util/git_sha.hpp" +#include "../util/version.hpp" #include "../util/simple_logger.hpp" #include "../server/data_structures/shared_barriers.hpp" @@ -36,7 +36,7 @@ int main() LogPolicy::GetInstance().Unmute(); try { - SimpleLogger().Write() << "starting up engines, " << g_GIT_DESCRIPTION; + SimpleLogger().Write() << "starting up engines, " << OSRM_VERSION; SimpleLogger().Write() << "Releasing all locks"; SharedBarriers barrier; barrier.pending_update_mutex.unlock(); diff --git a/util/datastore_options.hpp b/util/datastore_options.hpp index 2bb127d1e..ff6c9cb67 100644 --- a/util/datastore_options.hpp +++ b/util/datastore_options.hpp @@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef DATASTORE_OPTIONS_HPP #define DATASTORE_OPTIONS_HPP -#include "git_sha.hpp" +#include "version.hpp" #include "ini_file.hpp" #include "osrm_exception.hpp" #include "simple_logger.hpp" @@ -107,7 +107,7 @@ bool GenerateDataStoreOptions(const int argc, const char *argv[], ServerPaths &p if (option_variables.count("version")) { - SimpleLogger().Write() << g_GIT_DESCRIPTION; + SimpleLogger().Write() << OSRM_VERSION; return false; } diff --git a/util/routed_options.hpp b/util/routed_options.hpp index 5701514af..0edb7fe6c 100644 --- a/util/routed_options.hpp +++ b/util/routed_options.hpp @@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef ROUTED_OPTIONS_HPP #define ROUTED_OPTIONS_HPP -#include "git_sha.hpp" +#include "version.hpp" #include "ini_file.hpp" #include "osrm_exception.hpp" #include "simple_logger.hpp" @@ -232,7 +232,7 @@ inline unsigned GenerateServerProgramOptions(const int argc, if (option_variables.count("version")) { - SimpleLogger().Write() << g_GIT_DESCRIPTION; + SimpleLogger().Write() << OSRM_VERSION; return INIT_OK_DO_NOT_START_ENGINE; } diff --git a/util/git_sha.hpp b/util/version.hpp similarity index 84% rename from util/git_sha.hpp rename to util/version.hpp index b0a9a7ca3..ae4677a00 100644 --- a/util/git_sha.hpp +++ b/util/version.hpp @@ -25,9 +25,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef GIT_SHA_HPP -#define GIT_SHA_HPP +#ifndef VERSION_HPP +#define VERSION_HPP -extern char g_GIT_DESCRIPTION[]; +#define OSRM_VERSION_MAJOR "4" +#define OSRM_VERSION_MINOR "8" +#define OSRM_VERSION_PATCH "0" -#endif // GIT_SHA_HPP +#define OSRM_VERSION "v" OSRM_VERSION_MAJOR "." OSRM_VERSION_MINOR "." OSRM_VERSION_PATCH + +#endif // VERSION_HPP diff --git a/util/git_sha.cpp.in b/util/version.hpp.in similarity index 81% rename from util/git_sha.cpp.in rename to util/version.hpp.in index e3686da19..2eafd48a5 100644 --- a/util/git_sha.cpp.in +++ b/util/version.hpp.in @@ -25,7 +25,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "git_sha.hpp" +#ifndef VERSION_HPP +#define VERSION_HPP -#define GIT_DESCRIPTION "${GIT_DESCRIPTION}" -char g_GIT_DESCRIPTION[] = GIT_DESCRIPTION; +#define OSRM_VERSION_MAJOR "@OSRM_VERSION_MAJOR@" +#define OSRM_VERSION_MINOR "@OSRM_VERSION_MINOR@" +#define OSRM_VERSION_PATCH "@OSRM_VERSION_PATCH@" + +#define OSRM_VERSION "v" OSRM_VERSION_MAJOR "." OSRM_VERSION_MINOR "." OSRM_VERSION_PATCH + +#endif // VERSION_HPP