-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
140 lines (120 loc) · 3.65 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
cmake_minimum_required(VERSION 3.12)
project(DevTrack VERSION 1.0)
# Set CMake toolchain file for vcpkg
set(CMAKE_TOOLCHAIN_FILE "C:/vcpkg/scripts/buildsystems/vcpkg.cmake")
# Set C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Add vcpkg library path
list(APPEND CMAKE_PREFIX_PATH "C:/vcpkg/installed/x64-windows")
# Find required packages
find_package(SQLite3 REQUIRED)
find_package(OpenGL REQUIRED)
find_package(glfw3 CONFIG REQUIRED)
find_package(GLEW CONFIG REQUIRED)
find_package(imgui CONFIG REQUIRED)
find_package(spdlog CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
find_package(Threads REQUIRED)
# Manually specify ImGui include paths
set(IMGUI_INCLUDE_DIRS
"C:/vcpkg/installed/x64-windows/include"
"C:/vcpkg/installed/x64-windows/include/imgui"
)
# Add include directories
include_directories(
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/external
${CMAKE_SOURCE_DIR}/external/imgui
${SQLITE3_INCLUDE_DIRS}
${IMGUI_INCLUDE_DIRS}
"C:/vcpkg/installed/x64-windows/include"
"C:/vcpkg/installed/x64-windows/include/imgui"
)
# Discover source files dynamically
file(GLOB_RECURSE SOURCES
"${CMAKE_SOURCE_DIR}/src/*.cpp"
)
# Remove main.cpp from library sources
list(REMOVE_ITEM SOURCES "${CMAKE_SOURCE_DIR}/src/main.cpp")
# Ensure ImGui backend files are included
set(IMGUI_BACKEND_SOURCES
"${CMAKE_SOURCE_DIR}/external/imgui/backends/imgui_impl_glfw.cpp"
"${CMAKE_SOURCE_DIR}/external/imgui/backends/imgui_impl_opengl3.cpp"
)
# Ensure core ImGui files are included
set(IMGUI_CORE_SOURCES
"${CMAKE_SOURCE_DIR}/external/imgui/imgui.cpp"
"${CMAKE_SOURCE_DIR}/external/imgui/imgui_draw.cpp"
"${CMAKE_SOURCE_DIR}/external/imgui/imgui_demo.cpp"
"${CMAKE_SOURCE_DIR}/external/imgui/imgui_tables.cpp"
"${CMAKE_SOURCE_DIR}/external/imgui/imgui_widgets.cpp"
)
# Create DevTrack library
add_library(DevTrackLib STATIC
${SOURCES}
${IMGUI_BACKEND_SOURCES}
${IMGUI_CORE_SOURCES}
)
# Link library dependencies
target_link_libraries(DevTrackLib
${SQLITE3_LIBRARIES}
OpenGL::GL
glfw
GLEW::GLEW
imgui::imgui
spdlog::spdlog
nlohmann_json::nlohmann_json
Threads::Threads
)
# Create main executable
add_executable(DevTrack
"${CMAKE_SOURCE_DIR}/src/main.cpp"
)
# Link main executable to library
target_link_libraries(DevTrack
DevTrackLib
SQLite::SQLite3
)
# Copy required DLLs to output directory
add_custom_command(TARGET DevTrack POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"C:/vcpkg/installed/x64-windows/bin/glew32.dll"
$<TARGET_FILE_DIR:DevTrack>
)
add_custom_command(TARGET DevTrack POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"C:/vcpkg/installed/x64-windows/bin/spdlog.dll"
$<TARGET_FILE_DIR:DevTrack>
)
add_custom_command(TARGET DevTrack POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"C:/vcpkg/installed/x64-windows/bin/fmt.dll"
$<TARGET_FILE_DIR:DevTrack>
)
add_custom_command(TARGET DevTrack POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"C:/vcpkg/installed/x64-windows/bin/sqlite3.dll"
$<TARGET_FILE_DIR:DevTrack>
)
# Add subdirectories
add_subdirectory(src)
# Temporarily disable tests while testing delete functionality
#add_subdirectory(tests)
# Optional: Add testing
#enable_testing()
#find_package(GTest CONFIG REQUIRED)
# Add test executable
#add_executable(DevTrackTests
# tests/project_tests.cpp
# tests/project_manager_tests.cpp
#)
# Link test executable
#target_link_libraries(DevTrackTests
# GTest::gtest_main
# DevTrackLib
# SQLite::SQLite3
#)
# Discover tests
#include(GoogleTest)
#gtest_discover_tests(DevTrackTests)