-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
78 lines (65 loc) · 2.51 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
cmake_minimum_required(VERSION 3.17)
project(visage VERSION 0.1.0)
if (NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif ()
if (APPLE)
enable_language(OBJC)
enable_language(OBJCXX)
endif ()
option(VISAGE_AMALGAMATED_BUILD "Compile sources together" ON)
option(VISAGE_ENABLE_WIDGETS "Add widgets library" ON)
option(VISAGE_ENABLE_BACKGROUND_GRAPHICS_THREAD "Offloads graphics rendering to a background thread" OFF)
set(VISAGE_APPLICATION_NAME ${CMAKE_PROJECT_NAME} CACHE STRING "Application name used for default window title")
if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
option(VISAGE_BUILD_EXAMPLES "Build examples" ON)
option(VISAGE_BUILD_TESTS "Build tests" ON)
option(VISAGE_ENABLE_GRAPHICS_DEBUG_LOGGING "Shows graphics debug log in console in debug mode" ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
else ()
option(VISAGE_BUILD_EXAMPLES "Build examples" OFF)
option(VISAGE_BUILD_TESTS "Build tests" OFF)
option(VISAGE_ENABLE_GRAPHICS_DEBUG_LOGGING "Shows graphics debug log in console in debug mode" OFF)
endif ()
set(VISAGE_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
include(cmake/compile_flags.cmake)
include(cmake/testing_framework.cmake)
function(amalgamate_sources AMALGAMATED_SOURCE FILE_SOURCES)
set(FILE_CONTENTS "// Auto generated amalgamated source.\n")
foreach (FILE ${FILE_SOURCES})
set_source_files_properties("${FILE}" PROPERTIES HEADER_FILE_ONLY TRUE)
set(FILE_CONTENTS "${FILE_CONTENTS}#include \"${FILE}\"\n")
endforeach ()
file(CONFIGURE OUTPUT "${AMALGAMATED_SOURCE}" CONTENT "${FILE_CONTENTS}")
set_source_files_properties("${AMALGAMATED_SOURCE}" PROPERTIES GENERATED TRUE)
endfunction()
add_subdirectory(visage_file_embed)
add_subdirectory(visage_graphics)
add_subdirectory(visage_ui)
add_subdirectory(visage_utils)
add_subdirectory(visage_widgets)
add_subdirectory(visage_windowing)
add_subdirectory(visage_app)
set(DUMMY_FILE ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp)
if (NOT EXISTS ${DUMMY_FILE})
file(WRITE ${DUMMY_FILE} "")
endif ()
add_library(visage STATIC
${DUMMY_FILE}
$<TARGET_OBJECTS:VisageApp>
$<TARGET_OBJECTS:VisageGraphics>
$<TARGET_OBJECTS:VisageUtils>
$<TARGET_OBJECTS:VisageUi>
$<TARGET_OBJECTS:VisageWidgets>
$<TARGET_OBJECTS:VisageWindowing>
)
target_link_libraries(visage
PRIVATE
${VisageGraphicsDependencies}
${VisageWindowingDependencies}
)
target_include_directories(visage SYSTEM PUBLIC ${VISAGE_INCLUDE_PATH})
set_target_properties(visage PROPERTIES FOLDER "visage")
if (VISAGE_BUILD_EXAMPLES)
add_subdirectory(examples)
endif ()