surtur
46a6cdba3a
All checks were successful
continuous-integration/drone/push Build is passing
cmake: * check if we're being run for valgrind, in which case do not split dwarf information, valgrinds does not like it (see #1). makefile: * build for vagrant into a separate folder entirely. ci: * install gcc, cmake and ninja along with vagrant, since now we are building inside of the ci container as well. close #1
59 lines
2.2 KiB
CMake
59 lines
2.2 KiB
CMake
cmake_minimum_required(VERSION 3.20)
|
|
project(fortuna LANGUAGES CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
if(CMAKE_BUILD_TYPE MATCHES "Debug")
|
|
# Produce debugging information in the operating system's native format.
|
|
# Level 3 includes extra information, such as all the macro definitions
|
|
# present in the program. Some debuggers support macro expansion when you
|
|
# use -g3
|
|
if(NOT CMAKE_CXX_FLAGS MATCHES "-g")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
|
|
endif(NOT CMAKE_CXX_FLAGS MATCHES "-g")
|
|
|
|
if(NOT $ENV{VALGRIND} MATCHES "true")
|
|
# If DWARF debugging information is enabled, separate as much debugging
|
|
# information as possible into a separate output file with the extension
|
|
# .dwo. This option allows the build system to avoid linking files with
|
|
# debug information.
|
|
if(NOT CMAKE_CXX_FLAGS MATCHES "-gsplit-dwarf")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gsplit-dwarf")
|
|
endif(NOT CMAKE_CXX_FLAGS MATCHES "-gsplit-dwarf")
|
|
else()
|
|
message(STATUS "VALGRIND=true, not setting '-gsplit-dwarf'")
|
|
endif(NOT $ENV{VALGRIND} MATCHES "true")
|
|
|
|
if(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
|
endif(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
|
|
|
|
if(NOT CMAKE_CXX_FLAGS MATCHES "-Wextra")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
|
|
endif(NOT CMAKE_CXX_FLAGS MATCHES "-Wextra")
|
|
|
|
if(NOT CMAKE_CXX_FLAGS MATCHES "-Wpedantic")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic")
|
|
endif(NOT CMAKE_CXX_FLAGS MATCHES "-Wpedantic")
|
|
|
|
endif(CMAKE_BUILD_TYPE MATCHES "Debug")
|
|
|
|
if(CMAKE_BUILD_TYPE MATCHES "Release")
|
|
if(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
|
endif(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
|
|
|
|
# Optimize yet more.
|
|
if(NOT CMAKE_CXX_FLAGS MATCHES "-O3")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
|
|
endif(NOT CMAKE_CXX_FLAGS MATCHES "-O3")
|
|
|
|
if(NOT CMAKE_CXX_FLAGS MATCHES "-DNDEBUG")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNDEBUG")
|
|
endif(NOT CMAKE_CXX_FLAGS MATCHES "-DNDEBUG")
|
|
endif(CMAKE_BUILD_TYPE MATCHES "Release")
|
|
|
|
message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
|
|
|
|
add_executable(fortuna main.cpp generator.cpp generator.h)
|