summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt13
-rw-r--r--build.cmd2
-rw-r--r--src/dlls/clretwrc/CMakeLists.txt13
-rw-r--r--src/dlls/mscordac/CMakeLists.txt7
-rw-r--r--src/dlls/mscorrc/CMakeLists.txt3
-rw-r--r--src/pal/tools/gen-buildsys-win.bat6
-rw-r--r--tests/buildtest.cmd2
7 files changed, 36 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2dd15524c6..faafa8600a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -229,12 +229,10 @@ if (WIN32)
# The following options are set by the razzle build
add_compile_options(/TP) # compile all files as C++
add_compile_options(/FIWarningControl.h) # force include of WarningControl.h
-add_compile_options(/Zi) # enable debugging information
add_compile_options(/d2Zi+) # make optimized builds debugging easier
add_compile_options(/nologo) # Suppress Startup Banner
add_compile_options(/W3) # set warning level to 3
add_compile_options(/WX) # treat warnings as errors
-add_compile_options(/O1) # minimize space
add_compile_options(/Oi) # enable intrinsics
add_compile_options(/Oy-) # disable suppressing of the creation of frame pointers on the call stack for quicker function calls
add_compile_options(/U_MT) # undefine the predefined _MT macro
@@ -253,6 +251,12 @@ add_compile_options(/MP) # Build with Multiple Processes (number of processes eq
add_compile_options(/GS) # Buffer Security Check
add_compile_options(/Zm200) # Specify Precompiled Header Memory Allocation Limit of 150MB
add_compile_options(/wd4960 /wd4961 /wd4603 /wd4627 /wd4838 /wd4456 /wd4457 /wd4458 /wd4459 /wd4091 /we4640)
+add_compile_options(/O1) # minimize space
+add_compile_options(/Zi) # enable debugging information
+
+if (CMAKE_BUILD_TYPE STREQUAL Release OR CMAKE_BUILD_TYPE STREQUAL Relwithdebinfo)
+ add_compile_options(/GL) # enable WholeProgramOptimization
+endif ()
if (IS_64BIT_BUILD EQUAL 1)
# The generator expression in the following command means that the /homeparams option is added only for debug builds
@@ -285,9 +289,14 @@ set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "/NOVCFEATURE")
# Release build specific flags
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG")
+set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} /LTCG")
+set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG")
# ReleaseWithDebugInfo build specific flags
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /LTCG")
+set(CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO} /LTCG")
+set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /LTCG")
+
endif (WIN32)
endif (OVERRIDE_CMAKE_CXX_FLAGS)
diff --git a/build.cmd b/build.cmd
index 049f76b918..2d874aabce 100644
--- a/build.cmd
+++ b/build.cmd
@@ -147,7 +147,7 @@ exit /b 1
:GenVSSolution
:: Regenerate the VS solution
pushd "%__IntermediatesDir%"
-call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" "%__ProjectDir%" %__VSVersion%
+call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" "%__ProjectDir%" %__VSVersion% %__BuildType%
popd
:BuildComponents
diff --git a/src/dlls/clretwrc/CMakeLists.txt b/src/dlls/clretwrc/CMakeLists.txt
index e43fcb9665..f4b874d414 100644
--- a/src/dlls/clretwrc/CMakeLists.txt
+++ b/src/dlls/clretwrc/CMakeLists.txt
@@ -1,5 +1,13 @@
include_directories(${CMAKE_CURRENT_BINARY_DIR})
-set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NOENTRY")
+
+if(WIN32)
+ # remove /ltcg from resource-only libraries
+ string(REPLACE "/LTCG" "" CMAKE_SHARED_LINKER_FLAGS_RELEASE ${CMAKE_SHARED_LINKER_FLAGS_RELEASE})
+ string(REPLACE "/LTCG" "" CMAKE_STATIC_LINKER_FLAGS_RELEASE ${CMAKE_STATIC_LINKER_FLAGS_RELEASE})
+ string(REPLACE "/LTCG" "" CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO})
+ string(REPLACE "/LTCG" "" CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO ${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO})
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NOENTRY")
+endif(WIN32)
add_definitions(-DFX_VER_INTERNALNAME_STR=clretwrc.dll)
@@ -18,6 +26,7 @@ add_custom_command(
# add the install targets
install (TARGETS clretwrc DESTINATION .)
+
if(WIN32)
-install (FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/clretwrc.pdb DESTINATION PDB)
+ install (FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/clretwrc.pdb DESTINATION PDB)
endif(WIN32)
diff --git a/src/dlls/mscordac/CMakeLists.txt b/src/dlls/mscordac/CMakeLists.txt
index 1cb70a52a0..c40c465076 100644
--- a/src/dlls/mscordac/CMakeLists.txt
+++ b/src/dlls/mscordac/CMakeLists.txt
@@ -68,10 +68,15 @@ if(WIN32)
# mscordac.def should be generated before mscordaccore.dll is built
add_dependencies(mscordaccore mscordaccore_def)
+ set(LTCG_FLAG "")
+ if (CMAKE_BUILD_TYPE STREQUAL Release OR CMAKE_BUILD_TYPE STREQUAL Relwithdebinfo)
+ set(LTCG_FLAG "/LTCG")
+ endif()
+
# Generate export file
add_custom_command(TARGET mscordaccore
PRE_LINK
- COMMAND lib.exe /OUT:${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/mscordaccore.lib /DEF:${CMAKE_CURRENT_BINARY_DIR}/mscordac.def $<TARGET_FILE:daccess> ${STATIC_LIBRARY_FLAGS} ${CMAKE_CURRENT_BINARY_DIR}/mscordaccore.dir/$<CONFIG>/mscordac.obj
+ COMMAND lib.exe ${LTCG_FLAG} /OUT:${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/mscordaccore.lib /DEF:${CMAKE_CURRENT_BINARY_DIR}/mscordac.def $<TARGET_FILE:daccess> ${STATIC_LIBRARY_FLAGS} ${CMAKE_CURRENT_BINARY_DIR}/mscordaccore.dir/$<CONFIG>/mscordac.obj
COMMENT "Generating mscordaccore.exp export file"
VERBATIM
)
diff --git a/src/dlls/mscorrc/CMakeLists.txt b/src/dlls/mscorrc/CMakeLists.txt
index 47d87ae30b..198fe8deb6 100644
--- a/src/dlls/mscorrc/CMakeLists.txt
+++ b/src/dlls/mscorrc/CMakeLists.txt
@@ -1,6 +1,9 @@
include_directories("../../pal/prebuilt/corerror")
if(WIN32)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NOENTRY")
+ # remove /ltcg from resource-only libraries
+ string(REPLACE "/LTCG" "" CMAKE_SHARED_LINKER_FLAGS_RELEASE ${CMAKE_SHARED_LINKER_FLAGS_RELEASE})
+ string(REPLACE "/LTCG" "" CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO})
else()
set (RC_TO_CPP ${CMAKE_CURRENT_SOURCE_DIR}/rctocpp.awk)
diff --git a/src/pal/tools/gen-buildsys-win.bat b/src/pal/tools/gen-buildsys-win.bat
index 56b22f221f..8935e873fd 100644
--- a/src/pal/tools/gen-buildsys-win.bat
+++ b/src/pal/tools/gen-buildsys-win.bat
@@ -5,7 +5,7 @@ rem This file invokes cmake and generates the build system for windows.
set argC=0
for %%x in (%*) do Set /A argC+=1
-if NOT %argC%==2 GOTO :USAGE
+if NOT %argC%==3 GOTO :USAGE
if %1=="/?" GOTO :USAGE
setlocal
@@ -24,13 +24,13 @@ if defined CMakePath goto DoGen
for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy RemoteSigned "& .\probe-win.ps1"') do %%a
:DoGen
-"%CMakePath%" "-DCMAKE_USER_MAKE_RULES_OVERRIDE=%basePath%\windows-compiler-override.txt" -G "Visual Studio %__VSString% Win64" %1
+"%CMakePath%" "-DCMAKE_USER_MAKE_RULES_OVERRIDE=%basePath%\windows-compiler-override.txt" "-DCMAKE_BUILD_TYPE=%3" -G "Visual Studio %__VSString% Win64" %1
endlocal
GOTO :DONE
:USAGE
echo "Usage..."
- echo "gen-buildsys-win.bat <path to top level CMakeLists.txt> <VSVersion>"
+ echo "gen-buildsys-win.bat <path to top level CMakeLists.txt> <VSVersion> <BuildType>"
echo "Specify the path to the top level CMake file - <ProjectK>/src/NDP"
echo "Specify the VSVersion to be used - VS2013 or VS2015"
EXIT /B 1
diff --git a/tests/buildtest.cmd b/tests/buildtest.cmd
index 2f44f53d34..f2ca47b814 100644
--- a/tests/buildtest.cmd
+++ b/tests/buildtest.cmd
@@ -118,7 +118,7 @@ exit /b 1
:GenVSSolution
:: Regenerate the VS solution
pushd "%__NativeTestIntermediatesDir%"
-call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" "%__ProjectFilesDir%\" %__VSVersion%
+call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" "%__ProjectFilesDir%\" %__VSVersion% %__BuildType%
popd
:BuildComponents