-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
73 lines (57 loc) · 2.19 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
cmake_minimum_required(VERSION 3.27)
# Project Options
project(GUI_Playground
DESCRIPTION "Testing various GUI tools for future inclusion in Argo"
VERSION 0.0.1
LANGUAGES CXX C
)
SET(OPTS_USE_OPENGL ON)
SET(OPTS_USE_SLINT ON)
# End options
set(CMAKE_CXX_STANDARD 23)
add_executable(GUI_Playground
main.cpp
ConsoleMenu.cpp
ConsoleMenu.hpp
)
if (OPTS_USE_OPENGL)
target_compile_definitions(${PROJECT_NAME} PRIVATE OPTS_USE_OPENGL)
TARGET_SOURCES(
${PROJECT_NAME} PRIVATE
opengl/imguiRenderer.cpp
)
find_package(OpenGL REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE OpenGL::GL)
find_package(glad CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE glad::glad)
find_package(glfw3 CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE glfw)
find_package(glm CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE glm::glm)
find_package(imgui CONFIG REQUIRED)
target_include_directories(${PROJECT_NAME} PRIVATE ${IMGUI_INCLUDE_DIR})
target_link_libraries(${PROJECT_NAME} PRIVATE imgui::imgui)
endif ()
if (OPTS_USE_SLINT)
target_compile_definitions(${PROJECT_NAME} PRIVATE OPTS_USE_SLINT)
TARGET_SOURCES(
${PROJECT_NAME} PRIVATE
slint/SlintRenderer.cpp slint/SlintRenderer.hpp
)
include(FetchContent)
FetchContent_Declare(
Slint
GIT_REPOSITORY https://github.com/slint-ui/slint.git
# `release/1` will auto-upgrade to the latest Slint >= 1.0.0 and < 2.0.0
# `release/1.0` will auto-upgrade to the latest Slint >= 1.0.0 and < 1.1.0
GIT_TAG release/1
SOURCE_SUBDIR api/cpp
)
FetchContent_MakeAvailable(Slint)
target_link_libraries(${PROJECT_NAME} PRIVATE Slint::Slint)
slint_target_sources(${PROJECT_NAME} slint/MainWindow.slint)
# On Windows, copy the Slint DLL next to the application binary so that it's found.
if (WIN32)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:GUI_Playground> $<TARGET_FILE_DIR:GUI_Playground> COMMAND_EXPAND_LISTS)
endif()
endif ()