mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 06:32:09 +00:00
Pass branch and sha to compiler
This commit is contained in:
@@ -781,6 +781,34 @@ INSTALL(TARGETS IfcGeomServer
|
|||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
find_package (Git)
|
||||||
|
if (GIT_FOUND)
|
||||||
|
message("git found: ${GIT_EXECUTABLE} with version ${GIT_VERSION_STRING}")
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${GIT_EXECUTABLE} show -s --pretty=%D HEAD
|
||||||
|
OUTPUT_VARIABLE git_branches
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
string(REPLACE ", " ";" git_branch_list "${git_branches}")
|
||||||
|
string(REPLACE " -> " ";" git_branch_list "${git_branch_list}")
|
||||||
|
foreach(git_branch_candidate IN ITEMS ${git_branch_list})
|
||||||
|
if (NOT git_branch_candidate MATCHES "/")
|
||||||
|
if (NOT git_branch_candidate MATCHES "^HEAD$")
|
||||||
|
set(git_branch ${git_branch_candidate})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
|
||||||
|
OUTPUT_VARIABLE git_sha
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
message(STATUS "IfcOpenShell branch ${git_branch}")
|
||||||
|
message(STATUS "IfcOpenShell commit ${git_sha}")
|
||||||
|
add_definitions(-DIFCOPENSHELL_BRANCH=${git_branch})
|
||||||
|
add_definitions(-DIFCOPENSHELL_COMMIT=${git_sha})
|
||||||
|
endif()
|
||||||
|
|
||||||
# Documentation
|
# Documentation
|
||||||
IF(BUILD_DOCUMENTATION)
|
IF(BUILD_DOCUMENTATION)
|
||||||
set(CMAKE_MODULE_PATH "../docs/cmake")
|
set(CMAKE_MODULE_PATH "../docs/cmake")
|
||||||
|
|||||||
@@ -27,7 +27,13 @@
|
|||||||
#ifndef IFCPARSE_H
|
#ifndef IFCPARSE_H
|
||||||
#define IFCPARSE_H
|
#define IFCPARSE_H
|
||||||
|
|
||||||
#define IFCOPENSHELL_VERSION "0.6.0b0"
|
#include "../ifcparse/macros.h"
|
||||||
|
|
||||||
|
#if defined(IFCOPENSHELL_BRANCH) && defined(IFCOPENSHELL_COMMIT)
|
||||||
|
#define IFCOPENSHELL_VERSION STRINGIFY(IFCOPENSHELL_BRANCH) "-" STRINGIFY(IFCOPENSHELL_COMMIT)
|
||||||
|
#else
|
||||||
|
#define IFCOPENSHELL_VERSION "0.7.0"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|||||||
Reference in New Issue
Block a user