-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
99 lines (87 loc) · 2.64 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
cmake_minimum_required(VERSION 3.22)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
project(BOX VERSION 0.0.1)
if (APPLE)
add_definitions(-DGL_SILENCE_DEPRECATION)
endif()
# shader
file(COPY ${CMAKE_SOURCE_DIR}/shader DESTINATION ${CMAKE_BINARY_DIR}/Box_artefacts)
add_subdirectory(external/tracktion_engine/modules/juce)
add_subdirectory(external/tracktion_engine/modules)
add_subdirectory(external/raylib)
add_subdirectory(external/googletest)
include_directories(include)
include_directories(external/googletest/googletest/include)
# sources (without main.cc)
file(GLOB_RECURSE SRC_FILES src/*.cc)
list(REMOVE_ITEM SRC_FILES ${CMAKE_SOURCE_DIR}/src/main.cc)
# boxlib
add_library(BoxLib
STATIC
${SRC_FILES})
target_include_directories(BoxLib
PUBLIC
external/tracktion_engine/modules
external/tracktion_engine/modules/juce)
target_link_libraries(BoxLib
PUBLIC
raylib
tracktion::tracktion_engine
juce::juce_core
juce::juce_recommended_config_flags
juce::juce_recommended_warning_flags)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
# atomic
target_link_libraries(BoxLib PUBLIC "-latomic")
# gtk3
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
include_directories(${GTK3_INCLUDE_DIRS})
link_directories(${GTK3_LIBRARY_DIRS})
add_definitions(${GTK3_CFLAGS_OTHER})
# webkit
find_package(PkgConfig REQUIRED)
pkg_check_modules(WEBKIT2 REQUIRED webkit2gtk-4.0)
include_directories(${WEBKIT2_INCLUDE_DIRS})
link_directories(${WEBKIT2_LIBRARY_DIRS})
add_definitions(${WEBKIT2_CFLAGS_OTHER})
# curl
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBCURL REQUIRED libcurl)
include_directories(${LIBCURL_INCLUDE_DIRS})
link_directories(${LIBCURL_LIBRARY_DIRS})
add_definitions(${LIBCURL_CFLAGS_OTHER})
target_link_libraries(BoxLib PRIVATE ${LIBCURL_LIBRARIES})
endif()
# box
juce_add_console_app(Box
PRODUCT_NAME "Box"
NEEDS_WEB_BROWSER FALSE
)
target_sources(Box
PRIVATE
src/main.cc)
target_compile_definitions(Box
PRIVATE
JUCE_WEB_BROWSER=0
JUCE_USE_CURL=0)
target_link_libraries(Box
PRIVATE
BoxLib)
# boxtest
enable_testing()
add_executable(BoxTests
test/test.cc)
target_link_libraries(BoxTests
PRIVATE
BoxLib
gtest
gtest_main)
# Register tests with ctest
add_test(NAME BoxTests COMMAND BoxTests)
# set_tests_properties(BoxTests PROPERTIES CONFIGURATIONS Debug Release)