aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: 07f3249241ef4662b16bedfbe87c67bafee65285 (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
cmake_minimum_required(VERSION 3.18)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

project(blockgame_linux)

include_directories(
    src
    /usr/include/freetype2
)

message (STATUS "Running protobuf precompiler")
execute_process (
    COMMAND protoc --proto_path=src/shared/net/lib/protobuf
        --cpp_out=src/shared/net/lib/protobuf/
        src/shared/net/lib/protobuf/net.proto
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

file (GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS
    "src/*.cc"
)
add_executable(blockgame_linux
    ${SOURCE_FILES}
)

target_compile_options(blockgame_linux PRIVATE
    -Wall -Wextra -Wshadow -Wdouble-promotion -Wformat=2 -Wundef -fno-common
    -Wconversion -Wpedantic -std=c++20 -g3

    -O2
    #debug
    #-fstack-protector-strong -fno-omit-frame-pointer #fsanitize=undefined

    -Wno-exceptions # noexcept + throw is not an error

    # not turning off shadow just so gcc compiling looks good, these are ok
    -Wno-missing-field-initializers -Wno-unknown-pragmas
)

target_link_libraries(blockgame_linux PRIVATE
    SDL2
    epoxy
    pthread
    freetype
    assimp
    protobuf
    boost_iostreams
    sqlite3
    jemalloc
)

target_link_options(blockgame_linux PRIVATE
    #debug
    #-fstack-protector-strong -fsanitize=undefined
)