1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-29 03:33:48 +00:00

set better default compiler options; optional console in release mode on windows

This commit is contained in:
fgenesis 2022-04-08 19:31:16 +02:00
parent b1611d4870
commit 988c8c79e4
5 changed files with 35 additions and 3 deletions

View file

@ -64,8 +64,14 @@ SET(AQUARIA_SRCS
set(EXETYPE) set(EXETYPE)
IF(WIN32) IF(WIN32)
option(AQUARIA_CONSOLE_WINDOW "Enable the console window (always on in debug builds)" FALSE)
if(AQUARIA_CONSOLE_WINDOW OR (CMAKE_BUILD_TYPE STREQUAL "Debug"))
add_definitions(-DAQUARIA_ENABLE_CONSOLE_LOG)
else()
SET(EXETYPE WIN32) SET(EXETYPE WIN32)
endif()
SET(AQUARIA_SRCS ${AQUARIA_SRCS} aquaria.rc) SET(AQUARIA_SRCS ${AQUARIA_SRCS} aquaria.rc)
ENDIF() ENDIF()

View file

@ -158,6 +158,10 @@ DSQ::DSQ(const std::string& fileSystem, const std::string& extraDataDir)
assert(!dsq); assert(!dsq);
dsq = this; dsq = this;
#ifdef AQUARIA_ENABLE_CONSOLE_LOG
this->debugOutputActive = true;
#endif
cutscene_bg = 0; cutscene_bg = 0;
cutscene_text = 0; cutscene_text = 0;
cutscene_text2 = 0; cutscene_text2 = 0;

View file

@ -238,9 +238,11 @@ void Core::debugLog(const std::string &s)
{ {
_logOut << s << std::endl; _logOut << s << std::endl;
} }
#ifdef _DEBUG
std::cout << s << std::endl; #if !defined(_DEBUG)
if(debugOutputActive)
#endif #endif
std::cout << s << std::endl;
} }
static bool checkWritable(const std::string& path, bool warn, bool critical) static bool checkWritable(const std::string& path, bool warn, bool critical)
{ {
@ -345,6 +347,7 @@ Core::Core(const std::string &filesystem, const std::string& extraDataDir, int n
_logOut.open((debugLogPath + "debug.log").c_str()); _logOut.open((debugLogPath + "debug.log").c_str());
debugLogActive = true; debugLogActive = true;
debugOutputActive = false;
debugLogTextures = true; debugLogTextures = true;

View file

@ -420,6 +420,7 @@ public:
float get_current_dt() { return current_dt; } float get_current_dt() { return current_dt; }
bool debugLogActive; bool debugLogActive;
bool debugOutputActive;
void setInputGrab(bool on); void setInputGrab(bool on);
void updateInputGrab(); void updateInputGrab();

View file

@ -16,6 +16,24 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "Haiku")
SET(HAIKU TRUE) SET(HAIKU TRUE)
ENDIF() ENDIF()
# Recommended compiler flags that cmake doesn't set automatically
if(MSVC)
# /MP: parallel builds
# /GS-: disable security cookie (emits calls into vcrt)
# /Oi: enable intrinsic functions
# /fp:fast: -ffast-math
set(AQUARIA_EXTRA_COMPILE_FLAGS "/MP /GS- /Oi /fp:fast" CACHE STRING "Extra compiler flags for MSVC")
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
set(AQUARIA_EXTRA_COMPILE_FLAGS "-ffast-math" CACHE STRING "Extra compiler flags for GCC/Clang")
else()
set(AQUARIA_EXTRA_COMPILE_FLAGS "" CACHE STRING "Extra compiler flags")
endif()
if(AQUARIA_EXTRA_COMPILE_FLAGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${AQUARIA_EXTRA_COMPILE_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${AQUARIA_EXTRA_COMPILE_FLAGS}")
endif()
OPTION(AQUARIA_DEMO_BUILD "Demo Build?" FALSE) OPTION(AQUARIA_DEMO_BUILD "Demo Build?" FALSE)
OPTION(AQUARIA_USE_VFS "Use Virtual File System? Required for some additional features." TRUE) OPTION(AQUARIA_USE_VFS "Use Virtual File System? Required for some additional features." TRUE)