1 #ifndef SOURCE_MACROS_HPP
2 #define SOURCE_MACROS_HPP
3 #include <cstring>
4 
5 // Helper macros, don't use these ones
6 // STRIP the OSRM_PROJECT_DIR from the front of a filename.  Expected to come
7 // from CMake's CURRENT_SOURCE_DIR, which doesn't have a trailing /, hence the +1
8 #define PROJECT_RELATIVE_PATH_(x) std::string(x).substr(strlen(OSRM_PROJECT_DIR) + 1)
9 // Return the path of a file, relative to the OSRM_PROJECT_DIR
10 #define OSRM_SOURCE_FILE_ PROJECT_RELATIVE_PATH_(__FILE__)
11 
12 // This is the macro to use
13 #define SOURCE_REF OSRM_SOURCE_FILE_ + ":" + std::to_string(__LINE__)
14 
15 #endif // SOURCE_MACROS_HPP
16