-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
93 lines (57 loc) · 1.95 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
# Copyright (c) 2022 Sapphire's Suite. All Rights Reserved.
cmake_minimum_required(VERSION 3.16)
# Sapphire Suite's CMake tools.
add_subdirectory(CMake)
# Project
project(SA_Windowing)
SA_ConfigureProject(SA_Windowing)
# Library
## Main
add_library(SA_Windowing INTERFACE)
SA_ConfigureTarget(SA_Windowing LINK INTERFACE)
## Base
add_library(SA_Windowing_Base STATIC)
SA_ConfigureTarget(SA_Windowing_Base)
SA_TargetSources(SA_Windowing_Base
PUBLIC_SRC_DIR "Include/SA/Windowing/Base"
PRIVATE_SRC_DIR "Source/SA/Windowing/Base"
)
### Link dependencies.
target_link_libraries(SA_Windowing_Base PUBLIC SA_Logger SA_Flags SA_Event SA_Maths SA_HI)
### SA_Render target already in build-tree: add link for custom implementations.
if(TARGET SA_Render)
target_link_libraries(SA_Windowing_Base PUBLIC SA_Render)
endif()
### Link to main lib.
target_link_libraries(SA_Windowing INTERFACE SA_Windowing_Base)
# Options
## Add SA_Windowing's tests to build tree.
option(SA_WINDOWING_BUILD_TESTS_OPT "Should build SA_Windowing tests" OFF)
## Add SA_Windowing's sample common to build tree.
option(SA_WINDOWING_SCOMMON_OPT "Should build SA_Windowing sample common" OFF)
## GLFW
option(SA_WINDOWING_GLFW_OPT "Should compile GLFW wrapper" ON)
if(SA_WINDOWING_GLFW_OPT)
# Compile git submodule ThirdParty/glfw instead
#find_package(glfw3 REQUIRED FATAL_ERROR)
add_library(SA_Windowing_GLFW STATIC)
SA_ConfigureTarget(SA_Windowing_GLFW)
SA_TargetSources(SA_Windowing_GLFW
PUBLIC_SRC_DIR "Include/SA/Windowing/GLFW"
PUBLIC_INCL_DIR "OFF"
PRIVATE_SRC_DIR "Source/SA/Windowing/GLFW"
)
target_link_libraries(SA_Windowing_GLFW
PUBLIC SA_Windowing_Base
PRIVATE glfw
)
### Link to main lib.
target_link_libraries(SA_Windowing INTERFACE SA_Windowing_GLFW)
endif()
# Entrypoints
add_subdirectory(ThirdParty)
if(SA_WINDOWING_BUILD_TESTS_OPT OR SA_WINDOWING_SCOMMON_OPT)
### Enable testing for this directory and below.
enable_testing()
add_subdirectory(Tests)
endif()