-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
107 lines (90 loc) · 3.04 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 3.21)
message("Using CMake version ${CMAKE_VERSION}")
if(APPLE)
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif()
endif()
project(
n-glcpp
LANGUAGES CXX
VERSION 0.0.5)
set(CMAKE_CXX_STANDARD 17)
if (UNIX AND NOT APPLE)
set(CMAKE_MAKE_PROGRAM /usr/bin/ninja CACHE FILEPATH "")
endif()
if(APPLE)
get_property(RULE_LAUNCH_COMPILE GLOBAL PROPERTY RULE_LAUNCH_COMPILE)
if(RULE_LAUNCH_COMPILE AND CMAKE_GENERATOR STREQUAL "Xcode")
# Set up wrapper scripts
configure_file(launch-c.in launch-c)
configure_file(launch-cxx.in launch-cxx)
execute_process(COMMAND chmod a+rx
"${CMAKE_BINARY_DIR}/launch-c"
"${CMAKE_BINARY_DIR}/launch-cxx"
)
# Set Xcode project attributes to route compilation and linking
# through our scripts
set(CMAKE_XCODE_ATTRIBUTE_CC "${CMAKE_BINARY_DIR}/launch-c")
set(CMAKE_XCODE_ATTRIBUTE_CXX "${CMAKE_BINARY_DIR}/launch-cxx")
set(CMAKE_XCODE_ATTRIBUTE_LD "${CMAKE_BINARY_DIR}/launch-c")
set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS "${CMAKE_BINARY_DIR}/launch-cxx")
endif()
endif()
# set(CMAKE_BUILD_TYPE Debug)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
file(COPY resources DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY result.png DESTINATION ${CMAKE_BINARY_DIR})
message(STATUS "Compiler")
message(STATUS " - ID \t: ${CMAKE_CXX_COMPILER_ID}")
message(STATUS " - Version \t: ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS " - Path \t: ${CMAKE_CXX_COMPILER}")
# option(BUILD_SHARED_LIBS OFF)
option(JSONCPP_WITH_TESTS OFF)
option(GLFW_BUILD_DOCS OFF)
option(ASSIMP_BUILD_ZLIB ON)
option(ASSIMP_BUILD_TESTS OFF)
option(ASSIMP_BUILD_ASSIMP_TOOLS OFF)
if(WIN32)
option(ASSIMP_RAPIDJSON_NO_MEMBER_ITERATOR OFF)
endif()
set(ASSIMP_BUILD_ZLIB ON)
#option(ASSIMP_INSTALL ON)
# option(ASSIMP_BUILD_ASSIMP_VIEW OFF)
# option(ASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT ON)
message("GLAD")
add_subdirectory(external/glad/)
message("STB")
add_library(STB_IMAGE "external/stb/stb_image.cpp")
if(WIN32)
message("GLFW")
add_subdirectory(external/glfw/)
message("IMGUI")
add_subdirectory(external/imgui/)
if(MSVC)
message("ASSIMP")
add_subdirectory(external/assimp/)
else()
# find_package(assimp CONFIG REQUIRED)
message("ASSIMP")
add_subdirectory(external/assimp/)
endif()
else()
add_subdirectory(external/imgui/)
add_subdirectory(external/assimp/)
add_subdirectory(external/glfw/)
endif()
message("NFD")
add_subdirectory(external/nfd)
message("jsoncpp")
add_subdirectory(external/jsoncpp)
message("GLM")
add_subdirectory(external/glm/)
add_subdirectory(external/hiredis)
add_subdirectory(src)
add_dependencies (imgui glfw)
add_dependencies(STB_IMAGE imgui)