forked from obsproject/obs-studio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CMake now works on all platforms
- Loading branch information
Showing
48 changed files
with
2,071 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
cmake_minimum_required(VERSION 2.8.11) | ||
|
||
project(obs-studio) | ||
|
||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") | ||
|
||
if(NOT _one_time_action_done) | ||
if(MSVC) | ||
file(GENERATE | ||
OUTPUT "${CMAKE_BINARY_DIR}/ALL_BUILD.vcxproj.user" | ||
INPUT "${CMAKE_SOURCE_DIR}/cmake/ALL_BUILD.vcxproj.user.in" | ||
CONDITION ${MSVC}) | ||
endif() | ||
set(_one_time_action_done TRUE CACHE INTERNAL "") | ||
endif() | ||
|
||
include(ObsHelpers) | ||
|
||
if(NOT CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE RelWithDebInfo) | ||
endif() | ||
|
||
find_package(CXX11 REQUIRED) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAGS}") | ||
|
||
if(${CMAKE_C_COMPILER_ID} MATCHES "Clang" OR ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") | ||
set(CMAKE_COMPILER_IS_CLANG TRUE) | ||
endif() | ||
|
||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function -Wno-unused-parameter -Wall -Wextra") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wno-unused-function -Wno-unused-parameter -Wall -Wextra") | ||
|
||
option(USE_LIBC++ "Use libc++ instead of libstdc++" ${APPLE}) | ||
if(USE_LIBC++) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") | ||
endif() | ||
endif() | ||
|
||
if(WIN32) | ||
add_definitions(-DUNICODE -D_UNICODE) | ||
endif() | ||
|
||
if(APPLE) | ||
set(CMAKE_MACOSX_RPATH TRUE) | ||
set(CMAKE_INSTALL_RPATH | ||
"${CMAKE_INSTALL_RPATH};@loader_path/;@executable_path/") | ||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) | ||
endif() | ||
|
||
add_subdirectory(deps) | ||
add_subdirectory(libobs) | ||
|
||
if(WIN32) | ||
add_subdirectory(libobs-d3d11) | ||
add_subdirectory(libobs-d3d9) | ||
endif() | ||
|
||
add_subdirectory(libobs-opengl) | ||
add_subdirectory(obs) | ||
add_subdirectory(plugins) | ||
add_subdirectory(test) | ||
|
||
obs_install_additional() | ||
|
||
# CPack Configuration | ||
|
||
if(APPLE) | ||
set(CPACK_GENERATOR "Bundle") | ||
endif() | ||
|
||
set(CPACK_PACKAGE_NAME "OBS Studio") | ||
set(CPACK_PACKAGE_VENDOR "obsproject.com") | ||
set(CPACK_PACKAGE_VERSION "0.0.1") | ||
set(CPACK_PACKAGE_VERSION_MAJOR "0") | ||
set(CPACK_PACKAGE_VERSION_MINOR "0") | ||
set(CPACK_PACKAGE_VERSION_PATCH "1") | ||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OBS Studio - Multi-platform broadcasting software") | ||
|
||
set(CPACK_PACKAGE_EXECUTABLES "obs;OBS Studio") | ||
set(CPACK_CREATE_DESKTOP_LINKS "obs") | ||
|
||
set(CPACK_BUNDLE_NAME "OBS Studio") | ||
set(CPACK_BUNDLE_PLIST "${CMAKE_SOURCE_DIR}/cmake/osxbundle/Info.plist") | ||
set(CPACK_BUNDLE_ICON "${CMAKE_SOURCE_DIR}/cmake/osxbundle/obs.icns") | ||
set(CPACK_BUNDLE_STARTUP_COMMAND "${CMAKE_SOURCE_DIR}/cmake/osxbundle/obslaunch.sh") | ||
|
||
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) | ||
set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".") | ||
set(CPACK_NSIS_MODIFY_PATH ON) | ||
|
||
if(CMAKE_SIZEOF_VOID_P EQUAL 8) | ||
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "OBSStudio64") | ||
SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64") | ||
else() | ||
if(WIN32) | ||
set(CPACK_PACKAGE_NAME "OBS Studio (32bit)") | ||
endif() | ||
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "OBSStudio32") | ||
SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES32") | ||
endif() | ||
|
||
include(CPack) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|x64'"> | ||
<LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\obs.exe</LocalDebuggerCommand> | ||
<LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)</LocalDebuggerWorkingDirectory> | ||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\obs.exe</LocalDebuggerCommand> | ||
<LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)</LocalDebuggerWorkingDirectory> | ||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\obs.exe</LocalDebuggerCommand> | ||
<LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)</LocalDebuggerWorkingDirectory> | ||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|x64'"> | ||
<LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\obs.exe</LocalDebuggerCommand> | ||
<LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)</LocalDebuggerWorkingDirectory> | ||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|Win32'"> | ||
<LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\obs.exe</LocalDebuggerCommand> | ||
<LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)</LocalDebuggerWorkingDirectory> | ||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\obs.exe</LocalDebuggerCommand> | ||
<LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)</LocalDebuggerWorkingDirectory> | ||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\obs.exe</LocalDebuggerCommand> | ||
<LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)</LocalDebuggerWorkingDirectory> | ||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|Win32'"> | ||
<LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\obs.exe</LocalDebuggerCommand> | ||
<LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)</LocalDebuggerWorkingDirectory> | ||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# - Finds if the compiler has C++11 support | ||
# This module can be used to detect compiler flags for using C++11, and checks | ||
# a small subset of the language. | ||
# | ||
# The following variables are set: | ||
# CXX11_FLAGS - flags to add to the CXX compiler for C++11 support | ||
# CXX11_FOUND - true if the compiler supports C++11 | ||
# | ||
|
||
if(CXX11_FLAGS) | ||
set(CXX11_FOUND TRUE) | ||
return() | ||
endif() | ||
|
||
include(CheckCXXSourceCompiles) | ||
include(FindPackageHandleStandardArgs) | ||
|
||
if(MSVC) | ||
set(CXX11_FLAG_CANDIDATES | ||
" " | ||
) | ||
else() | ||
set(CXX11_FLAG_CANDIDATES | ||
#gcc | ||
"-std=gnu++11" | ||
"-std=gnu++0x" | ||
#Gnu and Intel Linux | ||
"-std=c++11" | ||
"-std=c++0x" | ||
#Microsoft Visual Studio, and everything that automatically accepts C++11 | ||
" " | ||
#Intel windows | ||
"/Qstd=c++11" | ||
"/Qstd=c++0x" | ||
) | ||
endif() | ||
|
||
set(CXX11_TEST_SOURCE | ||
" | ||
int main() | ||
{ | ||
int n[] = {4,7,6,1,2}; | ||
int r; | ||
auto f = [&](int j) { r = j; }; | ||
for (auto i : n) | ||
f(i); | ||
return 0; | ||
} | ||
") | ||
|
||
foreach(FLAG ${CXX11_FLAG_CANDIDATES}) | ||
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") | ||
set(CMAKE_REQUIRED_FLAGS "${FLAG}") | ||
unset(CXX11_FLAG_DETECTED CACHE) | ||
message(STATUS "Try C++11 flag = [${FLAG}]") | ||
check_cxx_source_compiles("${CXX11_TEST_SOURCE}" CXX11_FLAG_DETECTED) | ||
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}") | ||
if(CXX11_FLAG_DETECTED) | ||
set(CXX11_FLAGS_INTERNAL "${FLAG}") | ||
break() | ||
endif(CXX11_FLAG_DETECTED) | ||
endforeach(FLAG ${CXX11_FLAG_CANDIDATES}) | ||
|
||
set(CXX11_FLAGS "${CXX11_FLAGS_INTERNAL}" CACHE STRING "C++11 Flags") | ||
|
||
find_package_handle_standard_args(CXX11 DEFAULT_MSG CXX11_FLAGS) | ||
mark_as_advanced(CXX11_FLAGS) |
Oops, something went wrong.