-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
117 lines (97 loc) · 3.01 KB
/
Copy pathCMakeLists.txt
File metadata and controls
117 lines (97 loc) · 3.01 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
cmake_minimum_required(VERSION 3.22)
project(cs4212StarterCode
VERSION 1.0
LANGUAGES CXX)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")
option(ENABLE_CPPCHECK "Enable static analysis with cppcheck" OFF)
option(ENABLE_CLANG_TIDY "Enable static analysis with clang-tidy" OFF)
if(ENABLE_CPPCHECK)
find_program(CPPCHECK cppcheck)
if(CPPCHECK)
set(CMAKE_CXX_CPPCHECK
${CPPCHECK}
--suppress=missingInclude
--enable=all
--inline-suppr
--inconclusive
-i
${CMAKE_SOURCE_DIR})
else()
message(SEND_ERROR "cppcheck requested but executable not found")
endif()
endif()
if(ENABLE_CLANG_TIDY)
find_program(CLANGTIDY clang-tidy-13)
if(CLANGTIDY)
set(CMAKE_C_CLANG_TIDY ${CLANGTIDY})
set(CMAKE_CXX_CLANG_TIDY ${CLANGTIDY})
else()
message(SEND_ERROR "clang-tidy could not be located.")
endif()
endif()
# Should be using at least C++17, but 20 is better, so
# make sure we switch to 20
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# --------------------------------------------------------------------
# PNG and ZLIB
#
# This macro will attempt to locate the PNG include directories, link directories and libraries. The INCLUDE_DIRECTORIES
# macro adds the resulting include directories to the search path.
# --------------------------------------------------------------------
FIND_PACKAGE(PNG REQUIRED)
if(NOT PNG_FOUND)
message(STATUS "Could not find the PNG Libraries!")
endif(NOT PNG_FOUND)
Include(FetchContent)
# Catch2
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.8.0 # or a later release
)
FetchContent_MakeAvailable(Catch2)
# Boost
# Necessary to get Win32 version to work, plus, not a bad idea to link statically for our purposes.
if(WIN32)
set(Boost_USE_STATIC_LIBS ON)
endif(WIN32)
find_package(Boost REQUIRED COMPONENTS program_options)
if(NOT ${Boost_FOUND})
message(STATUS "Could not find the Boost Libraries!")
endif()
# --------------------------------------------------------------------
# OpenGL Related Components
# --------------------------------------------------------------------
find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED)
find_package(glm CONFIG REQUIRED)
find_package(glfw3 CONFIG REQUIRED)
# not using Vulkan at the moment
# find_package(Vulkan)
# Add the src directory to build the library.
add_subdirectory(src)
# Add my renderlib
#add_subdirectory(renderlib)
# Some examples
add_subdirectory(examples)
#
# Renderer code
#
# Create your rendering library here....
#
# OpenGL Example
#
# This builds a simple OpenGL example that you can use to get started with OpenGL.
#
add_subdirectory(OpenGL)
# add_subdirectory(Vulkan)
#
# Unit Tests - by enabling testing with cmake, we can create a target that lets unit tests be run. After re-building
# yourproject with ENABLE_TESTING called, a make target, called test will be enabled. You can then type
#
# make test
#
enable_testing()
add_subdirectory(utests)