cmake: Generate obs.rc out-of-tree

Fixes the `obs.rc` file appearing in the UI source tree and moves it
into the out-of-tree build directories provided by CMake. Projects
requiring this can use it by adding `${obs-studio_BINARY_DIR}/obs.rc`
to their source list.
master
Michael Fabian 'Xaymar' Dirks 2019-03-16 04:28:19 +01:00
parent 6550c0dfaa
commit 8b346ade64
2 changed files with 12 additions and 11 deletions

View File

@ -32,16 +32,6 @@ include(ObsHelpers)
include(ObsCpack)
include(GNUInstallDirs)
if(WIN32)
string(REPLACE "-" ";" UI_VERSION_SPLIT ${OBS_VERSION})
list(GET UI_VERSION_SPLIT 0 UI_VERSION)
string(REPLACE "." ";" UI_VERSION_SEMANTIC ${UI_VERSION})
list(GET UI_VERSION_SEMANTIC 0 UI_VERSION_MAJOR)
list(GET UI_VERSION_SEMANTIC 1 UI_VERSION_MINOR)
list(GET UI_VERSION_SEMANTIC 2 UI_VERSION_PATCH)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/UI/obs.rc.in ${CMAKE_CURRENT_SOURCE_DIR}/UI/obs.rc)
endif()
# Must be a string in the format of "x.x.x-rcx"
if(DEFINED RELEASE_CANDIDATE)
set(OBS_VERSION "${RELEASE_CANDIDATE}")
@ -59,6 +49,17 @@ else()
set(OBS_RELEASE_CANDIDATE 0)
endif()
# Binary Versioning for Windows
if(WIN32)
string(REPLACE "-" ";" UI_VERSION_SPLIT ${OBS_VERSION})
list(GET UI_VERSION_SPLIT 0 UI_VERSION)
string(REPLACE "." ";" UI_VERSION_SEMANTIC ${UI_VERSION})
list(GET UI_VERSION_SEMANTIC 0 UI_VERSION_MAJOR)
list(GET UI_VERSION_SEMANTIC 1 UI_VERSION_MINOR)
list(GET UI_VERSION_SEMANTIC 2 UI_VERSION_PATCH)
configure_file(UI/obs.rc.in ${PROJECT_BINARY_DIR}/obs.rc)
endif()
if(MSVC AND NOT EXISTS "${CMAKE_BINARY_DIR}/ALL_BUILD.vcxproj.user")
file(GENERATE
OUTPUT "${CMAKE_BINARY_DIR}/ALL_BUILD.vcxproj.user"

View File

@ -97,7 +97,7 @@ if(WIN32)
win-update/update-window.cpp
win-update/win-update.cpp
win-update/win-update-helpers.cpp
obs.rc)
${obs-studio_BINARY_DIR}/obs.rc)
set(obs_PLATFORM_HEADERS
win-update/update-window.hpp
win-update/win-update.hpp