-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
106 lines (85 loc) · 3.69 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
cmake_minimum_required(VERSION 2.8)
project(Engine)
set(CMAKE_CXX_FLAGS "-Wall -Wextra -std=c++11 -pedantic -fPIC -pthread -ggdb3 -isystem 3rd_party/glsl-optimizer")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -Werror -O3")
set(CMAKE_AR "gcc-ar")
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_FINISH true)
list(APPEND CMAKE_MODULE_PATH cmake_deps)
find_package(PkgConfig REQUIRED)
find_package(GLEW REQUIRED)
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)
find_package(SOIL REQUIRED)
find_package(GLM REQUIRED)
find_package(OpenGL REQUIRED)
pkg_search_module(GLFW REQUIRED glfw3)
include_directories(src/debug)
include_directories(src/resource)
include_directories(src/ui)
include_directories(src/base)
include_directories(src/render_backend)
include_directories(src/engine)
include_directories(src/scene)
include_directories(src/utils)
#glsl optimizer
include_directories(SYSTEM 3rd_party/glsl-optimizer/include)
include_directories(SYSTEM 3rd_party/glsl-optimizer/src/mesa)
include_directories(SYSTEM 3rd_party/glsl-optimizer/src/mapi)
include_directories(SYSTEM 3rd_party/glsl-optimizer/src/glsl)
include_directories(SYSTEM 3rd_party/glsl-optimizer/src)
#
add_subdirectory(src/debug)
add_subdirectory(src/resource)
add_subdirectory(src/ui)
add_subdirectory(src/base)
add_subdirectory(src/render_backend)
add_subdirectory(src/engine)
add_subdirectory(src/scene)
add_subdirectory(src/utils)
set(CMAKE_CTEST_COMMAND ctest -V)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
include_directories(tests/debug)
include_directories(3rd_party)
add_subdirectory(tests/debug)
file(GLOB_RECURSE glcpp-library_sources 3rd_party/glsl-optimizer/src/glsl/glcpp/*.c 3rd_party/glsl-optimizer/src/util/*.c)
add_library(glcpp-library ${glcpp-library_sources})
file(GLOB_RECURSE mesa_sources 3rd_party/glsl-optimizer/src/mesa/program/*.c 3rd_party/glsl-optimizer/src/mesa/main/*.c)
add_library(mesa ${mesa_sources})
file(GLOB_RECURSE glsl_sources 3rd_party/glsl-optimizer/src/glsl/*.cpp 3rd_party/glsl-optimizer/src/glsl/*.c)
file(GLOB_RECURSE glsl_sources_remove 3rd_party/glsl-optimizer/src/glsl/main.cpp 3rd_party/glsl-optimizer/src/glsl/builtin_stubs.cpp)
list(REMOVE_ITEM glsl_sources ${glsl_sources_remove})
add_library(glsl_optimizer ${glsl_sources})
target_link_libraries(glsl_optimizer glcpp-library mesa)
#
add_executable(Engine_check EXCLUDE_FROM_ALL
tests/debug/main.cc
$<TARGET_OBJECTS:debug> $<TARGET_OBJECTS:resource>
$<TARGET_OBJECTS:ui> $<TARGET_OBJECTS:base>
$<TARGET_OBJECTS:render_backend> $<TARGET_OBJECTS:engine_>
$<TARGET_OBJECTS:scene> $<TARGET_OBJECTS:utils>)
add_library(Engine SHARED
$<TARGET_OBJECTS:debug> $<TARGET_OBJECTS:resource>
$<TARGET_OBJECTS:ui> $<TARGET_OBJECTS:base>
$<TARGET_OBJECTS:render_backend> $<TARGET_OBJECTS:engine_>
$<TARGET_OBJECTS:scene> $<TARGET_OBJECTS:utils>)
add_test(Engine_check Engine_check)
add_dependencies(check Engine_check)
target_link_libraries(Engine_check ${CMAKE_DL_LIBS} GL GLEW glfw SOIL glsl_optimizer)
add_custom_target(glsl-optimizer_parser_generation
WORKING_DIRECTORY ./3rd_party/glsl-optimizer
COMMAND ./generateParsers.sh
)
add_dependencies(glsl_optimizer glsl-optimizer_parser_generation)
#add_dependencies(Engine Engine_check glsl-optimizer_parser_generation)
add_custom_target(deep_clean
COMMAND find . -iwholename '*cmake*' -not -name CMakeLists.txt -not -name cmake_deps -not -name '*Find*' -delete
COMMAND find . -iwholename '*Makefile*' -delete
COMMAND rm -rf Testing Engine_check libEngine.so doc/ libglcpp-library.a
libmesa.a libglsl_optimizer.a
)
add_custom_target(doc
WORKING_DIRECTORY src
COMMAND doxygen ../Doxyfile
)