-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0656ccd
commit 5afd5c4
Showing
2 changed files
with
34 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Allow user override and multi-configuration generators | ||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) | ||
# Set build type if none was specified, git checkouts default to debug | ||
set(default_build_type "Release") | ||
if(EXISTS "${CMAKE_SOURCE_DIR}/.git") | ||
set(default_build_type "Debug") | ||
endif() | ||
message(STATUS "Setting build type to '${default_build_type}' as none was specified.") | ||
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE) | ||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") | ||
else() | ||
message(STATUS "Build type is set to ${CMAKE_BUILD_TYPE}.") | ||
endif() | ||
|
||
# Ensure needed debugging flags are passed | ||
string(TOLOWER "${CMAKE_BUILD_TYPE}" current_build_type) | ||
if(current_build_type STREQUAL "debug") | ||
add_definitions(-D_DEBUG) | ||
elseif(current_build_type MATCHES "^(release|minsizerel|relwithdebinfo)$") | ||
add_definitions(-DNDEBUG) | ||
endif() | ||
|
||
# Since dkp is disabling default flags, add optimizing here | ||
if(NINTENDO_WII OR NINTENDO_3DS OR NINTENDO_SWITCH) | ||
foreach(lang C CXX ASM) | ||
string(APPEND CMAKE_${lang}_FLAGS_DEBUG " -g -O0") | ||
string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL " -Os") | ||
string(APPEND CMAKE_${lang}_FLAGS_RELEASE " -O3") | ||
string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO " -g -O2") | ||
endforeach() | ||
endif() |