commit
68fceb63c4
5 changed files with 280 additions and 3 deletions
|
@ -11,14 +11,44 @@ endif()
|
||||||
set(BUILD_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/game")
|
set(BUILD_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/game")
|
||||||
set(ASSETS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/assets")
|
set(ASSETS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/assets")
|
||||||
|
|
||||||
option(JAPANESE "Enable the Japanese-language build" OFF)
|
option(JAPANESE "Enable the Japanese-language build (instead of the unofficial Aeon Genesis English translation)" OFF)
|
||||||
option(FIX_BUGS "Fix various bugs in the game" OFF)
|
option(FIX_BUGS "Fix various bugs in the game" OFF)
|
||||||
option(DEBUG_SAVE "Re-enable the ability to drag-and-drop save files onto the window" OFF)
|
option(DEBUG_SAVE "Re-enable the ability to drag-and-drop save files onto the window" OFF)
|
||||||
option(FORCE_LOCAL_LIBS "Compile the built-in versions of SDL2, FreeType, and FLTK instead of using the system-provided ones" OFF)
|
|
||||||
set(RENDERER "SDLTexture" CACHE STRING "Which renderer the game should use: 'OpenGL3' for an OpenGL 3.2 renderer, 'SDLTexture' for SDL2's hardware-accelerated Texture API, 'SDLSurface' for SDL2's software-rendered Surface API, or 'Software' for a handwritten software renderer")
|
set(RENDERER "SDLTexture" CACHE STRING "Which renderer the game should use: 'OpenGL3' for an OpenGL 3.2 renderer, 'SDLTexture' for SDL2's hardware-accelerated Texture API, 'SDLSurface' for SDL2's software-rendered Surface API, or 'Software' for a handwritten software renderer")
|
||||||
|
|
||||||
|
option(WARNINGS "Enable common compiler warnings (for gcc-compatible compilers and MSVC only)" OFF)
|
||||||
|
option(ALL_WARNINGS "Enable ALL compiler warnings (for clang and MSVC only)" OFF)
|
||||||
|
option(FATAL_WARNINGS "Stop compilation on any compiler warning (for gcc-compatible compilers and MSVC only)" OFF)
|
||||||
|
option(FORCE_LOCAL_LIBS "Compile the built-in versions of SDL2, FreeType, and FLTK instead of using the system-provided ones" OFF)
|
||||||
|
|
||||||
project(CSE2 LANGUAGES C CXX)
|
project(CSE2 LANGUAGES C CXX)
|
||||||
|
|
||||||
|
message(STATUS "Compiler ID : ${CMAKE_CXX_COMPILER_ID}")
|
||||||
|
|
||||||
|
# Has to be placed after "project()"
|
||||||
|
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
|
# Using Clang (this is a match so that we also get "AppleClang" which is the Apple-provided Clang
|
||||||
|
set(COMPILER_IS_CLANG true)
|
||||||
|
message(STATUS "Compiling with clang")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
# Using GCC
|
||||||
|
set(COMPILER_IS_GCC true)
|
||||||
|
message(STATUS "Compiling with gcc")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||||
|
# Using Intel C++
|
||||||
|
set(COMPILER_IS_ICC true)
|
||||||
|
message(STATUS "Compiling with ICC")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (COMPILER_IS_CLANG OR COMPILER_IS_GCC OR COMPILER_IS_ICC)
|
||||||
|
set(COMPILER_IS_GCC_COMPATIBLE true)
|
||||||
|
message(STATUS "Compiling with a GCC-compatible compiler")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# Statically-link the CRT (vcpkg static libs do this)
|
# Statically-link the CRT (vcpkg static libs do this)
|
||||||
foreach(flag_var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
foreach(flag_var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||||
|
@ -251,6 +281,60 @@ if(DEBUG_SAVE)
|
||||||
target_compile_definitions(CSE2 PRIVATE DEBUG_SAVE)
|
target_compile_definitions(CSE2 PRIVATE DEBUG_SAVE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (WARNINGS)
|
||||||
|
# HACK : Replace this with CMake provided stuff when possible (when CMake makes avoiding this possible (it isn't currently))
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
# Force to always compile with /W4 on MSVC
|
||||||
|
|
||||||
|
# Can't do this with target_compile_options
|
||||||
|
# if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
||||||
|
# string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
# else()
|
||||||
|
# target_compile_options(CSE2 PRIVATE /W4)
|
||||||
|
# endif()
|
||||||
|
|
||||||
|
target_compile_options(CSE2 PRIVATE /W4)
|
||||||
|
elseif(COMPILER_IS_GCC_COMPATIBLE)
|
||||||
|
target_compile_options(CSE2 PRIVATE -Wall -Wextra -pedantic)
|
||||||
|
else()
|
||||||
|
message(WARNING "Could not activate warnings ! (Unsupported compiler)")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (ALL_WARNINGS)
|
||||||
|
# HACK : Replace this with CMake provided stuff when possible (when CMake makes avoiding this possible (it isn't currently))
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
# Force to always compile with /Wall on MSVC
|
||||||
|
|
||||||
|
# Can't do this with target_compile_options
|
||||||
|
# if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
||||||
|
# string(REGEX REPLACE "/W[0-4]" "/Wall" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
# else()
|
||||||
|
# target_compile_options(CSE2 PRIVATE /Wall)
|
||||||
|
# endif()
|
||||||
|
|
||||||
|
target_compile_options(CSE2 PRIVATE /Wall)
|
||||||
|
elseif(COMPILER_IS_CLANG)
|
||||||
|
target_compile_options(CSE2 PRIVATE -Weverything)
|
||||||
|
else()
|
||||||
|
message(WARNING "Could not activate all warnings ! (Unsupported compiler)")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (FATAL_WARNINGS)
|
||||||
|
# HACK : Replace this with CMake provided stuff when possible (when CMake makes avoiding this possible (it isn't currently))
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
target_compile_options(CSE2 PRIVATE /WX)
|
||||||
|
elseif(COMPILER_IS_GCC_COMPATIBLE)
|
||||||
|
target_compile_options(CSE2 PRIVATE -Werror)
|
||||||
|
else()
|
||||||
|
message(WARNING "Could not activate fatal warnings ! (Unsupported compiler)")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(RENDERER MATCHES "OpenGL3")
|
if(RENDERER MATCHES "OpenGL3")
|
||||||
target_sources(CSE2 PRIVATE "src/Backends/Rendering/OpenGL3.cpp")
|
target_sources(CSE2 PRIVATE "src/Backends/Rendering/OpenGL3.cpp")
|
||||||
elseif(RENDERER MATCHES "SDLTexture")
|
elseif(RENDERER MATCHES "SDLTexture")
|
||||||
|
@ -288,6 +372,9 @@ ExternalProject_Add(bin2h
|
||||||
CMAKE_ARGS
|
CMAKE_ARGS
|
||||||
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
|
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
|
||||||
-DCMAKE_BUILD_TYPE=Release
|
-DCMAKE_BUILD_TYPE=Release
|
||||||
|
-DWARNINGS=${WARNINGS}
|
||||||
|
-DALL_WARNINGS=${ALL_WARNINGS}
|
||||||
|
-DFATAL_WARNINGS=${FATAL_WARNINGS}
|
||||||
INSTALL_COMMAND
|
INSTALL_COMMAND
|
||||||
${CMAKE_COMMAND} --build . --config Release --target install
|
${CMAKE_COMMAND} --build . --config Release --target install
|
||||||
)
|
)
|
||||||
|
@ -432,6 +519,11 @@ endif()
|
||||||
# DoConfig
|
# DoConfig
|
||||||
##
|
##
|
||||||
|
|
||||||
|
# Set warning options for DoConfig
|
||||||
|
set(WARNINGS ${WARNINGS} FORCE BOOL)
|
||||||
|
set(ALL_WARNINGS ${ALL_WARNINGS} FORCE BOOL)
|
||||||
|
set(FATAL_WARNINGS ${FATAL_WARNINGS} FORCE BOOL)
|
||||||
|
|
||||||
add_subdirectory("DoConfig")
|
add_subdirectory("DoConfig")
|
||||||
|
|
||||||
# Name debug builds "DoConfig_debug", to distinguish them
|
# Name debug builds "DoConfig_debug", to distinguish them
|
||||||
|
|
|
@ -12,8 +12,88 @@ option(FORCE_LOCAL_LIBS "Compile the built-in version of FLTK instead of using t
|
||||||
|
|
||||||
project(DoConfig LANGUAGES CXX)
|
project(DoConfig LANGUAGES CXX)
|
||||||
|
|
||||||
|
message(STATUS "Compiler ID : ${CMAKE_CXX_COMPILER_ID}")
|
||||||
|
|
||||||
|
# Has to be placed after "project()"
|
||||||
|
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
|
# Using Clang (this is a match so that we also get "AppleClang" which is the Apple-provided Clang
|
||||||
|
set(COMPILER_IS_CLANG true)
|
||||||
|
message(STATUS "Compiling with clang")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
# Using GCC
|
||||||
|
set(COMPILER_IS_GCC true)
|
||||||
|
message(STATUS "Compiling with gcc")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||||
|
# Using Intel C++
|
||||||
|
set(COMPILER_IS_ICC true)
|
||||||
|
message(STATUS "Compiling with ICC")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (COMPILER_IS_CLANG OR COMPILER_IS_GCC OR COMPILER_IS_ICC)
|
||||||
|
set(COMPILER_IS_GCC_COMPATIBLE true)
|
||||||
|
message(STATUS "Compiling with a GCC-compatible compiler")
|
||||||
|
endif()
|
||||||
|
|
||||||
add_executable(DoConfig "DoConfig.cpp" "icon.rc")
|
add_executable(DoConfig "DoConfig.cpp" "icon.rc")
|
||||||
|
|
||||||
|
if (WARNINGS)
|
||||||
|
# HACK : Replace this with CMake provided stuff when possible (when CMake makes avoiding this possible (it isn't currently))
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
# Force to always compile with /W4 on MSVC
|
||||||
|
|
||||||
|
# Can't do this with target_compile_options
|
||||||
|
# if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
||||||
|
# string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
# else()
|
||||||
|
# target_compile_options(CSE2 PRIVATE /W4)
|
||||||
|
# endif()
|
||||||
|
|
||||||
|
target_compile_options(DoConfig PRIVATE /W4)
|
||||||
|
elseif(COMPILER_IS_GCC_COMPATIBLE)
|
||||||
|
target_compile_options(DoConfig PRIVATE -Wall -Wextra -pedantic)
|
||||||
|
else()
|
||||||
|
message(WARNING "Could not activate warnings ! (Unsupported compiler)")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (ALL_WARNINGS)
|
||||||
|
# HACK : Replace this with CMake provided stuff when possible (when CMake makes avoiding this possible (it isn't currently))
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
# Force to always compile with /Wall on MSVC
|
||||||
|
|
||||||
|
# Can't do this with target_compile_options
|
||||||
|
# if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
||||||
|
# string(REGEX REPLACE "/W[0-4]" "/Wall" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
# else()
|
||||||
|
# target_compile_options(CSE2 PRIVATE /Wall)
|
||||||
|
# endif()
|
||||||
|
|
||||||
|
target_compile_options(DoConfig PRIVATE /Wall)
|
||||||
|
elseif(COMPILER_IS_CLANG)
|
||||||
|
target_compile_options(DoConfig PRIVATE -Weverything)
|
||||||
|
else()
|
||||||
|
message(WARNING "Could not activate all warnings ! (Unsupported compiler)")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (FATAL_WARNINGS)
|
||||||
|
# HACK : Replace this with CMake provided stuff when possible (when CMake makes avoiding this possible (it isn't currently))
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
target_compile_options(DoConfig PRIVATE /WX)
|
||||||
|
elseif(COMPILER_IS_GCC_COMPATIBLE)
|
||||||
|
target_compile_options(DoConfig PRIVATE -Werror)
|
||||||
|
else()
|
||||||
|
message(WARNING "Could not activate fatal warnings ! (Unsupported compiler)")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# Windows tweak
|
# Windows tweak
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set_target_properties(DoConfig PROPERTIES WIN32_EXECUTABLE YES) # Disable the console window
|
set_target_properties(DoConfig PROPERTIES WIN32_EXECUTABLE YES) # Disable the console window
|
||||||
|
|
17
Makefile
17
Makefile
|
@ -43,6 +43,23 @@ ifeq ($(DEBUG_SAVE), 1)
|
||||||
CXXFLAGS += -DDEBUG_SAVE
|
CXXFLAGS += -DDEBUG_SAVE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(WARNINGS), 1)
|
||||||
|
CXXFLAGS += -Wall -Wextra -pedantic
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ALL_WARNINGS), 1)
|
||||||
|
ifneq ($(findstring clang,$(CXX),)
|
||||||
|
# Use clang-specific flag -Weverything
|
||||||
|
CXXFLAGS += -Weverything
|
||||||
|
else
|
||||||
|
@echo Couldn\'t activate all warnings (Unsupported compiler)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(FATAL_WARNINGS), 1)
|
||||||
|
CXXFLAGS += -Werror
|
||||||
|
endif
|
||||||
|
|
||||||
CXXFLAGS += -std=c++98 -MMD -MP -MF $@.d `$(PKG_CONFIG) sdl2 --cflags` `$(PKG_CONFIG) freetype2 --cflags`
|
CXXFLAGS += -std=c++98 -MMD -MP -MF $@.d `$(PKG_CONFIG) sdl2 --cflags` `$(PKG_CONFIG) freetype2 --cflags`
|
||||||
|
|
||||||
ifeq ($(STATIC), 1)
|
ifeq ($(STATIC), 1)
|
||||||
|
|
|
@ -62,11 +62,14 @@ Name | Function
|
||||||
`-DJAPANESE=ON` | Enable the Japanese-language build (instead of the unofficial Aeon Genesis English translation)
|
`-DJAPANESE=ON` | Enable the Japanese-language build (instead of the unofficial Aeon Genesis English translation)
|
||||||
`-DFIX_BUGS=ON` | Fix various bugs in the game
|
`-DFIX_BUGS=ON` | Fix various bugs in the game
|
||||||
`-DDEBUG_SAVE=ON` | Re-enable the ability to drag-and-drop save files onto the window
|
`-DDEBUG_SAVE=ON` | Re-enable the ability to drag-and-drop save files onto the window
|
||||||
`-DFORCE_LOCAL_LIBS=ON` | Compile the built-in versions of SDL2, FreeType, and FLTK instead of using the system-provided ones
|
|
||||||
`-DRENDERER=OpenGL3` | Use the hardware-accelerated OpenGL 3.2 renderer
|
`-DRENDERER=OpenGL3` | Use the hardware-accelerated OpenGL 3.2 renderer
|
||||||
`-DRENDERER=SDLTexture` | Use the hardware-accelerated SDL2 Texture API renderer (default)
|
`-DRENDERER=SDLTexture` | Use the hardware-accelerated SDL2 Texture API renderer (default)
|
||||||
`-DRENDERER=SDLSurface` | Use the software-rendered SDL2 Surface API renderer
|
`-DRENDERER=SDLSurface` | Use the software-rendered SDL2 Surface API renderer
|
||||||
`-DRENDERER=Software` | Use the handwritten software renderer
|
`-DRENDERER=Software` | Use the handwritten software renderer
|
||||||
|
`-DWARNINGS=ON` | Enable common compiler warnings (for gcc-compatible compilers and MSVC only)
|
||||||
|
`-DALL_WARNINGS=ON` | Enable ALL compiler warnings (for clang and MSVC only)
|
||||||
|
`-DFATAL_WARNINGS=ON` | Stop compilation on any compiler warning (for gcc-compatible compilers and MSVC only)
|
||||||
|
`-DFORCE_LOCAL_LIBS=ON` | Compile the built-in versions of SDL2, FreeType, and FLTK instead of using the system-provided ones
|
||||||
|
|
||||||
Then compile CSE2 with this command:
|
Then compile CSE2 with this command:
|
||||||
|
|
||||||
|
@ -92,6 +95,9 @@ Name | Function
|
||||||
`FIX_BUGS=1` | Fix various bugs in the game
|
`FIX_BUGS=1` | Fix various bugs in the game
|
||||||
`WINDOWS=1` | Build for Windows
|
`WINDOWS=1` | Build for Windows
|
||||||
`DEBUG_SAVE=1` | Re-enable the ability to drag-and-drop save files onto the window
|
`DEBUG_SAVE=1` | Re-enable the ability to drag-and-drop save files onto the window
|
||||||
|
`WARNINGS=1` | Enable common warnings
|
||||||
|
`ALL_WARNINGS=1` | Enable ALL warnings (clang/MSVC only)
|
||||||
|
`FATAL_WARNINGS=1` | Make all warnings errors
|
||||||
`RENDERER=OpenGL3` | Use the hardware-accelerated OpenGL 3.2 renderer
|
`RENDERER=OpenGL3` | Use the hardware-accelerated OpenGL 3.2 renderer
|
||||||
`RENDERER=SDLTexture` | Use the hardware-accelerated SDL2 Texture API renderer (default)
|
`RENDERER=SDLTexture` | Use the hardware-accelerated SDL2 Texture API renderer (default)
|
||||||
`RENDERER=SDLSurface` | Use the software-rendered SDL2 Surface API renderer
|
`RENDERER=SDLSurface` | Use the software-rendered SDL2 Surface API renderer
|
||||||
|
|
|
@ -14,6 +14,88 @@ set_target_properties(bin2h PROPERTIES
|
||||||
C_EXTENSIONS OFF
|
C_EXTENSIONS OFF
|
||||||
)
|
)
|
||||||
|
|
||||||
|
message(STATUS "Compiler ID : ${CMAKE_C_COMPILER_ID}")
|
||||||
|
|
||||||
|
# Has to be placed after "project()"
|
||||||
|
if (CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||||
|
# Using Clang (this is a match so that we also get "AppleClang" which is the Apple-provided Clang
|
||||||
|
set(COMPILER_IS_CLANG true)
|
||||||
|
message(STATUS "Compiling with clang")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||||
|
# Using GCC
|
||||||
|
set(COMPILER_IS_GCC true)
|
||||||
|
message(STATUS "Compiling with gcc")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
|
||||||
|
# Using Intel C++
|
||||||
|
set(COMPILER_IS_ICC true)
|
||||||
|
message(STATUS "Compiling with ICC")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (COMPILER_IS_CLANG OR COMPILER_IS_GCC OR COMPILER_IS_ICC)
|
||||||
|
set(COMPILER_IS_GCC_COMPATIBLE true)
|
||||||
|
message(STATUS "Compiling with a GCC-compatible compiler")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (WARNINGS)
|
||||||
|
# HACK : Replace this with CMake provided stuff when possible (when CMake makes avoiding this possible (it isn't currently))
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
# Force to always compile with /W4 on MSVC
|
||||||
|
|
||||||
|
# Can't do this with target_compile_options
|
||||||
|
# if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
||||||
|
# string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
# else()
|
||||||
|
# target_compile_options(CSE2 PRIVATE /W4)
|
||||||
|
# endif()
|
||||||
|
|
||||||
|
target_compile_options(bin2h PRIVATE /W4)
|
||||||
|
elseif(COMPILER_IS_GCC_COMPATIBLE)
|
||||||
|
target_compile_options(bin2h PRIVATE -Wall -Wextra -pedantic)
|
||||||
|
else()
|
||||||
|
message(WARNING "Could not activate warnings ! (Unsupported compiler)")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (ALL_WARNINGS)
|
||||||
|
# HACK : Replace this with CMake provided stuff when possible (when CMake makes avoiding this possible (it isn't currently))
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
# Force to always compile with /Wall on MSVC
|
||||||
|
|
||||||
|
# Can't do this with target_compile_options
|
||||||
|
# if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
||||||
|
# string(REGEX REPLACE "/W[0-4]" "/Wall" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
# else()
|
||||||
|
# target_compile_options(CSE2 PRIVATE /Wall)
|
||||||
|
# endif()
|
||||||
|
|
||||||
|
target_compile_options(bin2h PRIVATE /Wall)
|
||||||
|
elseif(COMPILER_IS_CLANG)
|
||||||
|
target_compile_options(bin2h PRIVATE -Weverything)
|
||||||
|
else()
|
||||||
|
message(WARNING "Could not activate all warnings ! (Unsupported compiler)")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (FATAL_WARNINGS)
|
||||||
|
# HACK : Replace this with CMake provided stuff when possible (when CMake makes avoiding this possible (it isn't currently))
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
target_compile_options(CSE2 PRIVATE /WX)
|
||||||
|
target_compile_options(bin2h PRIVATE /WX)
|
||||||
|
elseif(COMPILER_IS_GCC_COMPATIBLE)
|
||||||
|
target_compile_options(CSE2 PRIVATE -Werror)
|
||||||
|
target_compile_options(bin2h PRIVATE -Werror)
|
||||||
|
else()
|
||||||
|
message(WARNING "Could not activate fatal warnings ! (Unsupported compiler)")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# MSVC tweak
|
# MSVC tweak
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
target_compile_definitions(bin2h PRIVATE _CRT_SECURE_NO_WARNINGS) # Disable warnings that normally fire up on MSVC when using "unsafe" functions instead of using MSVC's "safe" _s functions
|
target_compile_definitions(bin2h PRIVATE _CRT_SECURE_NO_WARNINGS) # Disable warnings that normally fire up on MSVC when using "unsafe" functions instead of using MSVC's "safe" _s functions
|
||||||
|
|
Loading…
Add table
Reference in a new issue