提交 044680f0 编写于 作者: B BtbN

Add config.h generation and wrapper header, currently only for OBS_VERSION

上级 04dfcb2d
......@@ -11,8 +11,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
include(ObsHelpers)
include(ObsCpack)
add_definitions(-DOBS_VERSION="${OBS_VERSION}")
if(MSVC AND NOT EXISTS "${CMAKE_BINARY_DIR}/ALL_BUILD.vcxproj.user")
file(GENERATE
OUTPUT "${CMAKE_BINARY_DIR}/ALL_BUILD.vcxproj.user"
......@@ -55,6 +53,10 @@ endif()
if(NOT INSTALLER_RUN)
add_subdirectory(deps)
add_definitions(-DHAVE_CONFIG_H=1)
include_directories("${CMAKE_BINARY_DIR}/config")
add_subdirectory(libobs)
if(WIN32)
......
......@@ -15,7 +15,7 @@ set(CPACK_PACKAGE_VERSION_PATCH "1")
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
execute_process(COMMAND git describe --always
execute_process(COMMAND git describe --always --dirty=-modified
OUTPUT_VARIABLE OBS_VERSION
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_STRIP_TRAILING_WHITESPACE)
......
......@@ -17,7 +17,6 @@ include_directories(${Libavformat_INCLUDE_DIR})
add_definitions(${Libavformat_DEFINITIONS})
add_definitions(-DLIBOBS_EXPORTS)
add_definitions(-DPTW32_STATIC_LIB)
if(WIN32)
set(libobs_PLATFORM_SOURCES
......@@ -27,6 +26,8 @@ if(WIN32)
set(libobs_PLATFORM_DEPS
w32-pthreads
winmm.lib)
add_definitions(-DPTW32_STATIC_LIB)
elseif(APPLE)
set(libobs_PLATFORM_SOURCES
obs-cocoa.c
......@@ -57,6 +58,14 @@ if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHc-")
endif()
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/config.h.in"
"${CMAKE_BINARY_DIR}/config/config.h")
set(libobs_config_HEADERS
config.h
obs-config.h)
set(libobs_callback_SOURCES
callback/calldata.c
callback/decl.c
......
#pragma once
#define OBS_VERSION "@OBS_VERSION@"
/******************************************************************************
Copyright (C) 2014 by Hugh Bailey <obs.jim@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#pragma once
#ifdef HAVE_CONFIG_H
# include "config.h"
#else
#define OBS_VERSION "unknown"
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册