[vcpkg_configure_cmake] Add NO_CHARSET_FLAG option (#7074)

* [vcpkg_configure_cmake] Add NO_CHARSET_FLAG option

* [vcpkg_configure_cmake] Add documentation for new NO_CHARSET_FLAG option

* [vcpkg_configure_cmake, windows toolchain] Handle NO_CHARSET_FLAG in toolchain

* [build.cpp] Add Windows toolchain to package hash

* [duilib,msix,thrift,tidy-html5] Use NO_CHARSET_FLAG to fix regressions
This commit is contained in:
Victor Romero 2019-06-30 09:31:22 -07:00 committed by GitHub
parent 700a3e180c
commit e2049cb975
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 31 additions and 8 deletions

View File

@ -8,6 +8,7 @@ vcpkg_configure_cmake(
SOURCE_PATH <${SOURCE_PATH}>
[PREFER_NINJA]
[DISABLE_PARALLEL_CONFIGURE]
[NO_CHARSET_FLAG]
[GENERATOR <"NMake Makefiles">]
[OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...]
[OPTIONS_RELEASE <-DOPTIMIZE=1>...]
@ -27,6 +28,11 @@ Disables running the CMake configure step in parallel.
This is needed for libraries which write back into their source directory during configure.
### NO_CHARSET_FLAG
Disables passing `utf-8` as the default character set to `CMAKE_C_FLAGS` and `CMAKE_CXX_FLAGS`.
This is needed for libraries that set their own source code's character set.
### GENERATOR
Specifies the precise generator to use.

View File

@ -1,3 +1,3 @@
Source: duilib
Version: 2019-4-28-1
Version: 2019-4-28-2
Description: Duilib is a free open source DirectUI interface library under Windows. It is widely accepted by major Internet companies due to its simple and easy to expand design and stable and efficient implementation. It is widely used in IM, video client, stock market software, navigation software, and mobile phone assistive software. Duilib is still evolving, and will continue to improve in many aspects such as documentation, examples, animations, and rendering engines.

View File

@ -16,6 +16,7 @@ vcpkg_from_github(
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}/DuiLib
PREFER_NINJA
NO_CHARSET_FLAG
)
vcpkg_build_cmake()

View File

@ -1,5 +1,5 @@
Source: msix
Version: MsixCoreInstaller-preview
Version: MsixCoreInstaller-preview-1
Build-Depends: xerces-c, zlib, openssl (!uwp&!windows)
Description: The MSIX Packaging SDK project is an effort to enable developers on a variety of platforms to pack and unpack packages for the purposes of distribution from either the Microsoft Store, or their own content distribution networks.
The MSIX Packaging APIs that a client app would use to interact with .msix/.appx packages are a subset of those documented here. See sample/ExtractContentsSample/ExtractContentsSample.cpp for additional details.

View File

@ -31,6 +31,7 @@ endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
NO_CHARSET_FLAG
OPTIONS
-DCMAKE_DISABLE_FIND_PACKAGE_Git=ON
-DINSTALL_LIBMSIX=ON

View File

@ -1,5 +1,5 @@
Source: thrift
Version: 2019-05-07-1
Version: 2019-05-07-2
Build-Depends: zlib, libevent, openssl, boost-range, boost-smart-ptr, boost-date-time, boost-locale, boost-scope-exit
Homepage: https://github.com/apache/thrift
Description: Apache Thrift is a software project spanning a variety of programming languages and use cases. Our goal is to make reliable, performant communication and data serialization across languages as efficient and seamless as possible.

View File

@ -16,6 +16,7 @@ vcpkg_from_github(
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
NO_CHARSET_FLAG
OPTIONS
-DWITH_STDTHREADS=ON
-DBUILD_TESTING=off

View File

@ -1,4 +1,4 @@
Source: tidy-html5
Version: 5.6.0
Version: 5.6.0-1
Homepage: https://github.com/htacg/tidy-html5
Description: Tidy tidies HTML and XML. It can tidy your documents by itself, and developers can easily integrate its features into even more powerful tools.

View File

@ -15,6 +15,7 @@ vcpkg_from_github(
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
NO_CHARSET_FLAG
OPTIONS
-DBUILD_SHARED_LIB=OFF
-DTIDY_CONSOLE_SHARED=OFF

View File

@ -51,7 +51,7 @@
## * [poco](https://github.com/Microsoft/vcpkg/blob/master/ports/poco/portfile.cmake)
## * [opencv](https://github.com/Microsoft/vcpkg/blob/master/ports/opencv/portfile.cmake)
function(vcpkg_configure_cmake)
cmake_parse_arguments(_csc "PREFER_NINJA;DISABLE_PARALLEL_CONFIGURE" "SOURCE_PATH;GENERATOR" "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" ${ARGN})
cmake_parse_arguments(_csc "PREFER_NINJA;DISABLE_PARALLEL_CONFIGURE;NO_CHARSET_FLAG" "SOURCE_PATH;GENERATOR" "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" ${ARGN})
if(NOT VCPKG_PLATFORM_TOOLSET)
message(FATAL_ERROR "Vcpkg has been updated with VS2017 support, however you need to rebuild vcpkg.exe by re-running bootstrap-vcpkg.bat\n")
@ -174,6 +174,11 @@ function(vcpkg_configure_cmake)
else()
message(FATAL_ERROR "You must set both the VCPKG_CXX_FLAGS and VCPKG_C_FLAGS")
endif()
set(VCPKG_SET_CHARSET_FLAG ON)
if(_csc_NO_CHARSET_FLAG)
set(VCPKG_SET_CHARSET_FLAG OFF)
endif()
if(VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
list(APPEND _csc_OPTIONS "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}")
@ -189,8 +194,10 @@ function(vcpkg_configure_cmake)
list(APPEND _csc_OPTIONS "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_ROOT_DIR}/scripts/toolchains/freebsd.cmake")
endif()
list(APPEND _csc_OPTIONS
"-DVCPKG_TARGET_TRIPLET=${TARGET_TRIPLET}"
"-DVCPKG_SET_CHARSET_FLAG=${VCPKG_SET_CHARSET_FLAG}"
"-DVCPKG_PLATFORM_TOOLSET=${VCPKG_PLATFORM_TOOLSET}"
"-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON"
"-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON"

View File

@ -9,7 +9,8 @@ if(NOT _CMAKE_IN_TRY_COMPILE)
message(FATAL_ERROR "Invalid setting for VCPKG_CRT_LINKAGE: \"${VCPKG_CRT_LINKAGE}\". It must be \"static\" or \"dynamic\"")
endif()
if(VCPKG_PLATFORM_TOOLSET MATCHES "v120")
set(CHARSET_FLAG "/utf-8")
if (NOT VCPKG_SET_CHARSET_FLAG OR VCPKG_PLATFORM_TOOLSET MATCHES "v120")
# VS 2013 does not support /utf-8
set(CHARSET_FLAG)
endif()
@ -17,7 +18,7 @@ if(NOT _CMAKE_IN_TRY_COMPILE)
set(CMAKE_CXX_FLAGS " /DWIN32 /D_WINDOWS /W3 ${CHARSET_FLAG} /GR /EHsc /MP ${VCPKG_CXX_FLAGS}" CACHE STRING "")
set(CMAKE_C_FLAGS " /DWIN32 /D_WINDOWS /W3 ${CHARSET_FLAG} /MP ${VCPKG_C_FLAGS}" CACHE STRING "")
set(CMAKE_RC_FLAGS "-c65001 /DWIN32" CACHE STRING "")
unset(CHARSET_FLAG)
set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG ${VCPKG_CRT_LINK_FLAG_PREFIX}d /Z7 /Ob0 /Od /RTC1 ${VCPKG_CXX_FLAGS_DEBUG}" CACHE STRING "")
@ -27,5 +28,4 @@ if(NOT _CMAKE_IN_TRY_COMPILE)
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ${VCPKG_LINKER_FLAGS}" CACHE STRING "")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ${VCPKG_LINKER_FLAGS}" CACHE STRING "")
endif()

View File

@ -1007,6 +1007,12 @@ namespace vcpkg::Build
hash += "-";
hash += Hash::get_file_hash(fs, *p, "SHA1");
}
else if (pre_build_info.cmake_system_name.empty() ||
pre_build_info.cmake_system_name == "WindowsStore")
{
hash += "-";
hash += Hash::get_file_hash(fs, paths.scripts / "toolchains" / "windows.cmake", "SHA1");
}
else if (pre_build_info.cmake_system_name == "Linux")
{
hash += "-";