Skip to content

Commit

Permalink
Emit version
Browse files Browse the repository at this point in the history
  • Loading branch information
Fixstars-iizuka committed Nov 7, 2023
1 parent 066325c commit c8dc630
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 9 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,14 @@ endif()
#
# Version
#
execute_process(COMMAND git rev-parse --short HEAD OUTPUT_VARIABLE GIT_REV ERROR_QUIET)
file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/VERSION CONTENT "${GIT_REV}")
execute_process(COMMAND git describe --tags
OUTPUT_VARIABLE GIT_DESCRIBE_RESULT
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
message(STATUS "Version: ${GIT_DESCRIBE_RESULT}")
string(STRIP "${GIT_DESCRIBE_RESULT}" ION_KIT_VERSION_S)
add_definitions("-DION_KIT_VERSION=\"${ION_KIT_VERSION_S}\"")
string(REPLACE "v" "" ION_KIT_VERSION ${ION_KIT_VERSION_S})
file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/VERSION CONTENT "${ION_KIT_VERSION_S}")

#
# ion utilities
Expand Down Expand Up @@ -185,11 +191,5 @@ if (UNIX)
else ()
set(CPACK_GENERATOR "ZIP")
endif ()
execute_process(COMMAND git describe --tags
OUTPUT_VARIABLE GIT_DESCRIBE_RESULT
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
message(STATUS "Version: ${GIT_DESCRIBE_RESULT}")
string(STRIP "${GIT_DESCRIBE_RESULT}" ION_KIT_VERSION_S)
string(REPLACE "v" "" ION_KIT_VERSION ${ION_KIT_VERSION_S})
set(CPACK_PACKAGE_VERSION ${ION_KIT_VERSION})
include(CPack)
include(CPack)
2 changes: 2 additions & 0 deletions src/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ struct Logger {
auto logger = std::make_shared<spdlog::logger>("ion", spdlog::sinks_init_list{console_sink, file_sink});
logger->set_level(spdlog::level::trace);

logger->debug("ion-kit version is {}", ION_KIT_VERSION);

spdlog::register_logger(logger);
}
} logger;
Expand Down

0 comments on commit c8dc630

Please sign in to comment.