focus/CMakeLists.txt

45 lines
1.6 KiB
Text
Raw Permalink Normal View History

2024-10-16 12:17:51 +02:00
cmake_minimum_required(VERSION 3.21)
project(focus LANGUAGES CXX)
2024-11-25 16:51:35 +01:00
set(CMAKE_CXX_STANDARD 23)
2024-10-16 12:17:51 +02:00
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(SLINT_FEATURE_RENDERER_SKIA ON)
set(SLINT_FEATURE_RENDERER_SOFTWARE ON)
find_package(Slint QUIET)
if (NOT Slint_FOUND)
message("Slint could not be located in the CMake module search path. Downloading it from Git and building it locally")
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.8
SOURCE_SUBDIR api/cpp
)
FetchContent_MakeAvailable(Slint)
endif (NOT Slint_FOUND)
add_executable(focus src/main.cpp)
target_include_directories(focus PRIVATE "external")
2024-10-16 12:17:51 +02:00
target_link_libraries(focus PRIVATE Slint::Slint)
slint_target_sources(
focus ui/app-window.slint
NAMESPACE ui
2024-11-25 16:51:35 +01:00
LIBRARY_PATHS selenite=${CMAKE_CURRENT_SOURCE_DIR}/external/selenite/components/index.slint
2024-10-16 12:17:51 +02:00
)
2024-11-25 16:51:35 +01:00
add_subdirectory(external/selenite/cpp)
target_include_directories(focus PRIVATE "external/selenite/cpp/include")
target_link_libraries(focus PRIVATE selenite)
add_subdirectory(external/rei-json)
target_include_directories(focus PRIVATE "external/rei-json/include")
target_link_libraries(focus PRIVATE rei-json)
2024-10-16 12:17:51 +02:00
# On Windows, copy the Slint DLL next to the application binary so that it's found.
if (WIN32)
add_custom_command(TARGET focus POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:focus> $<TARGET_FILE_DIR:focus> COMMAND_EXPAND_LISTS)
endif()