Skip to content

Commit

Permalink
Merge pull request #151 from fixstars/feature/emit-ion-kit-version
Browse files Browse the repository at this point in the history
Emit version
  • Loading branch information
iitaku authored Nov 7, 2023
2 parents 066325c + c8dc630 commit e0d7c4f
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 e0d7c4f

Please sign in to comment.