-
Notifications
You must be signed in to change notification settings - Fork 7.6k
[Fix uwp toolchain|world rebuild] make ninja work for uwp #22831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
07f768b
10fddd0
12c87a6
20e35ae
e7de7d7
13b6145
396ce94
449726e
db86cd3
fe05c1f
3991cb7
a9ae1ef
f2fb380
5135de2
1665365
26a2500
f63f516
7619df2
c79dea1
11f4170
ef54a0b
3aef0da
b73af0c
813b310
bbd9f17
14e61ae
5231853
6c599ae
89e140c
e60be2f
68791e9
0915931
c7f3266
81edf22
1fb644a
c47b8b3
7aa40af
688eae5
c01600a
7b6fa6c
0818c99
2527586
63f3335
7653f89
276ad89
347d9f4
f28f767
6e020dd
ae26d88
2564740
60bbdea
500de7b
68212d8
491e75f
0b71377
509bb44
cfc5c8b
363e633
63d2a0d
777973d
61427e0
59c68b3
a1fd40c
f193009
cef8bb3
cba12df
f21e944
261ed4c
a334bc6
221a787
fc27223
51461b7
59cbf87
b0633b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -236,6 +236,7 @@ function(vcpkg_configure_make) | |
| z_vcpkg_get_cmake_vars(cmake_vars_file) | ||
| debug_message("Including cmake vars from: ${cmake_vars_file}") | ||
| include("${cmake_vars_file}") | ||
|
|
||
| if(DEFINED VCPKG_MAKE_BUILD_TRIPLET) | ||
| set(arg_BUILD_TRIPLET ${VCPKG_MAKE_BUILD_TRIPLET}) # Triplet overwrite for crosscompiling | ||
| endif() | ||
|
|
@@ -540,12 +541,15 @@ function(vcpkg_configure_make) | |
| # IMPORTANT: The only way to pass linker flags through libtool AND the compile wrapper | ||
| # is to use the CL and LINK environment variables !!! | ||
| # (This is due to libtool and compiler wrapper using the same set of options to pass those variables around) | ||
| string(REPLACE "\\" "/" VCToolsInstallDir "$ENV{VCToolsInstallDir}") | ||
| file(TO_CMAKE_PATH "$ENV{VCToolsInstallDir}" VCToolsInstallDir) | ||
| set(_replacement -FU\"${VCToolsInstallDir}/lib/x86/store/references/platform.winmd\") | ||
| string(REPLACE "${_replacement}" "" VCPKG_DETECTED_CMAKE_CXX_FLAGS_DEBUG "${VCPKG_DETECTED_CMAKE_CXX_FLAGS_DEBUG}") | ||
| string(REPLACE "${_replacement}" "" VCPKG_DETECTED_CMAKE_C_FLAGS_DEBUG "${VCPKG_DETECTED_CMAKE_C_FLAGS_DEBUG}") | ||
| string(REPLACE "${_replacement}" "" VCPKG_DETECTED_CMAKE_CXX_FLAGS_RELEASE "${VCPKG_DETECTED_CMAKE_CXX_FLAGS_RELEASE}") | ||
| string(REPLACE "${_replacement}" "" VCPKG_DETECTED_CMAKE_C_FLAGS_RELEASE "${VCPKG_DETECTED_CMAKE_C_FLAGS_RELEASE}") | ||
| # Can somebody please check if CMake's compiler flags for UWP are correct? | ||
| set(ENV{_CL_} "$ENV{_CL_} /D_UNICODE /DUNICODE /DWINAPI_FAMILY=WINAPI_FAMILY_APP /D__WRL_NO_DEFAULT_LIB_ -FU\"${VCToolsInstallDir}/lib/x86/store/references/platform.winmd\"") | ||
| string(APPEND VCPKG_DETECTED_CMAKE_CXX_FLAGS_RELEASE " -ZW:nostdlib") | ||
| string(APPEND VCPKG_DETECTED_CMAKE_CXX_FLAGS_DEBUG " -ZW:nostdlib") | ||
| set(ENV{_LINK_} "$ENV{_LINK_} ${VCPKG_DETECTED_CMAKE_C_STANDARD_LIBRARIES} ${VCPKG_DETECTED_CMAKE_CXX_STANDARD_LIBRARIES} /MANIFEST /DYNAMICBASE /WINMD:NO /APPCONTAINER") | ||
| set(ENV{_CL_} "$ENV{_CL_} -FU\"${VCToolsInstallDir}/lib/x86/store/references/platform.winmd\"") | ||
| set(ENV{_LINK_} "$ENV{_LINK_} ${VCPKG_DETECTED_CMAKE_C_STANDARD_LIBRARIES} ${VCPKG_DETECTED_CMAKE_CXX_STANDARD_LIBRARIES}") | ||
|
Comment on lines
-562
to
+571
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Theoretically this needs to be generalized to every flag containing spaces in its arguments. |
||
| endif() | ||
| endif() | ||
|
|
||
|
|
@@ -704,7 +708,7 @@ function(vcpkg_configure_make) | |
| set(LINK_ENV_${var_suffix} "${LINKER_FLAGS_${var_suffix}}") | ||
| endif() | ||
| else() | ||
| set(link_required_dirs) | ||
| set(link_required_dirs "") | ||
| if(EXISTS "${CURRENT_INSTALLED_DIR}${path_suffix_${var_suffix}}/lib") | ||
| set(link_required_dirs "-L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib") | ||
| endif() | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,55 @@ | ||||||
| if(NOT _VCPKG_WINDOWS_TOOLCHAIN) | ||||||
| set(_VCPKG_WINDOWS_TOOLCHAIN 1) | ||||||
| set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<STREQUAL:${VCPKG_CRT_LINKAGE},dynamic>:DLL>" CACHE STRING "") | ||||||
|
|
||||||
| get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE ) | ||||||
| if(NOT _CMAKE_IN_TRY_COMPILE) | ||||||
|
|
||||||
| if(VCPKG_CRT_LINKAGE STREQUAL "dynamic") | ||||||
| set(VCPKG_CRT_LINK_FLAG_PREFIX "/MD") | ||||||
| elseif(VCPKG_CRT_LINKAGE STREQUAL "static") | ||||||
| set(VCPKG_CRT_LINK_FLAG_PREFIX "/MT") | ||||||
| else() | ||||||
| message(FATAL_ERROR "Invalid setting for VCPKG_CRT_LINKAGE: \"${VCPKG_CRT_LINKAGE}\". It must be \"static\" or \"dynamic\"") | ||||||
| endif() | ||||||
|
|
||||||
| set(_vcpkg_charset "/utf-8") | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a bit sad that this one is called
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can change this with the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The flag is pointless, but isn't worth another world rebuild to change if that's the only remaining nitpick. You got it to be green, so I'm going to run with it :) |
||||||
| if (NOT VCPKG_SET_CHARSET_FLAG OR VCPKG_PLATFORM_TOOLSET MATCHES "v120") | ||||||
| # VS 2013 does not support /utf-8 | ||||||
| set(_vcpkg_charset "") | ||||||
| endif() | ||||||
|
|
||||||
| set(_vcpkg_cpp_flags "/DWIN32 /D_WINDOWS /D_UNICODE /DUNICODE /DWINAPI_FAMILY=WINAPI_FAMILY_APP /D__WRL_NO_DEFAULT_LIB__" ) # VS adds /D "_WINDLL" for DLLs; | ||||||
| set(_vcpkg_common_flags "/nologo /Z7 /MP /GS /Gd /Gm- /W3 /WX- /Zc:wchar_t /Zc:inline /Zc:forScope /fp:precise /Oy- /EHsc") | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Don't worry about applying this yet; I'll just apply it before merging. Just avoiding building the world again until I'm ready to push the merge button) |
||||||
| #/ZW:nostdlib -> ZW is added by CMake # VS also normally adds /sdl but not cmake MSBUILD | ||||||
| file(TO_CMAKE_PATH "$ENV{VCToolsInstallDir}" _vcpkg_vctools) | ||||||
| set(_vcpkg_winmd_flag "/FU\\\\\"${_vcpkg_vctools}/lib/x86/store/references/platform.winmd\\\\\"") # VS normally passes /ZW for Apps | ||||||
|
|
||||||
| set(CMAKE_CXX_FLAGS "${_vcpkg_cpp_flags} ${_vcpkg_common_flags} ${_vcpkg_winmd_flag} ${_vcpkg_charset} ${VCPKG_CXX_FLAGS}" CACHE STRING "") | ||||||
| set(CMAKE_C_FLAGS "${_vcpkg_cpp_flags} ${_vcpkg_common_flags} ${_vcpkg_winmd_flag} ${_vcpkg_charset} ${VCPKG_C_FLAGS}" CACHE STRING "") | ||||||
| set(CMAKE_RC_FLAGS "-c65001 ${_vcpkg_cpp_flags}" CACHE STRING "") | ||||||
|
|
||||||
| unset(_vcpkg_charset) | ||||||
| unset(_vcpkg_cpp_flags) | ||||||
| unset(_vcpkg_common_flags) | ||||||
| unset(_vcpkg_winmd_flag) | ||||||
|
|
||||||
| set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /Od /RTC1 ${VCPKG_CRT_LINK_FLAG_PREFIX}d ${VCPKG_CXX_FLAGS_DEBUG}" CACHE STRING "") | ||||||
| set(CMAKE_C_FLAGS_DEBUG "/D_DEBUG /Od /RTC1 ${VCPKG_CRT_LINK_FLAG_PREFIX}d ${VCPKG_C_FLAGS_DEBUG}" CACHE STRING "") | ||||||
|
|
||||||
| set(CMAKE_CXX_FLAGS_RELEASE "/Gy /O2 /Oi ${VCPKG_CRT_LINK_FLAG_PREFIX} ${VCPKG_CXX_FLAGS_RELEASE}" CACHE STRING "") # VS adds /GL | ||||||
| set(CMAKE_C_FLAGS_RELEASE "/Gy /O2 /Oi ${VCPKG_CRT_LINK_FLAG_PREFIX} ${VCPKG_C_FLAGS_RELEASE}" CACHE STRING "") | ||||||
|
|
||||||
| string(APPEND CMAKE_STATIC_LINKER_FLAGS_RELEASE_INIT " /nologo ") # VS adds /LTCG | ||||||
| string(APPEND CMAKE_SHARED_LINKER_FLAGS " /MANIFEST:NO /NXCOMPAT /DYNAMICBASE /DEBUG /WINMD:NO /APPCONTAINER /SUBSYSTEM:CONSOLE /MANIFESTUAC:NO ${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_RELEASE}") | ||||||
| # VS adds /DEBUG:FULL /TLBID:1. WindowsApp.lib is in CMAKE_C|CXX_STANDARD_LIBRARIES | ||||||
| string(APPEND CMAKE_EXE_LINKER_FLAGS " /MANIFEST:NO /NXCOMPAT /DYNAMICBASE /DEBUG /WINMD /APPCONTAINER /MANIFESTUAC:NO ${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_RELEASE}") | ||||||
| # VS adds /DEBUG:FULL /TLBID:1. | ||||||
| set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF " CACHE STRING "") # VS uses /LTCG:incremental | ||||||
| set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF " CACHE STRING "") | ||||||
|
|
||||||
| string(APPEND CMAKE_STATIC_LINKER_FLAGS_DEBUG_INIT " /nologo ") | ||||||
| string(APPEND CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT " /nologo ") | ||||||
| string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT " /nologo ${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_DEBUG} ") | ||||||
| endif() | ||||||
| endif() | ||||||
Uh oh!
There was an error while loading. Please reload this page.