rpcsx/rx/CMakeLists.txt

54 lines
1.3 KiB
CMake
Raw Normal View History

project(rx)
2023-11-10 20:41:44 +00:00
find_package(Git)
add_library(${PROJECT_NAME} OBJECT
2024-09-03 07:10:27 +00:00
src/die.cpp
2024-09-01 15:04:55 +00:00
src/hexdump.cpp
src/mem.cpp
2023-11-10 20:41:44 +00:00
src/Version.cpp
)
target_include_directories(${PROJECT_NAME}
PUBLIC
include
PRIVATE
include/${PROJECT_NAME}
)
2023-11-10 20:41:44 +00:00
execute_process(COMMAND date +%+4Y%m%d OUTPUT_VARIABLE RAW_VERSION)
string(STRIP "${RAW_VERSION}" RAW_VERSION)
2023-11-12 11:07:46 +00:00
execute_process(COMMAND git log --date=format:%Y%m%d --pretty=format:'%cd' -n 1 WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" OUTPUT_VARIABLE GIT_DATE)
2023-11-10 20:41:44 +00:00
execute_process(COMMAND git log --pretty=format:'%h' -n 1
2023-11-12 11:07:46 +00:00
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
2023-11-10 20:41:44 +00:00
OUTPUT_VARIABLE GIT_REV)
execute_process(
2023-11-10 21:02:56 +00:00
COMMAND git diff --quiet --exit-code
2023-11-12 11:07:46 +00:00
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
2023-11-10 20:41:44 +00:00
RESULT_VARIABLE GIT_DIRTY ERROR_QUIET)
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
2023-11-12 11:07:46 +00:00
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
2023-11-10 20:41:44 +00:00
OUTPUT_VARIABLE GIT_BRANCH)
string(SUBSTRING ${GIT_DATE} 1 8 GIT_DATE)
string(STRIP "${GIT_REV}" GIT_REV)
string(SUBSTRING "${GIT_REV}" 1 7 GIT_REV)
string(STRIP "${GIT_DIRTY}" GIT_DIRTY)
string(STRIP "${GIT_BRANCH}" GIT_BRANCH)
target_compile_definitions(${PROJECT_NAME} PRIVATE
RX_RAW_VERSION=${GIT_DATE}
RX_GIT_REV=0x${GIT_REV}
RX_GIT_DIRTY=${GIT_DIRTY}
RX_GIT_BRANCH=${GIT_BRANCH}
)