-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
71 lines (55 loc) · 1.54 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
cmake_minimum_required(VERSION 3.8)
project(HMI
VERSION 0.1.0
LANGUAGES CXX C
)
if(NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
endif()
include(GNUInstallDirs)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(SDL2_BUILDING_LIBRARY TRUE)
find_package(SDL2 REQUIRED)
if(MSVC)
message(STATUS "Using MSVC compiler")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DNOMINMAX /W4 /utf-8 /permissive-")
else()
message(STATUS "Using GCC or Clang compiler")
# assume it's a GNU-like compiler (GCC, clang)
set(CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
add_library(hmi0
src/renderer.cc
src/window.cc
src/glad/src/glad.cc
)
target_link_libraries(hmi0
${SDL2_LIBRARY}
)
target_include_directories(hmi0
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PRIVATE
${SDL2_INCLUDE_DIR}
"${CMAKE_CURRENT_SOURCE_DIR}/src/glad/include"
)
add_executable(beman_s_challenge
examples/beman_s_challenge.cc
)
target_link_libraries(beman_s_challenge
hmi0
)
add_executable(test_features
examples/test_features.cc
)
target_link_libraries(test_features
hmi0
)