mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-02 23:55:59 +03:00
style(build): pretty
This commit is contained in:
parent
b0566ad8d7
commit
db75585bb4
@ -1,12 +1,12 @@
|
|||||||
cmake_minimum_required(VERSION 3.1)
|
cmake_minimum_required(VERSION 3.1)
|
||||||
|
|
||||||
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
||||||
message(FATAL_ERROR
|
message(FATAL_ERROR
|
||||||
"In-source builds not allowed.
|
"In-source builds not allowed.
|
||||||
Please make a new directory (called a build directory) and run CMake from there.
|
Please make a new directory (called a build directory) and run CMake from there.
|
||||||
You may need to remove CMakeCache.txt."
|
You may need to remove CMakeCache.txt."
|
||||||
)
|
)
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
# OS variables
|
# OS variables
|
||||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14" CACHE STRING "macOS Deployment Target" FORCE)
|
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14" CACHE STRING "macOS Deployment Target" FORCE)
|
||||||
@ -14,9 +14,9 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14" CACHE STRING "macOS Deployment Target" F
|
|||||||
# Project
|
# Project
|
||||||
project(whoa)
|
project(whoa)
|
||||||
|
|
||||||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||||
set(CMAKE_INSTALL_PREFIX "dist" CACHE PATH "Installation prefix" FORCE)
|
set(CMAKE_INSTALL_PREFIX "dist" CACHE PATH "Installation prefix" FORCE)
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||||
@ -31,52 +31,52 @@ include(lib/system/cmake/system.cmake)
|
|||||||
# Build options
|
# Build options
|
||||||
|
|
||||||
# UBsan
|
# UBsan
|
||||||
set(WHOA_UB_SAN_HELP_TEXT, "Disable/Enable the Undefined Behavior Sanitizer. This is turned on by default in Debug build types. Has no effect when using MSVC.")
|
set(WHOA_UB_SAN_HELP_TEXT "Disable/Enable the Undefined Behavior Sanitizer. This is turned on by default in Debug build types. Has no effect when using MSVC.")
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
option(WHOA_UB_SAN WHOA_UB_SAN_HELP_TEXT 1)
|
option(WHOA_UB_SAN WHOA_UB_SAN_HELP_TEXT 1)
|
||||||
else()
|
else ()
|
||||||
option(WHOA_UB_SAN WHOA_UB_SAN_HELP_TEXT 0)
|
option(WHOA_UB_SAN WHOA_UB_SAN_HELP_TEXT 0)
|
||||||
endif()
|
endif ()
|
||||||
unset(WHOA_UB_SAN_HELP_TEXT)
|
unset(WHOA_UB_SAN_HELP_TEXT)
|
||||||
|
|
||||||
# GLSDL
|
# GLSDL
|
||||||
if(WHOA_SYSTEM_WINDOWS)
|
if (WHOA_SYSTEM_WINDOWS)
|
||||||
# GLSDL can be disabled on Windows to save time
|
# GLSDL can be disabled on Windows to save time
|
||||||
option(WHOA_BUILD_GLSDL "Disable/Enable compilation of the OpenGL/SDL2 graphics rendering device on Windows.", 0)
|
option(WHOA_BUILD_GLSDL "Disable/Enable compilation of the OpenGL/SDL2 graphics rendering device on Windows." 0)
|
||||||
elseif(WHOA_SYSTEM_MAC)
|
elseif (WHOA_SYSTEM_MAC)
|
||||||
# No need for this, we already have a functioning OpenGL rendering device (CGxDeviceGLL)
|
# No need for this, we already have a functioning OpenGL rendering device (CGxDeviceGLL)
|
||||||
set(WHOA_BUILD_GLSDL 0)
|
set(WHOA_BUILD_GLSDL 0)
|
||||||
else()
|
else ()
|
||||||
# Right now GLSDL is the only rendering device for Linux
|
# Right now GLSDL is the only rendering device for Linux
|
||||||
set(WHOA_BUILD_GLSDL 1)
|
set(WHOA_BUILD_GLSDL 1)
|
||||||
endif()
|
endif ()
|
||||||
if (WHOA_BUILD_GLSDL)
|
if (WHOA_BUILD_GLSDL)
|
||||||
add_definitions(-DWHOA_BUILD_GLSDL)
|
add_definitions(-DWHOA_BUILD_GLSDL)
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
# FMOD
|
# FMOD
|
||||||
option(WHOA_BUILD_FMOD "Disable/Enable the use of the FMOD sound API. This introduces a dependency on a proprietary FMOD dynamically linked library." 0)
|
option(WHOA_BUILD_FMOD "Disable/Enable the use of the FMOD sound API. This introduces a dependency on a proprietary FMOD dynamically linked library." 0)
|
||||||
|
|
||||||
# Compiler options
|
# Compiler options
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
# Some templates abuse offsetof
|
# Some templates abuse offsetof
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-offsetof")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-offsetof")
|
||||||
|
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND WHOA_UB_SAN)
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug" AND WHOA_UB_SAN)
|
||||||
# Enable UBsan
|
# Enable UBsan
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
|
||||||
# Allow strange alignments
|
# Allow strange alignments
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize=alignment")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize=alignment")
|
||||||
# Make encountering UB an unrecoverable error
|
# Make encountering UB an unrecoverable error
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize-recover=all")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize-recover=all")
|
||||||
else()
|
else ()
|
||||||
# Disable UBsan completely
|
# Disable UBsan completely
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize=undefined")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize=undefined")
|
||||||
endif()
|
endif ()
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
# OS defines
|
# OS defines
|
||||||
if(WHOA_SYSTEM_WIN)
|
if (WHOA_SYSTEM_WIN)
|
||||||
# Avoid win32 header hell
|
# Avoid win32 header hell
|
||||||
add_compile_definitions(
|
add_compile_definitions(
|
||||||
NOMINMAX
|
NOMINMAX
|
||||||
@ -92,31 +92,31 @@ if(WHOA_SYSTEM_WIN)
|
|||||||
add_definitions(
|
add_definitions(
|
||||||
-D_CRT_SECURE_NO_WARNINGS
|
-D_CRT_SECURE_NO_WARNINGS
|
||||||
)
|
)
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
if(WHOA_SYSTEM_MAC)
|
if (WHOA_SYSTEM_MAC)
|
||||||
# Suppress OpenGL deprecation warnings
|
# Suppress OpenGL deprecation warnings
|
||||||
add_definitions(
|
add_definitions(
|
||||||
-DGL_SILENCE_DEPRECATION
|
-DGL_SILENCE_DEPRECATION
|
||||||
)
|
)
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
# Threads
|
# Threads
|
||||||
if(WHOA_SYSTEM_LINUX OR WHOA_SYSTEM_MAC)
|
if (WHOA_SYSTEM_LINUX OR WHOA_SYSTEM_MAC)
|
||||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
# Library search paths
|
# Library search paths
|
||||||
if(WHOA_SYSTEM_MAC)
|
if (WHOA_SYSTEM_MAC)
|
||||||
set(CMAKE_SKIP_BUILD_RPATH FALSE)
|
set(CMAKE_SKIP_BUILD_RPATH FALSE)
|
||||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||||
set(CMAKE_INSTALL_RPATH "@executable_path")
|
set(CMAKE_INSTALL_RPATH "@executable_path")
|
||||||
elseif(WHOA_SYSTEM_LINUX)
|
elseif (WHOA_SYSTEM_LINUX)
|
||||||
set(CMAKE_SKIP_BUILD_RPATH FALSE)
|
set(CMAKE_SKIP_BUILD_RPATH FALSE)
|
||||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||||
set(CMAKE_INSTALL_RPATH "$ORIGIN")
|
set(CMAKE_INSTALL_RPATH "$ORIGIN")
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
add_subdirectory(lib)
|
add_subdirectory(lib)
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user