summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: 19d36797e2e188e07bcc85feeb5096a20ac854bf (plain) (blame)
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
cmake_minimum_required(VERSION 3.21)

project(
	bowshock

	VERSION 0.10.0
	HOMEPAGE_URL "https://mandelbrot.dk/bowshock"
	LANGUAGES C
)

function(target_enable_warnings TARGET)
	if("${CMAKE_C_COMPILER_ID}" MATCHES "Clang|GNU")
		target_compile_options(
			${TARGET} PRIVATE

			-Wall
			-Wextra
		)
	elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
		target_compile_options(
			${TARGET} PRIVATE

			/W4
		)
	endif()
endfunction()

function(target_enable_optimisations TARGET)
	if("${CMAKE_C_COMPILER_ID}" MATCHES "Clang|GNU")
		if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
			target_compile_options(
				${TARGET} PRIVATE

				-Og
			)
		else()
			target_compile_options(
				${TARGET} PRIVATE

				-Ofast
			)
		endif()
	elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
		target_compile_options(
			${TARGET} PRIVATE

			/O2
		)

		if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
			target_compile_options(
				${TARGET} PRIVATE

				/Zo
			)
		endif()
	endif()
endfunction()

if("${CMAKE_C_COMPILER_ID}" MATCHES "Clang|GNU")
	add_compile_options(
		-fdiagnostics-color=always
	)
endif()

add_subdirectory(bowshock)
add_subdirectory(glad)