cmake: Add release candidate versions/cmake variables

Allows specifying a release candidate version, and outputs release
candidate version variables to libobs/obs-config.h.  Useful for using
cmake to specify a release candidate version.
master
jp9000 2018-08-13 00:24:30 -07:00
parent 41b7f85332
commit e3c2202791
3 changed files with 39 additions and 0 deletions

View File

@ -27,6 +27,23 @@ include(ObsHelpers)
include(ObsCpack) include(ObsCpack)
include(GNUInstallDirs) include(GNUInstallDirs)
# Must be a string in the format of "x.x.x-rcx"
if(DEFINED RELEASE_CANDIDATE)
set(OBS_VERSION "${RELEASE_CANDIDATE}")
string(REPLACE "-rc" "." RC_SPLIT ${RELEASE_CANDIDATE})
string(REPLACE "." ";" RC_SPLIT ${RC_SPLIT})
message(WARNING "******************************************************************************\nRelease candidate deteced, OBS_VERSION is now: ${OBS_VERSION}\n******************************************************************************")
list(GET RC_SPLIT 0 OBS_RELEASE_CANDIDATE_MAJOR)
list(GET RC_SPLIT 1 OBS_RELEASE_CANDIDATE_MINOR)
list(GET RC_SPLIT 2 OBS_RELEASE_CANDIDATE_PATCH)
list(GET RC_SPLIT 3 OBS_RELEASE_CANDIDATE)
else()
set(OBS_RELEASE_CANDIDATE_MAJOR 0)
set(OBS_RELEASE_CANDIDATE_MINOR 0)
set(OBS_RELEASE_CANDIDATE_PATCH 0)
set(OBS_RELEASE_CANDIDATE 0)
endif()
if(MSVC AND NOT EXISTS "${CMAKE_BINARY_DIR}/ALL_BUILD.vcxproj.user") if(MSVC AND NOT EXISTS "${CMAKE_BINARY_DIR}/ALL_BUILD.vcxproj.user")
file(GENERATE file(GENERATE
OUTPUT "${CMAKE_BINARY_DIR}/ALL_BUILD.vcxproj.user" OUTPUT "${CMAKE_BINARY_DIR}/ALL_BUILD.vcxproj.user"

View File

@ -61,6 +61,11 @@
# define OBS_INSTALL_PREFIX "" # define OBS_INSTALL_PREFIX ""
# define OBS_PLUGIN_DESTINATION "obs-plugins" # define OBS_PLUGIN_DESTINATION "obs-plugins"
# define OBS_RELATIVE_PREFIX "../../" # define OBS_RELATIVE_PREFIX "../../"
# define OBS_RELEASE_CANDIDATE_MAJOR 0
# define OBS_RELEASE_CANDIDATE_MINOR 0
# define OBS_RELEASE_CANDIDATE_PATCH 0
# define OBS_RELEASE_CANDIDATE_VER 0
# define OBS_RELEASE_CANDIDATE 0
#endif #endif
#define OBS_INSTALL_DATA_PATH OBS_INSTALL_PREFIX OBS_DATA_PATH #define OBS_INSTALL_DATA_PATH OBS_INSTALL_PREFIX OBS_DATA_PATH

View File

@ -22,3 +22,20 @@
#define LIBOBS_IMAGEMAGICK_DIR_STYLE_6L 6 #define LIBOBS_IMAGEMAGICK_DIR_STYLE_6L 6
#define LIBOBS_IMAGEMAGICK_DIR_STYLE_7GE 7 #define LIBOBS_IMAGEMAGICK_DIR_STYLE_7GE 7
#define LIBOBS_IMAGEMAGICK_DIR_STYLE @LIBOBS_IMAGEMAGICK_DIR_STYLE@ #define LIBOBS_IMAGEMAGICK_DIR_STYLE @LIBOBS_IMAGEMAGICK_DIR_STYLE@
/* NOTE: Release candidate version numbers internally are always the previous
* main release number! For example, if the current public release is 21.0 and
* the build is 22.0 release candidate 1, internally the build number (defined
* by LIBOBS_API_VER/etc) will always be 21.0, despite the OBS_VERSION string
* saying "22.0 RC1".
*
* If the release candidate version number is 0.0.0 and the RC number is 0,
* that means it's not a release candidate build. */
#define OBS_RELEASE_CANDIDATE_MAJOR @OBS_RELEASE_CANDIDATE_MAJOR@
#define OBS_RELEASE_CANDIDATE_MINOR @OBS_RELEASE_CANDIDATE_MINOR@
#define OBS_RELEASE_CANDIDATE_PATCH @OBS_RELEASE_CANDIDATE_PATCH@
#define OBS_RELEASE_CANDIDATE_VER \
MAKE_SEMANTIC_VERSION(OBS_RELEASE_CANDIDATE_MAJOR, \
OBS_RELEASE_CANDIDATE_MINOR, \
OBS_RELEASE_CANDIDATE_PATCH)
#define OBS_RELEASE_CANDIDATE @OBS_RELEASE_CANDIDATE@