-
-
Notifications
You must be signed in to change notification settings - Fork 93
/
CMakeLists.txt
102 lines (82 loc) · 2.89 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
cmake_minimum_required(VERSION 3.12)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
project(TerraForge3D C CXX)
if(APPLE)
set(EXECUTABLE_NAME "tf3d")
else()
set(EXECUTABLE_NAME "terraforge3d")
endif()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REUIRED True)
set(CMAKE_C_STANDARD 17)
set(CMAKE_C_STANDARD_REUIRED True)
find_package( OpenGL REQUIRED )
set(OPENSSL_USE_STATIC_LIBS TRUE)
find_package(OpenSSL REQUIRED)
include_directories(
./TerraForge3D/include
./TerraForge3D/include/Base
./TerraForge3D/vendor
./TerraForge3D/vendor/tinyexr
./TerraForge3D/vendor/avir
./TerraForge3D/vendor/delaunator/include
./TerraForge3D/vendor/glad/include
./TerraForge3D/vendor/glfw/include
./TerraForge3D/vendor/fmt/include
./TerraForge3D/vendor/glm
./TerraForge3D/vendor/httplib
./TerraForge3D/vendor/imgui
./TerraForge3D/vendor/imgui-node-editor
./TerraForge3D/vendor/json/single_include/nlohmann
./TerraForge3D/vendor/stb
./TerraForge3D/vendor/libpng
${OPENSSL_INCLUDE_DIR}
)
set( GLFW_BUILD_DOCS OFF CACHE BOOL "GLFW lib only" )
set( GLFW_INSTALL OFF CACHE BOOL "GLFW lib only" )
add_subdirectory(./TerraForge3D/vendor/glfw)
add_subdirectory(./TerraForge3D/vendor/glad)
add_subdirectory(./TerraForge3D/vendor/imgui-builder)
add_subdirectory(./TerraForge3D/vendor/libwebp)
add_subdirectory(./TerraForge3D/vendor/fmt)
if( MSVC )
SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:mainCRTStartup" )
endif()
file(GLOB_RECURSE SOURCES
./TerraForge3D/src/**.cpp
./TerraForge3D/src/TerraForge3D.rc
)
# list(APPEND SOURCES ./TerraForge3D/vendor/imgui/backends/imgui_impl_glfw.cpp)
# list(APPEND SOURCES ./TerraForge3D/vendor/imgui/backends/imgui_impl_opengl3.cpp)
add_executable(${EXECUTABLE_NAME} ${SOURCES})
target_link_libraries(${EXECUTABLE_NAME}
glfw
${GLFW_LIBRARIES}
${OPENGL_LIBRARIES}
Glad
ImGui
)
if(WIN32)
target_compile_definitions(${EXECUTABLE_NAME}
PUBLIC _CRT_SECURE_NO_WARNINGS
PUBLIC TERR3D_WIN32
)
endif()
if(APPLE)
target_link_libraries(${EXECUTABLE_NAME} "-framework Security")
endif()
target_link_libraries(${EXECUTABLE_NAME} OpenSSL::SSL)
target_link_libraries(${EXECUTABLE_NAME} OpenSSL::Crypto)
target_link_libraries(${EXECUTABLE_NAME} fmt::fmt)
target_link_libraries(${EXECUTABLE_NAME} webp)
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.12.25835)
set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std:c++latest")
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std:c++latest")
endif()
if( MSVC )
if(${CMAKE_VERSION} VERSION_LESS "3.6.0")
message( "\n\t[ WARNING ]\n\n\tCMake version lower than 3.6.\n\n\t - Please update CMake and rerun; OR\n\t - Manually set 'GLFW-CMake-starter' as StartUp Project in Visual Studio.\n" )
else()
set_property( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT terraforge3d )
endif()
endif()