Skip to content

Commit 4004cc4

Browse files
committed
simplify to config-time only
1 parent a630d5e commit 4004cc4

File tree

2 files changed

+11
-30
lines changed

2 files changed

+11
-30
lines changed

cmake/scripts/nbl/gitInfo.cmake

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/nbl/CMakeLists.txt

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -658,19 +658,18 @@ glue_source_definitions(Nabla _NBL_SOURCE_DEFINITIONS_)
658658
set(_NBL_DEFINE_FILE_WRAPPER_ ${CMAKE_CURRENT_BINARY_DIR}/include/define.h)
659659
write_source_definitions("${_NBL_DEFINE_FILE_WRAPPER_}" "${_NBL_SOURCE_DEFINITIONS_}")
660660

661-
add_custom_target(CheckGit COMMAND ${CMAKE_COMMAND}
662-
-DWORKING_DIRECTORY:PATH=${NBL_ROOT_PATH}
663-
-DGIT_EXECUTABLE:PATH=${GIT_EXECUTABLE}
664-
-DINPUT_FILE:PATH="${NBL_ROOT_PATH}/src/nbl/git_info.cpp.in"
665-
-DOUTPUT_FILE:PATH="${CMAKE_CURRENT_BINARY_DIR}/src/nbl/git_info.cpp"
666-
-P ${NBL_ROOT_PATH}/cmake/scripts/nbl/gitInfo.cmake
667-
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/src/nbl/git_info.cpp
661+
# generate git info
662+
execute_process( COMMAND ${GIT_EXECUTABLE} log -1 --format=%H
663+
WORKING_DIRECTORY ${NBL_ROOT_PATH}
664+
OUTPUT_VARIABLE NBL_GIT_COMMIT_HASH
665+
OUTPUT_STRIP_TRAILING_WHITESPACE
668666
)
669-
670-
set(INPUT_FILE "${NBL_ROOT_PATH}/src/nbl/git_info.cpp.in")
671-
set(OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/src/nbl/git_info.cpp")
672-
set(WORKING_DIRECTORY ${NBL_ROOT_PATH})
673-
include("${NBL_ROOT_PATH}/cmake/scripts/nbl/gitInfo.cmake")
667+
execute_process( COMMAND ${GIT_EXECUTABLE} log -1 --format=%h
668+
WORKING_DIRECTORY ${NBL_ROOT_PATH}
669+
OUTPUT_VARIABLE NBL_GIT_COMMIT_SHORT_HASH
670+
OUTPUT_STRIP_TRAILING_WHITESPACE
671+
)
672+
configure_file("${NBL_ROOT_PATH}/src/nbl/git_info.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/src/nbl/git_info.cpp")
674673

675674
#on MSVC it won't compile without this option!
676675
if (MSVC)

0 commit comments

Comments
 (0)