cmake: add SDL_REVISION option
This is useful if one has vendored SDL git and want to avoid rebuilding SDL on every git commit.main
parent
0500fca00c
commit
b221b59995
|
@ -2796,19 +2796,22 @@ foreach(_hdr IN LISTS SDL3_INCLUDE_FILES)
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set(SDL_REVISION_SUFFIX "" CACHE STRING "Suffix for the SDL revision")
|
set(SDL_REVISION "" CACHE STRING "Custom SDL revision (overrides SDL_REVISION_SUFFIX)")
|
||||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION.txt")
|
if(NOT SDL_REVISION)
|
||||||
# If VERSION exists, it contains the SDL version
|
set(SDL_REVISION_SUFFIX "" CACHE STRING "Suffix for the SDL revision")
|
||||||
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION.txt" SDL_REVISION_CENTER)
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION.txt")
|
||||||
string(STRIP "${SDL_REVISION_CENTER}" SDL_REVISION_CENTER)
|
# If VERSION exists, it contains the SDL version
|
||||||
else()
|
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION.txt" SDL_REVISION_CENTER)
|
||||||
# If VERSION does not exist, use git to calculate a version
|
string(STRIP "${SDL_REVISION_CENTER}" SDL_REVISION_CENTER)
|
||||||
git_describe(SDL_REVISION_CENTER)
|
else()
|
||||||
if(NOT SDL_REVISION_CENTER)
|
# If VERSION does not exist, use git to calculate a version
|
||||||
set(SDL_REVISION_CENTER "${SDL3_VERSION}-no-vcs")
|
git_describe(SDL_REVISION_CENTER)
|
||||||
|
if(NOT SDL_REVISION_CENTER)
|
||||||
|
set(SDL_REVISION_CENTER "${SDL3_VERSION}-no-vcs")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
set(SDL_REVISION "SDL-${SDL_REVISION_CENTER}${SDL_REVISION_SUFFIX}")
|
||||||
endif()
|
endif()
|
||||||
set(SDL_REVISION "SDL-${SDL_REVISION_CENTER}${SDL_REVISION_SUFFIX}")
|
|
||||||
|
|
||||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory "${SDL3_BINARY_DIR}/include/SDL3")
|
execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory "${SDL3_BINARY_DIR}/include/SDL3")
|
||||||
configure_file(include/build_config/SDL_revision.h.cmake include/SDL3/SDL_revision.h @ONLY)
|
configure_file(include/build_config/SDL_revision.h.cmake include/SDL3/SDL_revision.h @ONLY)
|
||||||
|
|
Loading…
Reference in New Issue