aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: ad2bf1657152cca65e3b08942106b42b6df3cd04 (plain)
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
cmake_minimum_required(VERSION 3.13)
project(ProjectBrussel LANGUAGES C CXX)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

find_package(OpenGL REQUIRED)
add_subdirectory(3rdparty/glfw)
add_subdirectory(3rdparty/glm)
add_subdirectory(3rdparty/imgui)
add_subdirectory(3rdparty/imguicolortextedit)
add_subdirectory(3rdparty/tracy)

# add_executable requires at least one source file
add_executable(${PROJECT_NAME} dummy.c)
add_subdirectory(source)

set_target_properties(${PROJECT_NAME} PROPERTIES
	UNITY_BUILD_MODE BATCH
	UNITY_BUILD_UNIQUE_ID "${PROJECT_NAME}_UNITY_ID"
)

target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20)
set_target_properties(${PROJECT_NAME} PROPERTIES
	CXX_STANDARD_REQUIRED ON
	CXX_EXTENSIONS OFF
)

target_compile_definitions(${PROJECT_NAME} PRIVATE
	RAPIDJSON_HAS_STDSTRING=1
	IMGUI_DISABLE_OBSOLETE_FUNCTIONS
	BRUSSEL_DEV_ENV=1
)

target_include_directories(${PROJECT_NAME} PRIVATE
	sources
)

target_link_libraries(${PROJECT_NAME} PRIVATE
	${CONAN_LIBS}
	OpenGL::GL
	glfw
	glm::glm
	imgui
	ImGuiColorTextEdit
	tracy
)

option(BRUSSEL_ENABLE_PROFILING "Whether profiling support is enabled or not." OFF)
if(BRUSSEL_ENABLE_PROFILING)
	target_compile_definitions(${PROJECT_NAME}
	PRIVATE
		TRACY_ENABLE
	)
endif()

option(BRUSSEL_ENABLE_EDITOR "Enable editor support or not." ON)
if(BRUSSEL_ENABLE_EDITOR)
	target_compile_definitions(${PROJECT_NAME}
	PRIVATE
		BRUSSEL_ENABLE_EDITOR=1
	)
endif()

option(BRUSSEL_ENABLE_ASAN "Enable AddressSanitizer or not." OFF)
if(BRUSSEL_ENABLE_ASAN)
	target_compile_options(${PROJECT_NAME}
	PRIVATE
		-fsanitize=address
		-fno-omit-frame-pointer
	)
	target_link_options(${PROJECT_NAME}
	PRIVATE
		-fsanitize=address
		-fno-omit-frame-pointer
	)
endif()