forked from kablouser/PlatinumEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
93 lines (86 loc) · 3.09 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
#-----------------------------
# Initialising stuff
#-----------------------------
cmake_minimum_required(VERSION 3.21)
project(PlatinumEngine LANGUAGES CXX VERSION 0.0.1)
set(CMAKE_CXX_STANDARD 14)
# static libraries please
set(BUILD_SHARED_LIBS FALSE)
# FetchContent to fetch git repos remotely
include(FetchContent)
# enable CTest
enable_testing()
#-----------------------------
#-----------------------------
# External libraries from git repos
#-----------------------------
# SFML
set(SFML_USE_STATIC_STD_LIBS TRUE)
FetchContent_Declare(sfml GIT_REPOSITORY https://github.com/SFML/SFML.git GIT_TAG 2.5.1)
FetchContent_MakeAvailable(sfml)
#-----------------------------
# Dear ImGui
FetchContent_Declare(imgui GIT_REPOSITORY https://github.com/ocornut/imgui.git GIT_TAG v1.86)
FetchContent_MakeAvailable(imgui)
#-----------------------------
# imgui-SFML
# This was so painful to figure out! Never forget.
set(IMGUI_SFML_FIND_SFML FALSE)
set(IMGUI_DIR "${CMAKE_BINARY_DIR}/_deps/imgui-src")
FetchContent_Declare(imgui_sfml GIT_REPOSITORY https://github.com/eliasdaler/imgui-sfml.git GIT_TAG v2.5)
FetchContent_MakeAvailable(imgui_sfml)
#-----------------------------
# GLM
FetchContent_Declare(glm GIT_REPOSITORY https://github.com/g-truc/glm.git GIT_TAG 0.9.9.8)
FetchContent_MakeAvailable(glm)
#-----------------------------
# assimp
set(ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT FALSE)
set(ASSIMP_BUILD_OBJ_IMPORTER TRUE)
set(ASSIMP_BUILD_FBX_IMPORTER TRUE)
set(ASSIMP_BUILD_BLEND_IMPORTER TRUE)
set(ASSIMP_NO_EXPORT TRUE)
set(ASSIMP_BUILD_TESTS FALSE)
FetchContent_Declare(assimp GIT_REPOSITORY https://github.com/assimp/assimp.git GIT_TAG 5.2.0)
FetchContent_MakeAvailable(assimp)
#-----------------------------
# Catch2 - testing framework
set(CATCH_BUILD_STATIC_LIBRARY TRUE)
FetchContent_Declare(Catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2.git GIT_TAG v2.13.8)
FetchContent_MakeAvailable(Catch2)
#-----------------------------
# Add more libraries from git repos here:
#-----------------------------
#-----------------------------
# IMPORTANT SECTION! Source code
#-----------------------------
# Add source code files below:
add_executable(${PROJECT_NAME}
Source/main.cpp
Source/InputManager/InputManager.cpp
Source/RasterRenderer/RasterRenderer.cpp
Source/SceneManager/SceneManager.cpp)
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_LIST_DIR}/Include")
#-----------------------------
#-----------------------------
# IMPORTANT SECTION! Unit testing
#-----------------------------
# Add unit tests here:
add_executable(tests
Test/TestTemplate.cpp)
#-----------------------------
#-----------------------------
# Linking libraries
#-----------------------------
# list of libraries we're using in the main engine
set(PROJECT_LIBRARIES
# good luck trying to find these names and trying to match them
# CMake is so stupid
"sfml-audio;sfml-graphics;sfml-system;sfml-window;"
"ImGui-SFML;"
"glm;"
"assimp;")
# different targets
target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_LIBRARIES})
target_link_libraries(tests PRIVATE ${PROJECT_LIBRARIES} Catch2::Catch2WithMain)
#-----------------------------