Win32 fix; enabled LTCG for MSVC Release builds

This commit is contained in:
Jack Andersen 2016-01-14 19:44:42 -10:00
parent 1f86c82165
commit 399a48ece3
3 changed files with 13 additions and 7 deletions

View File

@ -4,12 +4,22 @@ project(PathShagged)
if(MSVC) if(MSVC)
# Shaddup MSVC # Shaddup MSVC
add_definitions(-DUNICODE=1 -D_UNICODE=1 -D__SSE__=1 -D_CRT_SECURE_NO_WARNINGS=1 -DD_SCL_SECURE_NO_WARNINGS=1 /wd4267 /wd4244 /wd4305) add_definitions(-DUNICODE=1 -D_UNICODE=1 -D__SSE__=1 -D_CRT_SECURE_NO_WARNINGS=1 -DD_SCL_SECURE_NO_WARNINGS=1 /wd4267 /wd4244 /wd4305)
# Link-time Code Generation for Release builds
set(CMAKE_C_FLAGS_RELEASE "/DNDEBUG /O2 /Oy /GL /Gy /MD")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/DNDEBUG /Zi /O2 /Oy- /GL /Gy /MD")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/DEBUG /RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:cv,fixup")
else() else()
if (CMAKE_COMPILER_IS_GNUCXX) if (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
message(WARNING "GCC needs -fpermissive for nested type redeclarations; expect lotsa warnings!!") message(WARNING "GCC needs -fpermissive for nested type redeclarations; expect lotsa warnings!!")
endif() endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wno-multichar -fno-exceptions") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wno-multichar -fno-exceptions")
endif() endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")

View File

@ -131,26 +131,22 @@ Space* Space::NewSpaceFromConfigStream(ViewManager& vm, Space* parent, ConfigRea
{ {
#ifdef URDE_BINARY_CONFIGS #ifdef URDE_BINARY_CONFIGS
Class cls = Class(r.readUint32Big()); Class cls = Class(r.readUint32Big());
return BuildNewSpace(vm, cls, parent, r);
#else #else
Class cls = Class(r.readUint32("class")); Class cls = Class(r.readUint32("class"));
return BuildNewSpace(vm, cls, parent, r);
#endif #endif
return BuildNewSpace(vm, cls, parent, r);
} }
RootSpace* Space::NewRootSpaceFromConfigStream(ViewManager& vm, ConfigReader& r) RootSpace* Space::NewRootSpaceFromConfigStream(ViewManager& vm, ConfigReader& r)
{ {
#ifdef URDE_BINARY_CONFIGS #ifdef URDE_BINARY_CONFIGS
Class cls = Class(r.readUint32Big()); Class cls = Class(r.readUint32Big());
if (cls != Class::RootSpace)
return nullptr;
return BuildNewSpace(vm, cls, r);
#else #else
Class cls = Class(r.readUint32("class")); Class cls = Class(r.readUint32("class"));
#endif
if (cls != Class::RootSpace) if (cls != Class::RootSpace)
return nullptr; return nullptr;
return new RootSpace(vm, r); return new RootSpace(vm, r);
#endif
} }
} }

View File

@ -88,7 +88,7 @@ public:
{ {
m_state.read(r); m_state.read(r);
#ifdef URDE_BINARY_CONFIGS #ifdef URDE_BINARY_CONFIGS
m_child.reset(NewSpaceFromConfigStream(vm, this, r)); m_spaceTree.reset(NewSpaceFromConfigStream(vm, this, r));
#else #else
r.enterSubRecord("spaceTree"); r.enterSubRecord("spaceTree");
m_spaceTree.reset(NewSpaceFromConfigStream(vm, this, r)); m_spaceTree.reset(NewSpaceFromConfigStream(vm, this, r));