Skip to content

Commit 0632553

Browse files
authored
Merge pull request #741 from Devsh-Graphics-Programming/tad_add_git_commit_hash
add git info to nabla
2 parents 41ca055 + 803379d commit 0632553

File tree

7 files changed

+33
-1
lines changed

7 files changed

+33
-1
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,6 @@
102102
[submodule "3rdparty/imguizmo"]
103103
path = 3rdparty/imguizmo
104104
url = git@github.com:Devsh-Graphics-Programming/ImGuizmo.git
105+
[submodule "3rdparty/git-version-tracking"]
106+
path = 3rdparty/git-version-tracking
107+
url = git@github.com:Devsh-Graphics-Programming/cmake-git-version-tracking.git

3rdparty/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,12 @@ add_library(spirv_cross OBJECT
275275
)
276276
target_compile_definitions(spirv_cross PUBLIC SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS)
277277

278+
# cmake-git-version-tracking
279+
add_subdirectory(git-version-tracking EXCLUDE_FROM_ALL)
280+
NBL_ADD_GIT_TRACKING_META_LIBRARY(nabla "${NBL_ROOT_PATH}")
281+
NBL_ADD_GIT_TRACKING_META_LIBRARY(dxc "${CMAKE_CURRENT_SOURCE_DIR}/dxc/dxc")
282+
NBL_GENERATE_GIT_TRACKING_META()
283+
278284
if(NBL_BUILD_IMGUI)
279285
add_library(imgui STATIC
280286
"imgui/imconfig.h"

3rdparty/git-version-tracking

Submodule git-version-tracking added at 6980df4

include/nabla.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717
#ifndef __NABLA_H_INCLUDED__
1818
#define __NABLA_H_INCLUDED__
1919

20+
// meta info
21+
#include "git_info.h"
22+
23+
namespace nbl {
24+
NBL_API2 const gtml::GitInfo& getGitInfo(gtml::E_GIT_REPO_META repo);
25+
}
26+
2027
// core lib
2128
#include "nbl/core/declarations.h"
2229

include/nbl/config/BuildConfigOptions.h.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
#define BOOST_BUILTIN_RESOURCES_DIRECTORY_PATH "@BOOST_BUILTIN_RESOURCES_DIRECTORY_PATH@"
8888
#define DEVICEGEN_BUILTIN_RESOURCES_DIRECTORY_PATH "@DEVICEGEN_BUILTIN_RESOURCES_DIRECTORY_PATH@"
8989

90-
// DDL exports
90+
// DLL exports
9191
#cmakedefine _NBL_SHARED_BUILD_
9292
#ifdef _NBL_SHARED_BUILD_
9393
#if defined(__NBL_BUILDING_NABLA__) // currently compiling nabla, this define is passed through the commandline

src/nbl/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,18 @@ set(NBL_SCENE_SOURCES
284284
${NBL_ROOT_PATH}/src/nbl/scene/ITransformTree.cpp
285285
)
286286

287+
set(NBL_META_SOURCES
288+
${NBL_ROOT_PATH}/src/nbl/gtml.cpp
289+
)
290+
287291
set(NABLA_SRCS_COMMON
288292
${NBL_CORE_SOURCES}
289293
${NBL_SYSTEM_SOURCES}
290294
${NBL_UI_SOURCES}
291295
${NBL_ASSET_SOURCES}
292296
${NBL_VIDEO_SOURCES}
293297
${NBL_SCENE_SOURCES}
298+
${NBL_META_SOURCES}
294299
)
295300

296301
if(MSVC)
@@ -653,6 +658,9 @@ glue_source_definitions(Nabla _NBL_SOURCE_DEFINITIONS_)
653658
set(_NBL_DEFINE_FILE_WRAPPER_ ${CMAKE_CURRENT_BINARY_DIR}/include/define.h)
654659
write_source_definitions("${_NBL_DEFINE_FILE_WRAPPER_}" "${_NBL_SOURCE_DEFINITIONS_}")
655660

661+
# git version tracking
662+
target_link_libraries(Nabla PUBLIC gtml)
663+
656664
#on MSVC it won't compile without this option!
657665
if (MSVC)
658666
target_compile_options(Nabla PUBLIC /bigobj)

src/nbl/gtml.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include "git_info.h"
2+
3+
namespace nbl {
4+
const gtml::GitInfo& getGitInfo(gtml::E_GIT_REPO_META repo) {
5+
return gtml::gitMeta[repo];
6+
}
7+
}

0 commit comments

Comments
 (0)