-
Notifications
You must be signed in to change notification settings - Fork 9
/
CMakeLists.txt
68 lines (54 loc) · 1.67 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
cmake_minimum_required(VERSION 3.12)
project(Candle)
# set C++11 standard
set(CMAKE_CXX_STANDARD 11)
# set output files directories
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY lib)
# might need to set manually SFML_ROOT to the install location of SFML for Windows users
# set(SFML_ROOT "")
if(SFML_ROOT STREQUAL "")
find_package(SFML 2.5 REQUIRED COMPONENTS graphics)
endif()
# if the user wants to use static SFML libs
# set(SFML_STATIC_LIBRARIES TRUE)
set(CANDLE_HEADERS
include/Candle/LightingArea.hpp
include/Candle/LightSource.hpp
include/Candle/RadialLight.hpp
include/Candle/DirectedLight.hpp
include/Candle/geometry/Line.hpp
include/Candle/geometry/Polygon.hpp
include/Candle/geometry/Vector2.hpp
include/Candle/graphics/Color.hpp
include/Candle/graphics/VertexArray.hpp
include/Candle/Constants.hpp
)
set(CANDLE_SRC
src/LightingArea.cpp
src/LightSource.cpp
src/RadialLight.cpp
src/DirectedLight.cpp
src/Line.cpp
src/Polygon.cpp
src/Color.cpp
src/VertexArray.cpp
src/Constants.cpp
)
# Static library target
add_library(Candle-s STATIC ${CANDLE_SRC} ${CANDLE_HEADERS})
target_include_directories(Candle-s PUBLIC include)
target_link_libraries(Candle-s sfml-graphics)
option(RADIAL_LIGHT_FIX "Use RadialLight fix for errors with textures" OFF)
if(RADIAL_LIGHT_FIX)
target_compile_definitions(Candle-s PUBLIC -DRADIAL_LIGHT_FIX)
endif()
# Demo target
option(BUILD_DEMO "Build demo application" OFF)
if (BUILD_DEMO)
set(DEMO_SRC demo.cpp)
add_executable(demo ${DEMO_SRC})
target_include_directories(demo PRIVATE include)
target_link_libraries(demo PRIVATE sfml-graphics Candle-s)
endif()