-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
85 lines (65 loc) · 2.47 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
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
option(IWYU "IWYU" OFF)
option(BUILD_DOJO2D "Build Dojo2D project" OFF)
if (BUILD_DOJO2D)
add_subdirectory("dojo2D")
endif()
project("Dojo")
include (AddDojoIncludes.cmake)
include (MSVCSetup.cmake)
include (ClangGCCSetup.cmake)
include_directories("include/dojo") #private include
set(COMPILE_DEFINITIONS_RELEASE "${COMPILE_DEFINITIONS_RELEASE} -DPUBLISH")
file(GLOB common_src
"include/dojo/*.h"
"include/dojo/glad/*.h"
"src/*.cpp"
"dependencies/include/glad/*"
)
if (WIN32)
file(GLOB platform_src
"include/dojo/win32/*.h"
"src/win32/*.cpp"
)
endif()
set(dojo_SRC ${common_src} ${platform_src})
add_library(Dojo ${dojo_SRC})
if(WIN32)
set(LIBS_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/win32/lib")
set(RELEASE_LIBS "${LIBS_ROOT}/Release")
set(DEBUG_LIBS "${LIBS_ROOT}/Debug")
target_link_libraries(Dojo
debug "${DEBUG_LIBS}/freetype.lib" optimized "${RELEASE_LIBS}/freetype.lib"
debug "${DEBUG_LIBS}/FreeImage.lib" optimized "${RELEASE_LIBS}/FreeImage.lib"
debug "${DEBUG_LIBS}/libogg_static.lib" optimized "${RELEASE_LIBS}/libogg_static.lib"
debug "${DEBUG_LIBS}/libvorbis_static.lib" optimized "${RELEASE_LIBS}/libvorbis_static.lib"
debug "${DEBUG_LIBS}/libvorbisfile_static.lib" optimized "${RELEASE_LIBS}/libvorbisfile_static.lib"
debug "${DEBUG_LIBS}/zziplib.lib" optimized "${RELEASE_LIBS}/zziplib.lib"
"${LIBS_ROOT}/OpenAL32.lib"
"XInput.lib"
)
else()
find_library(FREEIMAGE freeimage)
find_library(OGG ogg)
find_library(VORBIS vorbis)
find_library(VORBISFILE vorbisfile)
find_library(ZZIP zzip)
find_library(OPENAL openal)
target_link_libraries(Dojo ${FREETYPE_LIBRARIES} ${FREEIMAGE} ${OGG} ${VORBIS} ${VORBISFILE} ${ZZIP} ${OPENAL_LIBRARY})
endif()
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17)
if (IWYU)
find_program(iwyu_path NAMES include-what-you-use iwyu)
if(NOT iwyu_path)
message(FATAL_ERROR "Could not find the program include-what-you-use")
endif()
set_property(TARGET Dojo PROPERTY CXX_INCLUDE_WHAT_YOU_USE "${iwyu_path}")
else()
include(cotire)
set_target_properties(Dojo PROPERTIES
COTIRE_PREFIX_HEADER_IGNORE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/src;${CMAKE_CURRENT_SOURCE_DIR}/include;"
COTIRE_ADD_UNITY_BUILD FALSE
)
cotire(Dojo)
endif()