-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
88 lines (78 loc) · 2.33 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
cmake_minimum_required(VERSION 3.12)
project(nCine-libraries)
option(BUILD_WEBP "Build the WebP library" ON)
option(BUILD_PNG "Build the zlib and the PNG library" ON)
option(BUILD_GLEW "Build the GLEW library" ON)
option(BUILD_GLFW "Build the GLFW library" ON)
option(BUILD_GLFW_STATIC "Build the static version of the GLFW library" ON)
option(BUILD_SDL2 "Build the SDL2 library" ON)
option(BUILD_OGG "Build the OGG library" ON)
option(BUILD_VORBIS "Build the Vorbis library" ON)
option(BUILD_OPENAL "Build the OpenAL-soft library" ON)
option(BUILD_LUA "Build the Lua library and interepreter" ON)
option(BUILD_BOX2D "Build the Box2D library" ON)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
get_filename_component(PARENT_SOURCE_DIR ${CMAKE_SOURCE_DIR} DIRECTORY)
if(NOT EMSCRIPTEN)
set(DESTINATION_PATH ${PARENT_SOURCE_DIR}/nCine-external CACHE STRING "Set the destination directory where files will be copied")
else()
set(DESTINATION_PATH ${PARENT_SOURCE_DIR}/nCine-external-emscripten CACHE STRING "Set the destination directory where files will be copied")
endif()
set(EP_BASE "${CMAKE_BINARY_DIR}/ExternalProjects")
set_property(DIRECTORY PROPERTY "EP_BASE" ${EP_BASE})
if(NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "Release")
message(STATUS "CMAKE_BUILD_TYPE set by default to: " ${CMAKE_BUILD_TYPE})
else()
message(STATUS "CMAKE_BUILD_TYPE is: " ${CMAKE_BUILD_TYPE})
endif()
if(MSVC)
if(CMAKE_CL_64)
set(BINDIR "${DESTINATION_PATH}/bin/x64")
set(LIBDIR "${DESTINATION_PATH}/lib/x64")
else()
set(BINDIR "${DESTINATION_PATH}/bin/x86")
set(LIBDIR "${DESTINATION_PATH}/lib/x86")
endif()
set(INCDIR "${DESTINATION_PATH}/include")
file(MAKE_DIRECTORY ${BINDIR})
file(MAKE_DIRECTORY ${LIBDIR})
file(MAKE_DIRECTORY ${INCDIR})
endif()
include(ExternalProject)
include(ProcessorCount)
ProcessorCount(CPUS)
if(BUILD_WEBP)
include(webp)
endif()
if(BUILD_PNG)
include(zlib)
include(png)
endif()
if(BUILD_GLEW)
include(glew)
endif()
if(BUILD_GLFW)
include(glfw)
endif()
if(BUILD_GLFW AND BUILD_GLFW_STATIC)
include(glfw_static)
endif()
if(BUILD_SDL2)
include(sdl2)
endif()
if(BUILD_OGG)
include(ogg)
endif()
if(BUILD_OGG AND BUILD_VORBIS)
include(vorbis)
endif()
if(BUILD_OPENAL)
include(openal-soft)
endif()
if(BUILD_LUA)
include(lua)
endif()
if(BUILD_BOX2D)
include(box2d)
endif()