summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHadi Brais <hadi.b@live.com>2015-06-06 19:18:06 +0530
committerHadi Brais <hadi.b@live.com>2015-06-07 18:30:54 +0530
commit2b6efaeed3b263b3be0be46716205152567e854a (patch)
tree44027b3ceaf95134e13b35be04587b8ed056b14e /src
parent4b21be40517f1348d7f223726decb0f719d09a4b (diff)
downloadcoreclr-2b6efaeed3b263b3be0be46716205152567e854a.tar.gz
coreclr-2b6efaeed3b263b3be0be46716205152567e854a.tar.bz2
coreclr-2b6efaeed3b263b3be0be46716205152567e854a.zip
build,win: Enables Whole Program Optimization.
* Enables whole program optimization for release configuration on Windows. * Fixes all messages "/LTCG specified but no code generation required; remove /LTCG from link command line to improve linker performance" which slow down the build process. * Fixes all messages "MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance" which slow down the build process. * The previous two fixes work in Release and Debug builds on Windows. Issue-URL: #1086
Diffstat (limited to 'src')
-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
4 files changed, 23 insertions, 6 deletions
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