forked from widberg/bgfx.cmake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
91 lines (76 loc) · 3.46 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# bgfx.cmake - bgfx building in cmake
# Written in 2017 by Joshua Brookover <[email protected]>
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed without any warranty.
# You should have received a copy of the CC0 Public Domain Dedication along with
# this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
cmake_minimum_required( VERSION 3.0 )
project( bgfx )
set_property( GLOBAL PROPERTY USE_FOLDERS ON )
if( APPLE AND NOT IOS )
set( CMAKE_CXX_FLAGS "-ObjC++ --std=c++14" )
elseif(UNIX)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
option( BGFX_BUILD_TOOLS "Build bgfx tools." ON )
option( BGFX_BUILD_EXAMPLES "Build bgfx examples." ON )
option( BGFX_INSTALL "Create installation target." ON )
option( BGFX_INSTALL_EXAMPLES "Install examples and their runtimes." OFF )
option( BGFX_CUSTOM_TARGETS "Include convenience custom targets." ON )
option( BGFX_USE_OVR "Build with OVR support." OFF )
option( BGFX_AMALGAMATED "Amalgamated bgfx build for faster compilation" OFF )
option( BX_AMALGAMATED "Amalgamated bx build for faster compilation" OFF )
option( BGFX_CONFIG_DEBUG "Enables debug configuration on all builds" OFF )
option( BGFX_USE_DEBUG_SUFFIX "Add 'd' suffix to debug output targets" ON )
set( BGFX_OPENGL_VERSION "" CACHE STRING "Specify minimum opengl version" )
if( NOT BX_DIR )
set( BX_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bx" CACHE STRING "Location of bx." )
elseif( NOT IS_ABSOLUTE "${BX_DIR}")
get_filename_component(BX_DIR "${BX_DIR}" REALPATH BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
if( NOT BIMG_DIR )
set( BIMG_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bimg" CACHE STRING "Location of bimg." )
elseif( NOT IS_ABSOLUTE "${BIMG_DIR}")
get_filename_component(BIMG_DIR "${BIMG_DIR}" REALPATH BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
if( NOT BGFX_DIR )
set( BGFX_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bgfx" CACHE STRING "Location of bgfx." )
elseif( NOT IS_ABSOLUTE "${BGFX_DIR}")
get_filename_component(BGFX_DIR "${BGFX_DIR}" REALPATH BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
if( BGFX_USE_OVR )
include( cmake/ovr.cmake )
endif()
include( cmake/shared.cmake )
include( cmake/bx.cmake )
include( cmake/bimg.cmake )
include( cmake/bgfx.cmake )
if( BGFX_BUILD_TOOLS )
include( cmake/tools.cmake )
endif()
include( cmake/examples.cmake )
if( BGFX_INSTALL )
# install bx
install( TARGETS bx DESTINATION lib )
install( DIRECTORY ${BX_DIR}/include DESTINATION . )
# install bimg
install( TARGETS bimg DESTINATION lib )
install( DIRECTORY ${BIMG_DIR}/include DESTINATION . )
# install bgfx
install( TARGETS bgfx DESTINATION lib )
install( DIRECTORY ${BGFX_DIR}/include DESTINATION . )
# install tools
if( BGFX_BUILD_TOOLS )
install( TARGETS shaderc DESTINATION bin )
install( TARGETS geometryc DESTINATION bin )
endif()
# install examples
if( BGFX_BUILD_EXAMPLES AND BGFX_INSTALL_EXAMPLES )
install( DIRECTORY ${BGFX_DIR}/examples/runtime/ DESTINATION examples )
foreach( EXAMPLE ${BGFX_EXAMPLES} )
install( TARGETS example-${EXAMPLE} DESTINATION examples )
endforeach()
endif()
endif()