-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
54 lines (43 loc) · 1.72 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
cmake_minimum_required(VERSION 3.15)
project(ParticleSimulation)
# Set C standard
set(CMAKE_C_STANDARD 11)
# Add C++ standard since ImGui is C++
set(CMAKE_CXX_STANDARD 11)
# Define source files
set(SOURCE_FILES src/main.c src/camera.c src/world.c src/grid.c src/shader.c src/particle_system.c src/ui.cpp src/hud.cpp)
# Add GLFW as a subdirectory (assuming GLFW is in external/glfw)
add_subdirectory(external/glfw)
# Add GLAD
add_library(glad external/glad/src/glad.c)
target_include_directories(glad PUBLIC external/glad/include)
# Add cglm as a subdirectory
add_subdirectory(external/cglm)
# Create ImGui library
add_library(imgui STATIC
${CMAKE_SOURCE_DIR}/external/imgui/imgui.cpp
${CMAKE_SOURCE_DIR}/external/imgui/imgui_demo.cpp
${CMAKE_SOURCE_DIR}/external/imgui/imgui_draw.cpp
${CMAKE_SOURCE_DIR}/external/imgui/imgui_tables.cpp
${CMAKE_SOURCE_DIR}/external/imgui/imgui_widgets.cpp
${CMAKE_SOURCE_DIR}/external/imgui/backends/imgui_impl_glfw.cpp
${CMAKE_SOURCE_DIR}/external/imgui/backends/imgui_impl_opengl3.cpp
)
target_include_directories(imgui PUBLIC
${CMAKE_SOURCE_DIR}/external/imgui
${CMAKE_SOURCE_DIR}/external/imgui/backends
${CMAKE_SOURCE_DIR}/external/glfw/include
)
# Link ImGui with GLFW
target_link_libraries(imgui PUBLIC glfw)
# Add executable and link libraries
add_executable(main ${SOURCE_FILES})
target_link_libraries(main glfw glad cglm imgui opengl32)
# Set the output directory for the executable to the project root
set_target_properties(main PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR})
# Include directories
target_include_directories(main PRIVATE
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/external/imgui
${CMAKE_SOURCE_DIR}/external/imgui/backends
)