-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
82 lines (68 loc) · 2.24 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
cmake_minimum_required(VERSION 3.28)
# Nom du projet
project(opengl_tests)
# Définir le standard C++
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Ajouter les fichiers sources
set(SOURCES
src/main.cpp
src/Engine/Shader.cpp
src/Game/Block.cpp
src/Game/Block.h
src/Game/Chunk.cpp
src/Game/Chunk.h
src/Game/World.cpp
src/Game/World.h
src/tools/Color.cpp
src/tools/Color.h
src/GlTries/glTests.cpp
src/GlTries/glTests.h
src/Game/Game.cpp
src/Game/Game.h
src/Engine/Renderer.cpp
src/Engine/Renderer.h
src/GlTries/RendererTests.cpp
src/GlTries/RendererTests.h
src/tools/idk.cpp
src/Engine/Window.cpp
src/Engine/Window.h
src/Engine/Camera.cpp
src/Engine/Camera.h
src/Engine/Texture.cpp
src/Engine/Texture.h
src/Engine/Mesh.cpp
src/Engine/Mesh.h
)
# Créer l'exécutable
add_executable(opengl_tests ${SOURCES})
#OpenGL and link
find_package(OpenGL REQUIRED)
target_link_libraries(opengl_tests PRIVATE ${OPENGL_LIBRARIES})
# Find and link GLEW
find_package(GLEW REQUIRED)
target_link_libraries(opengl_tests PRIVATE GLEW::GLEW)
# Find and link GLFW
find_package(glfw3 REQUIRED)
target_link_libraries(opengl_tests PRIVATE glfw)
## Find and link GLAD
#find_package(GLAD REQUIRED)
#target_link_libraries(opengl_tests PRIVATE glad)
# Inclure les répertoires d'en-têtes trouvés
#include_directories(${OPENGL_INCLUDE_DIRS} ${GLEW_INCLUDE_DIRS})
# Include directories
target_include_directories(opengl_tests PRIVATE ${OPENGL_INCLUDE_DIRS} ${GLEW_INCLUDE_DIRS} ${GLFW_INCLUDE_DIRS})
#plus besoin
# Lier les bibliothèques nécessaires
#target_link_libraries(opengl_tests ${OPENGL_LIBRARIES} GLEW::GLEW GLFW3::GLFW3 opengl32 user32 gdi32)
if (DEBUG_LEVEL)
add_definitions(-DDEBUG_LEVEL=${DEBUG_LEVEL})
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_EXE_LINKER_FLAGS -static)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s -Os")
endif()
# Copier les shaders
add_custom_command(TARGET opengl_tests POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/Resources $<TARGET_FILE_DIR:opengl_tests>/Resources)