-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
45 lines (36 loc) · 1.3 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
# DEBUG: Debugging flag
# BUILD_TESTS: Tests building flag
cmake_minimum_required(VERSION 2.6)
project(RSRL)
option(USE_CLANG
"Use clang++ to compile" OFF)
if (USE_CLANG)
set(CMAKE_CXX_COMPILER "clang++")
endif (USE_CLANG)
option(DEBUG
"Debug switch" OFF)
if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g")
else (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3 -ffast-math -march=native -DNDEBUG")
endif (DEBUG)
aux_source_directory(./source RSRL_SOURCE)
include_directories(./include)
add_library(RSRL SHARED ${RSRL_SOURCE})
target_link_libraries(RSRL SDL2)
option(BUILD_TESTS
"Determine whether build the tests" OFF)
if (BUILD_TESTS)
add_executable(ColorTest ./tests/ColorTest.cpp)
target_link_libraries(ColorTest RSRL)
add_executable(MatrixTest ./tests/MatrixTest.cpp)
target_link_libraries(MatrixTest RSRL)
add_executable(VectorTest ./tests/VectorTest.cpp)
target_link_libraries(VectorTest RSRL)
add_executable(TextureTest ./tests/TextureTest.cpp)
target_link_libraries(TextureTest RSRL)
add_executable(DrawLineTest ./tests/DrawLineTest.cpp)
target_link_libraries(DrawLineTest RSRL)
add_executable(DrawTriangleTest ./tests/DrawTriangleTest.cpp)
target_link_libraries(DrawTriangleTest RSRL)
endif (BUILD_TESTS)