mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-20 10:09:15 +00:00
d813b7837a
Allows for configuration and build from a read-only-mounted source dir by setting the build number externally. For example: `cmake -DOBS_BUILD_NUMBER=1`
24 lines
699 B
CMake
24 lines
699 B
CMake
# OBS CMake build number module
|
|
|
|
include_guard(GLOBAL)
|
|
|
|
# Define build number cache file
|
|
set(_BUILD_NUMBER_CACHE
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/.CMakeBuildNumber"
|
|
CACHE INTERNAL "OBS build number cache file")
|
|
|
|
# Read build number from cache file or manual override
|
|
if(NOT DEFINED OBS_BUILD_NUMBER)
|
|
if(EXISTS "${_BUILD_NUMBER_CACHE}")
|
|
file(READ "${_BUILD_NUMBER_CACHE}" OBS_BUILD_NUMBER)
|
|
math(EXPR OBS_BUILD_NUMBER "${OBS_BUILD_NUMBER}+1")
|
|
else()
|
|
if("$ENV{CI}" AND "$ENV{GITHUB_RUN_ID}")
|
|
set(OBS_BUILD_NUMBER "$ENV{GITHUB_RUN_ID}")
|
|
else()
|
|
set(OBS_BUILD_NUMBER "1")
|
|
endif()
|
|
endif()
|
|
file(WRITE "${_BUILD_NUMBER_CACHE}" "${OBS_BUILD_NUMBER}")
|
|
endif()
|