-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathCMakeLists.txt
97 lines (84 loc) · 3.66 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
# This file is part of the Tweeny library.
#
# Copyright (c) 2016-2021 Leonardo Guilherme Lucena de Freitas
# Copyright (c) 2016 Guilherme R. Costa
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# This file specifies an INTERFACE library, allowing you to include Tweeny in your CMake project.
# To use Tweeny in your project, put this folder under your source dir and use `add_subdirectory(tweeny)`. For every
# target that uses tweeny, a simple `target_link_libraries(target tweeny)` is sufficient to set up include and link
# instructions.
cmake_minimum_required(VERSION 3.0...3.28)
cmake_policy(SET CMP0063 NEW)
project(Tweeny LANGUAGES CXX VERSION 3.2.0)
# Setup variables and options
option(TWEENY_BUILD_DOCUMENTATION "Attempts to build the documentation. You'll need doxygen and graphviz installed" OFF)
option(TWEENY_BUILD_SINGLE_HEADER "Joins together all header files in a single one. Needs Python 3.6 and quom installed" OFF)
option(TWEENY_BUILD_SANDBOX "Adds a 'sandbox' target that links to tweeny. Useful when exploring tweeny" OFF)
# The library target
add_library(tweeny INTERFACE)
# Specify the C++ features a compiler should have to use this library.
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
target_compile_features(tweeny
INTERFACE
cxx_auto_type
cxx_variadic_templates
cxx_lambdas
cxx_nullptr
cxx_right_angle_brackets
cxx_static_assert
cxx_template_template_parameters
)
else()
list(APPEND CMAKE_CXX_FLAGS -std=c++11)
endif()
# Set up include directories
target_include_directories(tweeny INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/tweeny>
)
# Set up install
include(GNUInstallDirs)
install(TARGETS tweeny EXPORT TweenyTargets)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tweeny)
# Set up export and config
include(cmake/SetupExports.cmake)
if (TWEENY_BUILD_DOCUMENTATION)
add_subdirectory(doc)
endif()
# This library is a convenience library to force files appear in the IDE properly.
add_library(tweeny-dummy
include/tweeny.h
include/tweeny.tcc
include/tween.h
include/tween.tcc
include/tweenone.tcc
include/tweenpoint.h
include/tweenpoint.tcc
include/tweentraits.h
include/easing.h
include/easingresolve.h
include/int2type.h
include/dispatcher.h)
set_target_properties(tweeny-dummy PROPERTIES LINKER_LANGUAGE CXX EXCLUDE_FROM_ALL TRUE)
if (TWEENY_BUILD_SINGLE_HEADER)
include(cmake/GenerateSingleHeader.cmake)
endif()
if (TWEENY_BUILD_SANDBOX)
add_executable(sandbox src/sandbox.cc)
target_link_libraries(sandbox tweeny)
endif()