Skip to content

Commit

Permalink
luajit-cmake: Permit absence of git command
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 authored and edsiper committed Jul 5, 2024
1 parent a1c5d79 commit 7ee1b35
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions lib/luajit-cmake/LuaJIT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,28 @@ if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set(GIT_FORMAT %%ct)
endif()

add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/luajit_relver.txt
COMMAND git show -s --format=${GIT_FORMAT} > ${CMAKE_CURRENT_BINARY_DIR}/luajit_relver.txt
WORKING_DIRECTORY ${LUAJIT_DIR}
execute_process(
COMMAND git --version
RESULT_VARIABLE GIT_EXISTENCE
OUTPUT_VARIABLE GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)

if (GIT_EXISTENCE EQUAL 0)
message(STATUS "Using Git: ${GIT_VERSION}")
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/luajit_relver.txt
COMMAND git show -s --format=${GIT_FORMAT} > ${CMAKE_CURRENT_BINARY_DIR}/luajit_relver.txt
WORKING_DIRECTORY ${LUAJIT_DIR}
)
else()
string(TIMESTAMP current_epoch "%s")
message(STATUS "Using current epoch: ${current_epoch}")
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/luajit_relver.txt
COMMAND echo "${current_epoch}" > ${CMAKE_CURRENT_BINARY_DIR}/luajit_relver.txt
WORKING_DIRECTORY ${LUAJIT_DIR}
)
endif()

add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/luajit.h
COMMAND ${HOST_WINE} ${MINILUA_PATH} ${LUAJIT_DIR}/src/host/genversion.lua
ARGS ${LUAJIT_DIR}/src/luajit_rolling.h
Expand Down

0 comments on commit 7ee1b35

Please sign in to comment.