forked from aseprite/laf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
86 lines (72 loc) · 2.44 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
# LAF
# Copyright (C) 2019-2020 Igara Studio S.A.
# Copyright (C) 2016-2018 David Capello
cmake_minimum_required(VERSION 3.2)
# We need to add the -MT flag for MSVC because we compile Skia with
# the static version of the libc runtime
set(CMAKE_USER_MAKE_RULES_OVERRIDE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/c_flag_overrides.cmake)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cxx_flag_overrides.cmake)
project(laf C CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Search in the "cmake" directory for additional CMake modules.
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# Options
set(LAF_LIST_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "Root LAF CMakeLists.txt file location")
set(LAF_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE INTERNAL "Root location of LAF binary files")
if(SKIA_DIR)
set(LAF_DEFAULT_BACKEND "skia")
else()
set(LAF_DEFAULT_BACKEND "none")
endif()
option(LAF_WITH_EXAMPLES "Enable LAF examples" ON)
option(LAF_WITH_TESTS "Enable LAF tests" ON)
set(LAF_BACKEND ${LAF_DEFAULT_BACKEND} CACHE STRING "Select laf backend")
set_property(CACHE LAF_BACKEND PROPERTY STRINGS "none" "skia")
if(NOT APPLE AND UNIX)
option(LAF_OS_WITH_GTK "Use GTK library for native dialogs" OFF)
endif()
# Testing
if(LAF_WITH_TESTS)
enable_testing()
include(LafFindTests)
endif()
# Find libraries
if(LAF_BACKEND STREQUAL "skia")
include(FindSkia)
else()
if(NOT FREETYPE_LIBRARIES)
find_package(Freetype)
endif()
if(NOT HARFBUZZ_LIBRARIES)
find_package(HarfBuzz)
endif()
endif()
add_subdirectory(third_party)
add_subdirectory(base)
add_subdirectory(gfx)
if(FREETYPE_LIBRARIES AND HARFBUZZ_LIBRARIES)
add_subdirectory(ft)
endif()
add_subdirectory(os)
if(LAF_WITH_EXAMPLES)
add_subdirectory(examples)
endif()
if(LAF_BACKEND STREQUAL "skia")
target_compile_definitions(laf-base PUBLIC LAF_SKIA)
endif()
# Information
message(STATUS "laf backend: ${LAF_BACKEND}")
message(STATUS "laf pixman: ${PIXMAN_LIBRARY}")
message(STATUS "laf freetype: ${FREETYPE_LIBRARIES}")
message(STATUS "laf harfbuzz: ${HARFBUZZ_LIBRARIES}")
if(LAF_BACKEND STREQUAL "skia")
message(STATUS "skia dir: ${SKIA_DIR}")
message(STATUS "skia library: ${SKIA_LIBRARY}")
message(STATUS "skia library dir: ${SKIA_LIBRARY_DIR}")
if(NOT SKIA_DIR OR
NOT SKIA_LIBRARY OR
NOT SKIA_LIBRARY_DIR)
message(FATAL_ERROR "set SKIA_DIR/SKIA_LIBRARY/SKIA_LIBRARY_DIR to compile w/skia backend")
endif()
endif()