templates: Add generated configuration file

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2020-08-10 01:37:01 +02:00
parent 0ecf971446
commit c20ac4a413
4 changed files with 47 additions and 2 deletions

View file

@ -20,7 +20,7 @@ NamespaceIndentation: All
# Includes # Includes
#IncludeBlocks: Regroup #IncludeBlocks: Regroup
IncludeCategories: IncludeCategories:
- Regex: '^(<|")(common.hpp|strings.hpp|version.hpp|obs.h)("|>)' - Regex: '^(<|")(config.hpp|common.hpp|strings.hpp|version.hpp|obs.h)("|>)'
Priority: 100 Priority: 100
- Regex: '^<obs-' - Regex: '^<obs-'
Priority: 150 Priority: 150

View file

@ -260,7 +260,7 @@ set(${PropertyPrefix}SIGN_PASSWORD "" CACHE STRING "Password for the private key
# CMake / Compiler Dependencies # CMake / Compiler Dependencies
################################################################################ ################################################################################
# Configure Version Header # Configure Files
configure_file( configure_file(
"templates/version.hpp.in" "templates/version.hpp.in"
"${PROJECT_BINARY_DIR}/generated/version.hpp" "${PROJECT_BINARY_DIR}/generated/version.hpp"
@ -270,6 +270,18 @@ configure_file(
"${PROJECT_BINARY_DIR}/generated/module.cpp" "${PROJECT_BINARY_DIR}/generated/module.cpp"
) )
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(D_PLATFORM_WINDOWS 1)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(D_PLATFORM_LINUX 1)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Mac")
set(D_PLATFORM_MAC 1)
endif()
configure_file(
"templates/config.hpp.in"
"${PROJECT_BINARY_DIR}/generated/config.hpp"
)
if(NOT TARGET libobs) if(NOT TARGET libobs)
# Packaging # Packaging
if("${CMAKE_PACKAGE_SUFFIX_OVERRIDE}" STREQUAL "") if("${CMAKE_PACKAGE_SUFFIX_OVERRIDE}" STREQUAL "")
@ -468,6 +480,7 @@ list(APPEND PROJECT_DATA
list(APPEND PROJECT_TEMPLATES list(APPEND PROJECT_TEMPLATES
"templates/version.hpp.in" "templates/version.hpp.in"
"templates/module.cpp.in" "templates/module.cpp.in"
"templates/config.hpp.in"
) )
list(APPEND PROJECT_PRIVATE_SOURCE list(APPEND PROJECT_PRIVATE_SOURCE
# Plugin # Plugin
@ -531,6 +544,7 @@ list(APPEND PROJECT_PRIVATE_SOURCE
list(APPEND PROJECT_PRIVATE_GENERATED list(APPEND PROJECT_PRIVATE_GENERATED
"${PROJECT_BINARY_DIR}/generated/module.cpp" "${PROJECT_BINARY_DIR}/generated/module.cpp"
"${PROJECT_BINARY_DIR}/generated/version.hpp" "${PROJECT_BINARY_DIR}/generated/version.hpp"
"${PROJECT_BINARY_DIR}/generated/config.hpp"
) )
if(WIN32) if(WIN32)
list(APPEND PROJECT_TEMPLATES list(APPEND PROJECT_TEMPLATES

View file

@ -44,6 +44,7 @@
#include <vector> #include <vector>
// Common Plugin includes // Common Plugin includes
#include "config.hpp"
#include "strings.hpp" #include "strings.hpp"
#include "version.hpp" #include "version.hpp"
#include "util/util-math.hpp" #include "util/util-math.hpp"

30
templates/config.hpp.in Normal file
View file

@ -0,0 +1,30 @@
/*
* Modern effects for a modern Streamer
* Copyright (C) 2020 Michael Fabian Dirks
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define D_PLATFORM "@CMAKE_SYSTEM_NAME@"
#cmakedefine D_PLATFORM_WINDOWS
#cmakedefine D_PLATFORM_LINUX
#cmakedefine D_PLATFORM_MAC
#define D_PLATFORM_BITS @BITS@
#if D_PLATFORM_BITS == 64
#define D_PLATFORM_64BIT
#else
#define D_PLATFORM_32BIT
#endif