From 18957ae46e6a00ff6daef420a8510070eea513e3 Mon Sep 17 00:00:00 2001 From: vaerizk Date: Fri, 23 Jul 2021 21:01:53 +0300 Subject: [PATCH 01/18] add msix/1.7 --- recipes/msix/all/CMakeLists.txt | 7 + recipes/msix/all/conandata.yml | 10 + recipes/msix/all/conanfile.py | 130 +++++ recipes/msix/all/patches/1.7/cmake.patch | 488 ++++++++++++++++++ .../all/patches/1.7/signaturevalidator.patch | 39 ++ recipes/msix/all/test_package/CMakeLists.txt | 9 + recipes/msix/all/test_package/conanfile.py | 17 + recipes/msix/all/test_package/example.cpp | 26 + recipes/msix/config.yml | 3 + 9 files changed, 729 insertions(+) create mode 100644 recipes/msix/all/CMakeLists.txt create mode 100644 recipes/msix/all/conandata.yml create mode 100644 recipes/msix/all/conanfile.py create mode 100644 recipes/msix/all/patches/1.7/cmake.patch create mode 100644 recipes/msix/all/patches/1.7/signaturevalidator.patch create mode 100644 recipes/msix/all/test_package/CMakeLists.txt create mode 100644 recipes/msix/all/test_package/conanfile.py create mode 100644 recipes/msix/all/test_package/example.cpp create mode 100644 recipes/msix/config.yml diff --git a/recipes/msix/all/CMakeLists.txt b/recipes/msix/all/CMakeLists.txt new file mode 100644 index 0000000000000..5c33d80b7d7b4 --- /dev/null +++ b/recipes/msix/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8.0) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +add_subdirectory("source_subfolder") diff --git a/recipes/msix/all/conandata.yml b/recipes/msix/all/conandata.yml new file mode 100644 index 0000000000000..ef22231170ffe --- /dev/null +++ b/recipes/msix/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "1.7": + url: "https://github.com/microsoft/msix-packaging/archive/refs/tags/v1.7.zip" + sha256: "23179d577d0b9d34e93374ae38284ab9f1247ff6cc9175851983fb114ab00087" +patches: + "1.7": + - base_path: "source_subfolder" + patch_file: "patches/1.7/cmake.patch" + - base_path: "source_subfolder" + patch_file: "patches/1.7/signaturevalidator.patch" diff --git a/recipes/msix/all/conanfile.py b/recipes/msix/all/conanfile.py new file mode 100644 index 0000000000000..638fce036aa0f --- /dev/null +++ b/recipes/msix/all/conanfile.py @@ -0,0 +1,130 @@ +import os +from conans import CMake, ConanFile, tools +from conans.errors import ConanInvalidConfiguration + + +class MsixConan(ConanFile): + name = "msix" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/microsoft/msix-packaging" + description = "An SDK for creating MSIX packages" + topics = ("msix", "sdk", "packaging", "conan-recipe") + + settings = "os", "compiler", "build_type", "arch" + options = { + "shared": [True, False], + "fPIC": [True, False], + "crypto_lib": ["crypt32", "openssl"], + "pack": [True, False], + "skip_bundles": [True, False], + "use_external_zlib": [True, False], + "use_validation_parser": [True, False], + "xml_parser": ["applexml", "javaxml", "msxml6", "xerces"] + } + default_options = { + "shared": False, + "fPIC": True, + "crypto_lib": "openssl", + "pack": False, + "skip_bundles": False, + "use_external_zlib": True, + "use_validation_parser": False, + "xml_parser": "xerces" + } + + generators = "cmake" + exports_sources = "CMakeLists.txt", "patches/**" + + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + if self.settings.os == "Android": + self._cmake.definitions["AOSP"] = True + if self.settings.os == "Linux": + self._cmake.definitions["LINUX"] = True + if self.settings.os == "Macos": + self._cmake.definitions["MACOS"] = True + self._cmake.definitions["CRYPTO_LIB"] = self.options.crypto_lib + self._cmake.definitions["MSIX_PACK"] = self.options.pack + self._cmake.definitions["MSIX_SAMPLES"] = False + self._cmake.definitions["MSIX_TESTS"] = False + self._cmake.definitions["SKIP_BUNDLES"] = self.options.skip_bundles + self._cmake.definitions["USE_EXTERNAL_ZLIB"] = self.options.use_external_zlib + self._cmake.definitions["USE_SHARED_ZLIB"] = self.options["zlib"].shared + self._cmake.definitions["USE_VALIDATION_PARSER"] = self.options.use_validation_parser + self._cmake.definitions["XML_PARSER"] = self.options.xml_parser + self._cmake.configure() + return self._cmake + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.settings.os == "Linux" and (self.settings.compiler != "clang"): + raise ConanInvalidConfiguration("Only clang is supported on Linux") + if self.settings.os == "Linux" and (self.options.crypto_lib == "crypt32"): + raise ConanInvalidConfiguration("crypt32 is not available on Linux") + if self.settings.os == "Linux" and self.options.shared: + self.options.fPIC = True + if self.settings.os != "Android" and self.options.xml_parser == "javaxml": + raise ConanInvalidConfiguration("javaxml is supported only for Android") + if self.settings.os != "Macos" and self.options.xml_parser == "applexml": + raise ConanInvalidConfiguration("applexml is supported only for MacOS") + if self.settings.os != "Windows" and self.options.xml_parser == "msxml6": + raise ConanInvalidConfiguration("msxml6 is supported only for Windows") + if self.options.pack: + if self.settings.os == "Macos": + if not self.options.use_external_zlib: + raise ConanInvalidConfiguration("Using libCompression APIs and packaging features is not supported") + if self.options.xml_parser and (self.options.xml_parser != "xerces"): + raise ConanInvalidConfiguration("Xerces is the only supported parser for MacOS pack") + if not self.options.use_validation_parser: + raise ConanInvalidConfiguration("Packaging requires validation parser") + if self.options.xml_parser == "xerces": + self.options["xerces-c"].char_type = "char16_t" + self.options["xerces-c"].shared = False + tools.check_min_cppstd(self, "14") + + def requirements(self): + if self.settings.os == "Linux" and not self.options.skip_bundles: + self.requires("icu/68.2") + if self.settings.os != "Windows" and not self.options.crypto_lib: + self.requires("openssl/1.0.2t") + if self.options.crypto_lib == "openssl": + self.requires("openssl/1.0.2t") + if self.options.use_external_zlib: + self.requires("zlib/1.2.11") + if self.options.xml_parser == "xerces": + self.requires("xerces-c/3.2.3") + + def source(self): + tools.get(**self.conan_data["sources"][self.version]) + os.rename("msix-packaging-{}".format(self.version), self._source_subfolder) + + def build(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) + cmake = self._configure_cmake() + cmake.build() + + def package(self): + cmake = self._configure_cmake() + cmake.install() + + def package_info(self): + self.cpp_info.libs = tools.collect_libs(self) + if self.settings.os == "Windows": + self.cpp_info.system_libs = ["runtimeobject"] + if not self.options.crypto_lib or self.options.crypto_lib == "crypt32": + self.cpp_info.system_libs.extend(["bcrypt", "crypt32", "wintrust"]) + if self.settings.compiler == "Visual Studio": + self.cpp_info.system_libs.append("delayimp") diff --git a/recipes/msix/all/patches/1.7/cmake.patch b/recipes/msix/all/patches/1.7/cmake.patch new file mode 100644 index 0000000000000..b01387ce90a44 --- /dev/null +++ b/recipes/msix/all/patches/1.7/cmake.patch @@ -0,0 +1,488 @@ + CMakeLists.txt | 102 +++--------------------------------- + cmake/msix_options.cmake | 24 ++------- + src/CMakeLists.txt | 1 - + src/makemsix/CMakeLists.txt | 3 ++ + src/msix/CMakeLists.txt | 124 +++++++++++++++----------------------------- + 5 files changed, 59 insertions(+), 195 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index dc5908cd..c65cbf0f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -5,6 +5,9 @@ cmake_minimum_required(VERSION 3.8.0 FATAL_ERROR) + project(msix-sdk) + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + ++include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) ++conan_basic_setup(TARGETS) ++ + message(STATUS "--------------------------------") + message(STATUS "MSIX Packaging SDK") + message(STATUS "--------------------------------") +@@ -21,12 +24,6 @@ if(POLICY CMP0077) + cmake_policy(SET CMP0077 NEW) + endif() + +-# Default version is 0.0.0 +-set(VERSION_MAJOR "0") +-set(VERSION_MINOR "0") +-set(VERSION_PATCH "0") +-set(GIT_BRANCH_NAME "master") +- + # CMake useful variables + set(MSIX_PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) + set(MSIX_BINARY_ROOT ${CMAKE_CURRENT_BINARY_DIR}) +@@ -35,97 +32,18 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin") + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib") + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib") + +-## Git (and its revision) +-find_package(Git) # QUIET) # if we don't find git or FindGit.cmake is not on the system we ignore it. +- +-## GetGitRevisionDescription module to retreive branch and revision information from Git +-## Starting with Git 1.9 the module will be part of official cMake distribution, until then it has to be +-## part of the application +-## The Git module will trigger a reconfiguration for each pull that will bring a new revision on the local repository +-set(VCS_REVISION "-1") +-if(GIT_FOUND) +- include(GetGitRevisionDescription) +- get_git_head_revision(GIT_REFSPEC GIT_SHA1) +- message(STATUS "GIT refspec ${GIT_REFSPEC}") +- message(STATUS "GIT revision ${GIT_SHA1}") +- set(VCS_REVISION ${GIT_SHA1}) +- +- git_describe(GIT_DESCRIPTION) +- message(STATUS "GIT Description '${GIT_DESCRIPTION}'" ) +- string(REGEX MATCH "v([0-9]+)\\.([0-9]+)\\-([0-9]+)" _dummy1 "${GIT_DESCRIPTION}") +- set(VERSION_MAJOR ${CMAKE_MATCH_1}) +- set(VERSION_MINOR ${CMAKE_MATCH_2}) +- set(VERSION_PATCH ${CMAKE_MATCH_3}) +- +- if(NOT VERSION_PATCH) +- message(STATUS "GIT Description is from NEW tag") +- string(REGEX MATCH "v([0-9]+)\\.([0-9]+)" _dummy2 "${GIT_DESCRIPTION}") +- set(VERSION_MAJOR ${CMAKE_MATCH_1}) +- set(VERSION_MINOR ${CMAKE_MATCH_2}) +- set(VERSION_PATCH "0") +- endif() +- +- if(NOT ${GIT_REFSPEC}) +- string(REGEX MATCH "refs/heads/([a-zA-Z0-9_/]+)" _dummy3 ${GIT_REFSPEC}) +- set(GIT_BRANCH_NAME ${CMAKE_MATCH_1}) +- else() +- # VSO doesn't checkout a branch do a pull, it checks out a hash and does a pull +- set(GIT_BRANCH_NAME "master") +- endif() +- +- message(STATUS "GIT branch name '${GIT_BRANCH_NAME}'" ) +-else() +- message("git not found.") +-endif() +- + # Set the version number of your project here (format is MAJOR.MINOR.PATCHLEVEL - e.g. 1.0.0) +-set(MSIX_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) +-message(STATUS "MSIX Packaging SDK version ${MSIX_VERSION}") +-message(STATUS "MSIX Packaging SDK branch name ${GIT_BRANCH_NAME}") +-add_definitions(-DSDK_VERSION="${MSIX_VERSION}") ++message(STATUS "MSIX Packaging SDK version ${PROJECT_VERSION}") ++add_definitions(-DSDK_VERSION="${PROJECT_VERSION}") + # Validates CMake options. + include(msix_options) + +-# Configure Package.nuspec +-if(WIN32) +- set(MSIX_NUGET_NAME "Microsoft.MSIX.Packaging.Windows") +-elseif(MACOS) +- set(MSIX_NUGET_NAME "Microsoft.MSIX.Packaging.MacOS") +-elseif(IOS) +- set(MSIX_NUGET_NAME "Microsoft.MSIX.Packaging.iOS") +-elseif(AOSP) +- set(MSIX_NUGET_NAME "Microsoft.MSIX.Packaging.AOSP") +-else() +- set(MSIX_NUGET_NAME "Microsoft.MSIX.Packaging.Linux") +-endif() +- +-configure_file(${MSIX_PROJECT_ROOT}/Package.nuspec.cmakein ${MSIX_BINARY_ROOT}/Package.nuspec CRLF) +-configure_file(${MSIX_PROJECT_ROOT}/Microsoft.MSIX.Packaging.targets ${MSIX_BINARY_ROOT}/build/native/${MSIX_NUGET_NAME}.targets) +-message(STATUS "Package.Nuspec created") +-message(STATUS "--------------------------------") +- + # Configure license txt + configure_file(${MSIX_PROJECT_ROOT}/LICENSE ${MSIX_BINARY_ROOT}/build/LICENSE) + configure_file(${MSIX_PROJECT_ROOT}/THIRD\ PARTY\ CODE\ NOTICE ${MSIX_BINARY_ROOT}/build/THIRD\ PARTY\ CODE\ NOTICE) + message(STATUS "LICENSE created") + message(STATUS "--------------------------------") + +-# Configure certificates +-# list each certificate by name that is to be published in the nuget package +-list(APPEND CERTS_TO_PUBLISH +- base64_MSFT_RCA_2010.cer +- base64_MSFT_RCA_2011.cer +- base64_STORE_PCA_2011.cer +- base64_Windows_Production_PCA_2011.cer +- base64_Windows_Production.cer +- Microsoft_MarketPlace_PCA_2011.cer +-) +-foreach(CERT_TO_PUBLISH ${CERTS_TO_PUBLISH}) +- configure_file(${MSIX_PROJECT_ROOT}/resources/certs/${CERT_TO_PUBLISH} ${MSIX_BINARY_ROOT}/build/certs/${CERT_TO_PUBLISH}) +-endforeach() +-message(STATUS "Certificates published") +-message(STATUS "--------------------------------") +- + message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") + + if((CMAKE_BUILD_TYPE MATCHES RelWithDebInfo) OR (CMAKE_BUILD_TYPE MATCHES Release) OR (CMAKE_BUILD_TYPE MATCHES MinSizeRel)) +@@ -170,9 +88,6 @@ if((MACOS) OR (IOS)) + message(FATAL_ERROR "Unsupported iOS version: ${IOS_DEPLOYMENT_TARGET}, this project requires at least iOS version 10.0") + endif() + endif() +-elseif(AOSP OR LINUX) +- # Static libraries must be position independent to be linked with a shared object. +- set(CMAKE_POSITION_INDEPENDENT_CODE ON) + endif() + + # Mac needed variables +@@ -183,10 +98,9 @@ set(CMAKE_MACOSX_RPATH ON) + #set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + #set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + +-add_subdirectory(lib) +-message(STATUS "libs processed") + add_subdirectory(src) + message(STATUS "src processed") +-add_subdirectory(sample) +-message(STATUS "sample processed") ++ ++install(FILES "LICENSE" DESTINATION licenses) ++ + message(STATUS "DONE!") +diff --git a/cmake/msix_options.cmake b/cmake/msix_options.cmake +index faba2fbe..df115885 100644 +--- a/cmake/msix_options.cmake ++++ b/cmake/msix_options.cmake +@@ -10,10 +10,9 @@ option(LINUX "Build for Linux" OFF) + + option(USE_VALIDATION_PARSER "Turn on to validates using the resouce schemas. Default (OFF) validates XML files are just valid XML" OFF) + option(USE_SHARED_ZLIB "Choose the type of dependency for zlib, Use the -DUSE_SHARED_ZLIB=on to have a shared dependency. Default is 'off' (static)" OFF) +-option(USE_STATIC_MSVC "Windows only. Pass /MT as a compiler flag to use the staic version of the run-time library. Default is 'off' (dynamic)" OFF) + option(SKIP_BUNDLES "Removes bundle functionality from the MSIX SDK. Default is 'off'" OFF) + option(MSIX_PACK "Include packaging features for the MSIX SDK. Not supported for mobile. Default is 'off'" OFF) +-option(USE_MSIX_SDK_ZLIB "Use zlib implementation under lib/zlib. If off, uses inbox compression library. For Windows and Linux this is no-opt." OFF) ++option(USE_EXTERNAL_ZLIB "Use an external zlib package. If off, uses inbox compression library. For Windows and Linux this is no-opt." OFF) + + set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel. Use the -DCMAKE_BUILD_TYPE=[option] to specify.") + set(XML_PARSER "" CACHE STRING "Choose the type of parser, options are: [xerces, msxml6, javaxml]. Use the -DXML_PARSER=[option] to specify.") +@@ -24,19 +23,6 @@ if((NOT WIN32) AND (NOT MACOS) AND (NOT IOS) AND (NOT AOSP) AND (NOT LINUX)) + message(FATAL_ERROR "You must specify one of: -D[WIN32|MACOS|IOS|AOSP|LINUX]=on") + endif() + +-if(USE_STATIC_MSVC) +- if(NOT WIN32) +- message(FATAL_ERROR "-DUSE_STATIC_MSVC=on can only be used for Windows") +- endif() +- # By default these flags have /MD set. Modified it to use /MT instead. +- foreach(buildType RELEASE MINSIZEREL RELWITHDEBINFO) +- set(cxxFlag "CMAKE_CXX_FLAGS_${buildType}") +- string(REPLACE "/MD" "/MT" ${cxxFlag} "${${cxxFlag}}") +- endforeach() +- set(cxxFlagDebug "CMAKE_CXX_FLAGS_DEBUG") +- string(REPLACE "/MDd" "/MTd" ${cxxFlagDebug} "${${cxxFlagDebug}}") +-endif() +- + # Set xml parser if not set + if(NOT XML_PARSER) + if(WIN32) +@@ -70,8 +56,8 @@ if(MSIX_PACK) + if(AOSP OR IOS) + message(FATAL_ERROR "Packaging is not supported for mobile devices.") + elseif(MAC) +- if(NOT USE_MSIX_SDK_ZLIB) +- message(FATAL_ERROR "Using libCompression APIs and packaging features is not supported. Use -DUSE_MSIX_SDK_ZLIB=on") ++ if(NOT USE_EXTERNAL_ZLIB) ++ message(FATAL_ERROR "Using libCompression APIs and packaging features is not supported. Use -DUSE_EXTERNAL_ZLIB=on") + endif() + if(NOT (XML_PARSER MATCHES xerces)) + message(FATAL_ERROR "Xerces is the only supported parser for MacOS pack. Use -DXML_PARSER=xerces") +@@ -84,9 +70,9 @@ endif() + + # Compression + set(COMPRESSION_LIB "zlib") +-if(((IOS) OR (MACOS)) AND (NOT USE_MSIX_SDK_ZLIB)) ++if(((IOS) OR (MACOS)) AND (NOT USE_EXTERNAL_ZLIB)) + set(COMPRESSION_LIB "libCompression") +-elseif((AOSP) AND (NOT USE_MSIX_SDK_ZLIB)) ++elseif((AOSP) AND (NOT USE_EXTERNAL_ZLIB)) + set(COMPRESSION_LIB "inbox zlib") + endif() + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index a2655a7b..5d224b64 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -6,4 +6,3 @@ cmake_minimum_required(VERSION 3.8.0 FATAL_ERROR) + + add_subdirectory(msix) + add_subdirectory(makemsix) +-add_subdirectory(test) +diff --git a/src/makemsix/CMakeLists.txt b/src/makemsix/CMakeLists.txt +index 92b082e6..ebae9789 100644 +--- a/src/makemsix/CMakeLists.txt ++++ b/src/makemsix/CMakeLists.txt +@@ -24,3 +24,6 @@ target_include_directories(${PROJECT_NAME} PRIVATE ${MSIX_BINARY_ROOT}/src/msix) + + add_dependencies(${PROJECT_NAME} msix) + target_link_libraries(${PROJECT_NAME} msix) ++ ++# define installing rules for target files ++install(TARGETS ${PROJECT_NAME}) +diff --git a/src/msix/CMakeLists.txt b/src/msix/CMakeLists.txt +index 75d3afdf..c8ddb23e 100644 +--- a/src/msix/CMakeLists.txt ++++ b/src/msix/CMakeLists.txt +@@ -6,6 +6,11 @@ cmake_minimum_required(VERSION 3.8.0 FATAL_ERROR) + + project(msix) + ++# Define the library ++add_library(${PROJECT_NAME} ++ msix.cpp ++) ++ + # Handle exports and flags we need to set + list(APPEND MSIX_UNPACK_EXPORTS + "UnpackPackage" +@@ -92,10 +97,8 @@ set(LIB_PUBLIC_HEADERS + ../inc/MsixErrors.hpp + ) + +-set(MsixSrc) # list with all the files we are going to use +- + # Common for pack and unpack +-list(APPEND MsixSrc ++target_sources(${PROJECT_NAME} PRIVATE + common/AppxFactory.cpp + common/MSIXResource.cpp + common/Log.cpp +@@ -111,7 +114,7 @@ list(APPEND MsixSrc + ) + + # Unpack. Always add +-list(APPEND MsixSrc ++target_sources(${PROJECT_NAME} PRIVATE + unpack/AppxBlockMapObject.cpp + unpack/AppxPackageObject.cpp + unpack/AppxSignature.cpp +@@ -122,7 +125,7 @@ list(APPEND MsixSrc + # Pack + if(MSIX_PACK) + add_definitions(-DMSIX_PACK=1) +- list(APPEND MsixSrc ++ target_sources(${PROJECT_NAME} PRIVATE + pack/AppxPackageWriter.cpp + pack/XmlWriter.cpp + pack/AppxBlockMapWriter.cpp +@@ -136,47 +139,47 @@ endif() + # Bundle specific files + if(NOT SKIP_BUNDLES) + add_definitions(-DBUNDLE_SUPPORT=1) +- list(APPEND MsixSrc ++ target_sources(${PROJECT_NAME} PRIVATE + unpack/AppxBundleManifest.cpp + unpack/ApplicabilityCommon.cpp + ) + # Applicability. + if (WIN32) +- list(APPEND MsixSrc PAL/Applicability/Win32/Applicability.cpp) ++ target_sources(${PROJECT_NAME} PRIVATE PAL/Applicability/Win32/Applicability.cpp) + elseif(LINUX) +- find_package(ICU REQUIRED COMPONENTS uc) +- list(APPEND MsixSrc PAL/Applicability/Linux/Applicability.cpp) ++ target_sources(${PROJECT_NAME} PRIVATE PAL/Applicability/Linux/Applicability.cpp) ++ target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::icu) + elseif(AOSP) +- list(APPEND MsixSrc PAL/Applicability/AOSP/Applicability.cpp) ++ target_sources(${PROJECT_NAME} PRIVATE PAL/Applicability/AOSP/Applicability.cpp) + else() # iOS and MACOS +- list(APPEND MsixSrc PAL/Applicability/Apple/Applicability.cpp) ++ target_sources(${PROJECT_NAME} PRIVATE PAL/Applicability/Apple/Applicability.cpp) + endif() + endif() + + # Compression option +-if(((IOS) OR (MACOS)) AND (NOT USE_MSIX_SDK_ZLIB)) +- list(APPEND MsixSrc PAL/DataCompression/Apple/CompressionObject.cpp) ++if(((IOS) OR (MACOS)) AND (NOT USE_EXTERNAL_ZLIB)) ++ target_sources(${PROJECT_NAME} PRIVATE PAL/DataCompression/Apple/CompressionObject.cpp) + else() +- list(APPEND MsixSrc PAL/DataCompression/Zlib/CompressionObject.cpp) ++ target_sources(${PROJECT_NAME} PRIVATE PAL/DataCompression/Zlib/CompressionObject.cpp) + endif() + + # Directory object + if(WIN32) +- list(APPEND MsixSrc PAL/FileSystem/Win32/DirectoryObject.cpp) ++ target_sources(${PROJECT_NAME} PRIVATE PAL/FileSystem/Win32/DirectoryObject.cpp) + else() +- list(APPEND MsixSrc PAL/FileSystem/POSIX/DirectoryObject.cpp) ++ target_sources(${PROJECT_NAME} PRIVATE PAL/FileSystem/POSIX/DirectoryObject.cpp) + endif() + + # Xml Parser + if(XML_PARSER MATCHES xerces) +- list(APPEND MsixSrc PAL/XML/xerces-c/XmlObject.cpp) ++ target_sources(${PROJECT_NAME} PRIVATE PAL/XML/xerces-c/XmlObject.cpp) + add_definitions(-DUSING_XERCES=1) + elseif(XML_PARSER MATCHES javaxml) +- list(APPEND MsixSrc PAL/XML/AOSP/XmlObject.cpp) ++ target_sources(${PROJECT_NAME} PRIVATE PAL/XML/AOSP/XmlObject.cpp) + add_definitions(-DUSING_JAVAXML=1) + elseif(XML_PARSER MATCHES applexml) + set(XmlParser) +- list(APPEND MsixSrc ++ target_sources(${PROJECT_NAME} PRIVATE + "PAL/XML/APPLE/XmlObject.cpp" + "PAL/XML/APPLE/NSXmlParserDelegateWrapper.mm" + "PAL/XML/APPLE/NSXmlParserWrapper.mm" +@@ -184,51 +187,38 @@ elseif(XML_PARSER MATCHES applexml) + ) + add_definitions(-DUSING_APPLE_XML=1) + elseif(XML_PARSER MATCHES msxml6) +- list(APPEND MsixSrc PAL/XML/msxml6/XmlObject.cpp) ++ target_sources(${PROJECT_NAME} PRIVATE PAL/XML/msxml6/XmlObject.cpp) + add_definitions(-DUSING_MSXML=1) + endif() + + # Crypto + if(CRYPTO_LIB MATCHES crypt32) +- list(APPEND MsixSrc ++ target_sources(${PROJECT_NAME} PRIVATE + PAL/Crypto/Win32/Crypto.cpp + PAL/Signature/Win32/SignatureValidator.cpp + ) + elseif(CRYPTO_LIB MATCHES openssl) +- if(OpenSSL_FOUND) +- list(APPEND MsixSrc +- PAL/Crypto/OpenSSL/Crypto.cpp +- PAL/Signature/OpenSSL/SignatureValidator.cpp +- ) ++ target_sources(${PROJECT_NAME} PRIVATE ++ PAL/Crypto/OpenSSL/Crypto.cpp ++ PAL/Signature/OpenSSL/SignatureValidator.cpp ++ ) ++ if((IOS) OR (MACOS)) ++ target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::openssl -Wl,-dead_strip) ++ elseif(NOT MSVC) ++ target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::openssl -Wl,--gc-sections) + else() +- # ... and were done here... :/ +- message(FATAL_ERROR "OpenSSL NOT FOUND!") ++ target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::openssl) + endif() + endif() + + # Interop + if(AOSP) +- list(APPEND MsixSrc ++ target_sources(${PROJECT_NAME} PRIVATE + PAL/Interop/AOSP/JniHelper.hpp + PAL/Interop/AOSP/JniHelper.cpp + ) + endif() + +-message(STATUS "Source files:") +-message(STATUS "\tmsix.cpp") +-foreach(FILE ${MsixSrc}) +- message(STATUS "\t${FILE}") +-endforeach() +- +-# Define the library +-add_library(${PROJECT_NAME} SHARED +- msix.cpp +- ${MsixSrc} +-) +- +-# Adding dependency to the third party libs directory +-add_dependencies(${PROJECT_NAME} LIBS) +- + # Copy out public headers to /src/unpack + configure_file(../inc/MSIXWindows.hpp ${CMAKE_CURRENT_BINARY_DIR}/MSIXWindows.hpp ) + configure_file(../inc/AppxPackaging.hpp ${CMAKE_CURRENT_BINARY_DIR}/AppxPackaging.hpp) +@@ -260,14 +250,7 @@ if(WIN32) + "/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll") + string(REPLACE ";" " " DELAYFLAGS "${DELAYFLAGS}") + set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS "${DELAYFLAGS} /LTCG") +- set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " /DEF:windowsexports.def") +- if(USE_STATIC_MSVC) +- if(CMAKE_BUILD_TYPE MATCHES Debug) +- set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " /NODEFAULTLIB:MSVCRTD") +- else() +- set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " /NODEFAULTLIB:MSVCRT") +- endif() +- endif() ++ set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " /DEF:${CMAKE_CURRENT_BINARY_DIR}/windowsexports.def") + target_link_libraries(${PROJECT_NAME} PRIVATE bcrypt crypt32 wintrust runtimeobject.lib delayimp.lib) + endif() + +@@ -279,35 +262,26 @@ set_target_properties(${PROJECT_NAME} PROPERTIES + ) + + # Compression +-if(((IOS) OR (MACOS)) AND (NOT USE_MSIX_SDK_ZLIB)) ++if(((IOS) OR (MACOS)) AND (NOT USE_EXTERNAL_ZLIB)) + # for macos and ios use the inbox libcompression zlib apis instead of zlib, unless zlib is explicitly requested. + target_include_directories(${PROJECT_NAME} PRIVATE ${MSIX_PROJECT_ROOT}/src/msix/PAL/DataCompression/Apple) + target_link_libraries(${PROJECT_NAME} PRIVATE libcompression.dylib) +-elseif((AOSP) AND (NOT USE_MSIX_SDK_ZLIB)) ++elseif((AOSP) AND (NOT USE_EXTERNAL_ZLIB)) + # for AOSP, use the libz.so from the android ndk. +- find_package(ZLIB REQUIRED) + target_link_libraries(${PROJECT_NAME} PRIVATE -lz) +-else() # WIN32 or USE_MSIX_SDK_ZLIB +- target_include_directories(${PROJECT_NAME} PRIVATE +- ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/zlib +- ${MSIX_PROJECT_ROOT}/lib/zlib +- ) ++else() + if(USE_SHARED_ZLIB) + message(STATUS "MSIX takes a dynamic dependency on zlib") +- target_link_libraries(${PROJECT_NAME} PRIVATE zlib) ++ target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::zlib) + else() + message(STATUS "MSIX takes a static dependency on zlib") +- target_link_libraries(${PROJECT_NAME} PRIVATE zlibstatic) ++ target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::zlib) + endif() + endif() + + # Parser + if(XML_PARSER MATCHES xerces) +- target_include_directories(${PROJECT_NAME} PRIVATE +- ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/xerces/src +- ${MSIX_PROJECT_ROOT}/lib/xerces/src +- ) +- target_link_libraries(${PROJECT_NAME} PRIVATE xerces-c) ++ target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::xerces-c) + endif() + + if(XML_PARSER MATCHES applexml) +@@ -363,18 +337,6 @@ endif() + if((IOS) OR (MACOS)) + target_link_libraries(${PROJECT_NAME} PRIVATE ${COREFOUNDATION_LIBRARY} ${FOUNDATION_LIBRARY}) + endif() +-if(LINUX) +- target_link_libraries(${PROJECT_NAME} PRIVATE ${ICU_LIBRARIES}) +-endif() + +-if(OpenSSL_FOUND) +- # include the libraries needed to use OpenSSL +- target_include_directories(${PROJECT_NAME} PRIVATE ${OpenSSL_INCLUDE_PATH}) +- if((IOS) OR (MACOS)) +- target_link_libraries(${PROJECT_NAME} PRIVATE crypto -Wl,-dead_strip) +- elseif(NOT MSVC) +- target_link_libraries(${PROJECT_NAME} PRIVATE crypto -Wl,--gc-sections) +- else() +- target_link_libraries(${PROJECT_NAME} PRIVATE crypto) +- endif() +-endif() ++# define installing rules for target files ++install(TARGETS ${PROJECT_NAME}) diff --git a/recipes/msix/all/patches/1.7/signaturevalidator.patch b/recipes/msix/all/patches/1.7/signaturevalidator.patch new file mode 100644 index 0000000000000..bc8cdf9e699db --- /dev/null +++ b/recipes/msix/all/patches/1.7/signaturevalidator.patch @@ -0,0 +1,39 @@ +diff --git a/src/msix/PAL/Signature/OpenSSL/SignatureValidator.cpp b/src/msix/PAL/Signature/OpenSSL/SignatureValidator.cpp +index 1cc34b20..ccbf68dc 100644 +--- a/src/msix/PAL/Signature/OpenSSL/SignatureValidator.cpp ++++ b/src/msix/PAL/Signature/OpenSSL/SignatureValidator.cpp +@@ -94,11 +94,10 @@ namespace MSIX + STACK_OF(X509) *certStack = p7.get()->d.sign->cert; + for (int i = 0; i < sk_X509_num(certStack); i++) + { +- X509* cert = sk_X509_value(certStack, i); +- STACK_OF(X509_EXTENSION) *exts = cert->cert_info->extensions; +- for (int i = 0; i < sk_X509_EXTENSION_num(exts); i++) ++ X509* cert = sk_X509_value(certStack, i); ++ for (int i = 0; i < X509_get_ext_count(cert); i++) + { +- X509_EXTENSION *ext = sk_X509_EXTENSION_value(exts, i); ++ X509_EXTENSION *ext = X509_get_ext(cert, i); + if (ext) + { + if (X509_EXTENSION_get_object(ext)) +@@ -106,7 +105,7 @@ namespace MSIX + unique_BIO extbio(BIO_new(BIO_s_mem())); + if (!X509V3_EXT_print(extbio.get(), ext, 0, 0)) + { +- M_ASN1_OCTET_STRING_print(extbio.get(), ext->value); ++ M_ASN1_OCTET_STRING_print(extbio.get(), X509_EXTENSION_get_data(ext)); + } + // null terminate the string. + BIO_write(extbio.get(), "", 1); +@@ -207,8 +206,8 @@ namespace MSIX + // If we encounter an expired cert error (which is fine) or a critical extension (most MS + // certs contain MS-specific extensions that OpenSSL doesn't know how to evaluate), + // just return success +- if (!ok && (ctx->error == X509_V_ERR_CERT_HAS_EXPIRED || +- ctx->error == X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION)) ++ if (!ok && (X509_STORE_CTX_get_error(ctx) == X509_V_ERR_CERT_HAS_EXPIRED || ++ X509_STORE_CTX_get_error(ctx) == X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION)) + { + ok = static_cast(true); + } diff --git a/recipes/msix/all/test_package/CMakeLists.txt b/recipes/msix/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..e28b2e2b66dd9 --- /dev/null +++ b/recipes/msix/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_executable(${PROJECT_NAME} example.cpp) + +conan_target_link_libraries(${PROJECT_NAME}) diff --git a/recipes/msix/all/test_package/conanfile.py b/recipes/msix/all/test_package/conanfile.py new file mode 100644 index 0000000000000..4f4ce3d3bb1a0 --- /dev/null +++ b/recipes/msix/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake, tools + + +class MsixTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/msix/all/test_package/example.cpp b/recipes/msix/all/test_package/example.cpp new file mode 100644 index 0000000000000..292160c8862d6 --- /dev/null +++ b/recipes/msix/all/test_package/example.cpp @@ -0,0 +1,26 @@ +#include + +LPVOID STDMETHODCALLTYPE MyAllocate(SIZE_T cb) { + return std::malloc(cb); +} + +void STDMETHODCALLTYPE MyFree(LPVOID pv) { + std::free(pv); +} + +int main() { + IAppxFactory* appxFactory; + + HRESULT creationResult = CoCreateAppxFactoryWithHeap( + MyAllocate, + MyFree, + MSIX_VALIDATION_OPTION::MSIX_VALIDATION_OPTION_FULL, + &appxFactory + ); + + if (FAILED(creationResult)) { + return creationResult; + } + + return 0; +} diff --git a/recipes/msix/config.yml b/recipes/msix/config.yml new file mode 100644 index 0000000000000..a03e932e1cf87 --- /dev/null +++ b/recipes/msix/config.yml @@ -0,0 +1,3 @@ +versions: + "1.7": + folder: "all" From d3388aab98cb938d0f9fb74374e3ec2bc33c60bc Mon Sep 17 00:00:00 2001 From: Croydon Date: Tue, 27 Jul 2021 20:05:35 +0300 Subject: [PATCH 02/18] add msix/1.7 - polish the `source` method --- recipes/msix/all/conanfile.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/recipes/msix/all/conanfile.py b/recipes/msix/all/conanfile.py index 638fce036aa0f..138d63d89df4a 100644 --- a/recipes/msix/all/conanfile.py +++ b/recipes/msix/all/conanfile.py @@ -107,8 +107,7 @@ def requirements(self): self.requires("xerces-c/3.2.3") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("msix-packaging-{}".format(self.version), self._source_subfolder) + tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) def build(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): From 418d594095f0c37d2ff1eb2299fb54a074d0971c Mon Sep 17 00:00:00 2001 From: Croydon Date: Tue, 27 Jul 2021 20:13:27 +0300 Subject: [PATCH 03/18] add msix/1.7 - add required conan version --- recipes/msix/all/conanfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/msix/all/conanfile.py b/recipes/msix/all/conanfile.py index 138d63d89df4a..05a450514e9c6 100644 --- a/recipes/msix/all/conanfile.py +++ b/recipes/msix/all/conanfile.py @@ -3,6 +3,9 @@ from conans.errors import ConanInvalidConfiguration +required_conan_version = ">=1.33.0" + + class MsixConan(ConanFile): name = "msix" license = "MIT" From 0e77bd7ec9eab25036be96cd42fb99bc5297c326 Mon Sep 17 00:00:00 2001 From: vaerizk Date: Wed, 28 Jul 2021 20:48:51 +0300 Subject: [PATCH 04/18] add msix/1.7 - fix the `crypto_lib` option --- recipes/msix/all/conanfile.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/recipes/msix/all/conanfile.py b/recipes/msix/all/conanfile.py index 05a450514e9c6..c30c8c41d0aae 100644 --- a/recipes/msix/all/conanfile.py +++ b/recipes/msix/all/conanfile.py @@ -74,14 +74,14 @@ def config_options(self): def configure(self): if self.settings.os == "Linux" and (self.settings.compiler != "clang"): raise ConanInvalidConfiguration("Only clang is supported on Linux") - if self.settings.os == "Linux" and (self.options.crypto_lib == "crypt32"): - raise ConanInvalidConfiguration("crypt32 is not available on Linux") if self.settings.os == "Linux" and self.options.shared: self.options.fPIC = True if self.settings.os != "Android" and self.options.xml_parser == "javaxml": raise ConanInvalidConfiguration("javaxml is supported only for Android") if self.settings.os != "Macos" and self.options.xml_parser == "applexml": raise ConanInvalidConfiguration("applexml is supported only for MacOS") + if self.settings.os != "Windows" and (self.options.crypto_lib == "crypt32"): + raise ConanInvalidConfiguration("crypt32 is supported only for Windows") if self.settings.os != "Windows" and self.options.xml_parser == "msxml6": raise ConanInvalidConfiguration("msxml6 is supported only for Windows") if self.options.pack: @@ -100,8 +100,6 @@ def configure(self): def requirements(self): if self.settings.os == "Linux" and not self.options.skip_bundles: self.requires("icu/68.2") - if self.settings.os != "Windows" and not self.options.crypto_lib: - self.requires("openssl/1.0.2t") if self.options.crypto_lib == "openssl": self.requires("openssl/1.0.2t") if self.options.use_external_zlib: @@ -126,7 +124,7 @@ def package_info(self): self.cpp_info.libs = tools.collect_libs(self) if self.settings.os == "Windows": self.cpp_info.system_libs = ["runtimeobject"] - if not self.options.crypto_lib or self.options.crypto_lib == "crypt32": + if self.options.crypto_lib == "crypt32": self.cpp_info.system_libs.extend(["bcrypt", "crypt32", "wintrust"]) if self.settings.compiler == "Visual Studio": self.cpp_info.system_libs.append("delayimp") From adc4aa2eff50c366d143b58d79cc8b5d25c97585 Mon Sep 17 00:00:00 2001 From: vaerizk Date: Wed, 28 Jul 2021 21:55:25 +0300 Subject: [PATCH 05/18] add msix/1.7 - add `msxml6` to the list of system libraries --- recipes/msix/all/conanfile.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/recipes/msix/all/conanfile.py b/recipes/msix/all/conanfile.py index c30c8c41d0aae..770f6c6cec381 100644 --- a/recipes/msix/all/conanfile.py +++ b/recipes/msix/all/conanfile.py @@ -124,7 +124,9 @@ def package_info(self): self.cpp_info.libs = tools.collect_libs(self) if self.settings.os == "Windows": self.cpp_info.system_libs = ["runtimeobject"] - if self.options.crypto_lib == "crypt32": - self.cpp_info.system_libs.extend(["bcrypt", "crypt32", "wintrust"]) if self.settings.compiler == "Visual Studio": self.cpp_info.system_libs.append("delayimp") + if self.options.crypto_lib == "crypt32": + self.cpp_info.system_libs.extend(["bcrypt", "crypt32", "wintrust"]) + if self.options.xml_parser == "msxml6": + self.cpp_info.system_libs.append("msxml6") From 9720eefcded0821865cca5d8880c0c30da06aaa4 Mon Sep 17 00:00:00 2001 From: vaerizk Date: Thu, 29 Jul 2021 21:14:03 +0300 Subject: [PATCH 06/18] add msix/1.7 - move configuration checks to `validate()` --- recipes/msix/all/conanfile.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/recipes/msix/all/conanfile.py b/recipes/msix/all/conanfile.py index 770f6c6cec381..9c566b4cb3a67 100644 --- a/recipes/msix/all/conanfile.py +++ b/recipes/msix/all/conanfile.py @@ -67,20 +67,14 @@ def _configure_cmake(self): self._cmake.configure() return self._cmake - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC - - def configure(self): - if self.settings.os == "Linux" and (self.settings.compiler != "clang"): - raise ConanInvalidConfiguration("Only clang is supported on Linux") - if self.settings.os == "Linux" and self.options.shared: - self.options.fPIC = True + def validate(self): if self.settings.os != "Android" and self.options.xml_parser == "javaxml": raise ConanInvalidConfiguration("javaxml is supported only for Android") + if self.settings.os == "Linux" and self.settings.compiler != "clang": + raise ConanInvalidConfiguration("Only clang is supported on Linux") if self.settings.os != "Macos" and self.options.xml_parser == "applexml": raise ConanInvalidConfiguration("applexml is supported only for MacOS") - if self.settings.os != "Windows" and (self.options.crypto_lib == "crypt32"): + if self.settings.os != "Windows" and self.options.crypto_lib == "crypt32": raise ConanInvalidConfiguration("crypt32 is supported only for Windows") if self.settings.os != "Windows" and self.options.xml_parser == "msxml6": raise ConanInvalidConfiguration("msxml6 is supported only for Windows") @@ -88,10 +82,18 @@ def configure(self): if self.settings.os == "Macos": if not self.options.use_external_zlib: raise ConanInvalidConfiguration("Using libCompression APIs and packaging features is not supported") - if self.options.xml_parser and (self.options.xml_parser != "xerces"): + if self.options.xml_parser != "xerces": raise ConanInvalidConfiguration("Xerces is the only supported parser for MacOS pack") if not self.options.use_validation_parser: raise ConanInvalidConfiguration("Packaging requires validation parser") + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.settings.os == "Linux" and self.options.shared: + self.options.fPIC = True if self.options.xml_parser == "xerces": self.options["xerces-c"].char_type = "char16_t" self.options["xerces-c"].shared = False From b082828bdc6aa1d1d99a75f30c25910c75f5e46f Mon Sep 17 00:00:00 2001 From: vaerizk Date: Fri, 30 Jul 2021 21:37:07 +0300 Subject: [PATCH 07/18] add msix/1.7 - set `crypt32` as default for `crypto_lib` on Windows --- recipes/msix/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/msix/all/conanfile.py b/recipes/msix/all/conanfile.py index 9c566b4cb3a67..1e284eda9eeca 100644 --- a/recipes/msix/all/conanfile.py +++ b/recipes/msix/all/conanfile.py @@ -90,6 +90,7 @@ def validate(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + self.options.crypto_lib = "crypt32" def configure(self): if self.settings.os == "Linux" and self.options.shared: From 2290f0ac84616d6c48b5290ac7036e0e1b120803 Mon Sep 17 00:00:00 2001 From: vaerizk Date: Wed, 4 Aug 2021 18:14:18 +0300 Subject: [PATCH 08/18] add msix/1.7 - rework the `fpic` option logic --- recipes/msix/all/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/msix/all/conanfile.py b/recipes/msix/all/conanfile.py index 1e284eda9eeca..b86e81babaca4 100644 --- a/recipes/msix/all/conanfile.py +++ b/recipes/msix/all/conanfile.py @@ -93,8 +93,8 @@ def config_options(self): self.options.crypto_lib = "crypt32" def configure(self): - if self.settings.os == "Linux" and self.options.shared: - self.options.fPIC = True + if self.options.shared: + del self.options.fPIC if self.options.xml_parser == "xerces": self.options["xerces-c"].char_type = "char16_t" self.options["xerces-c"].shared = False From 2fe4bea8d5be2b27ef1dd4de1aa6eb272cdbada5 Mon Sep 17 00:00:00 2001 From: vaerizk Date: Wed, 4 Aug 2021 18:16:55 +0300 Subject: [PATCH 09/18] add msix/1.7 - reorder the conanfile methods --- recipes/msix/all/conanfile.py | 40 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/recipes/msix/all/conanfile.py b/recipes/msix/all/conanfile.py index b86e81babaca4..f5df4545ad2fc 100644 --- a/recipes/msix/all/conanfile.py +++ b/recipes/msix/all/conanfile.py @@ -67,26 +67,6 @@ def _configure_cmake(self): self._cmake.configure() return self._cmake - def validate(self): - if self.settings.os != "Android" and self.options.xml_parser == "javaxml": - raise ConanInvalidConfiguration("javaxml is supported only for Android") - if self.settings.os == "Linux" and self.settings.compiler != "clang": - raise ConanInvalidConfiguration("Only clang is supported on Linux") - if self.settings.os != "Macos" and self.options.xml_parser == "applexml": - raise ConanInvalidConfiguration("applexml is supported only for MacOS") - if self.settings.os != "Windows" and self.options.crypto_lib == "crypt32": - raise ConanInvalidConfiguration("crypt32 is supported only for Windows") - if self.settings.os != "Windows" and self.options.xml_parser == "msxml6": - raise ConanInvalidConfiguration("msxml6 is supported only for Windows") - if self.options.pack: - if self.settings.os == "Macos": - if not self.options.use_external_zlib: - raise ConanInvalidConfiguration("Using libCompression APIs and packaging features is not supported") - if self.options.xml_parser != "xerces": - raise ConanInvalidConfiguration("Xerces is the only supported parser for MacOS pack") - if not self.options.use_validation_parser: - raise ConanInvalidConfiguration("Packaging requires validation parser") - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -110,6 +90,26 @@ def requirements(self): if self.options.xml_parser == "xerces": self.requires("xerces-c/3.2.3") + def validate(self): + if self.settings.os != "Android" and self.options.xml_parser == "javaxml": + raise ConanInvalidConfiguration("javaxml is supported only for Android") + if self.settings.os == "Linux" and self.settings.compiler != "clang": + raise ConanInvalidConfiguration("Only clang is supported on Linux") + if self.settings.os != "Macos" and self.options.xml_parser == "applexml": + raise ConanInvalidConfiguration("applexml is supported only for MacOS") + if self.settings.os != "Windows" and self.options.crypto_lib == "crypt32": + raise ConanInvalidConfiguration("crypt32 is supported only for Windows") + if self.settings.os != "Windows" and self.options.xml_parser == "msxml6": + raise ConanInvalidConfiguration("msxml6 is supported only for Windows") + if self.options.pack: + if self.settings.os == "Macos": + if not self.options.use_external_zlib: + raise ConanInvalidConfiguration("Using libCompression APIs and packaging features is not supported") + if self.options.xml_parser != "xerces": + raise ConanInvalidConfiguration("Xerces is the only supported parser for MacOS pack") + if not self.options.use_validation_parser: + raise ConanInvalidConfiguration("Packaging requires validation parser") + def source(self): tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) From b31d12ab3b234847897ab8ffe8bb32ea606a6b3c Mon Sep 17 00:00:00 2001 From: vaerizk Date: Wed, 4 Aug 2021 18:19:15 +0300 Subject: [PATCH 10/18] add msix/1.7 - switch to `icu/69.1` --- recipes/msix/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/msix/all/conanfile.py b/recipes/msix/all/conanfile.py index f5df4545ad2fc..a6ec651991557 100644 --- a/recipes/msix/all/conanfile.py +++ b/recipes/msix/all/conanfile.py @@ -82,7 +82,7 @@ def configure(self): def requirements(self): if self.settings.os == "Linux" and not self.options.skip_bundles: - self.requires("icu/68.2") + self.requires("icu/69.1") if self.options.crypto_lib == "openssl": self.requires("openssl/1.0.2t") if self.options.use_external_zlib: From b091f336e400f5720143c2c7100bea0645da92f2 Mon Sep 17 00:00:00 2001 From: vaerizk Date: Wed, 4 Aug 2021 18:39:53 +0300 Subject: [PATCH 11/18] add msix/1.7 - fix the test package --- recipes/msix/all/test_package/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/msix/all/test_package/conanfile.py b/recipes/msix/all/test_package/conanfile.py index 4f4ce3d3bb1a0..bee328a3e1aa7 100644 --- a/recipes/msix/all/test_package/conanfile.py +++ b/recipes/msix/all/test_package/conanfile.py @@ -12,6 +12,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): + if not tools.cross_building(self): bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True) From 8d28d2c5f08b8e2f4c6cebb53d6dc021d9b92e7c Mon Sep 17 00:00:00 2001 From: vaerizk Date: Wed, 4 Aug 2021 21:19:48 +0300 Subject: [PATCH 12/18] add msix/1.7 - fix `cppstd` check --- recipes/msix/all/conanfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/msix/all/conanfile.py b/recipes/msix/all/conanfile.py index a6ec651991557..1356adc701f6d 100644 --- a/recipes/msix/all/conanfile.py +++ b/recipes/msix/all/conanfile.py @@ -78,7 +78,8 @@ def configure(self): if self.options.xml_parser == "xerces": self.options["xerces-c"].char_type = "char16_t" self.options["xerces-c"].shared = False - tools.check_min_cppstd(self, "14") + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, "14") def requirements(self): if self.settings.os == "Linux" and not self.options.skip_bundles: From 8f88d744fb2790ba6f83f485dfe4c38da294d0e8 Mon Sep 17 00:00:00 2001 From: vaerizk Date: Wed, 11 Aug 2021 21:17:56 +0300 Subject: [PATCH 13/18] add msix/1.7 - restrict the package --- recipes/msix/all/conanfile.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/recipes/msix/all/conanfile.py b/recipes/msix/all/conanfile.py index 1356adc701f6d..254636649f43d 100644 --- a/recipes/msix/all/conanfile.py +++ b/recipes/msix/all/conanfile.py @@ -33,7 +33,7 @@ class MsixConan(ConanFile): "skip_bundles": False, "use_external_zlib": True, "use_validation_parser": False, - "xml_parser": "xerces" + "xml_parser": "msxml6" } generators = "cmake" @@ -75,9 +75,6 @@ def config_options(self): def configure(self): if self.options.shared: del self.options.fPIC - if self.options.xml_parser == "xerces": - self.options["xerces-c"].char_type = "char16_t" - self.options["xerces-c"].shared = False if self.settings.compiler.get_safe("cppstd"): tools.check_min_cppstd(self, "14") @@ -96,6 +93,9 @@ def validate(self): raise ConanInvalidConfiguration("javaxml is supported only for Android") if self.settings.os == "Linux" and self.settings.compiler != "clang": raise ConanInvalidConfiguration("Only clang is supported on Linux") + # openssl/1.0.2t is not available for Macos+armv8 at the moment + if self.settings.os == "Macos" and self.options.crypto_lib == "openssl": + raise ConanInvalidConfiguration("openssl is not supported for MacOS at the moment") if self.settings.os != "Macos" and self.options.xml_parser == "applexml": raise ConanInvalidConfiguration("applexml is supported only for MacOS") if self.settings.os != "Windows" and self.options.crypto_lib == "crypt32": @@ -110,6 +110,10 @@ def validate(self): raise ConanInvalidConfiguration("Xerces is the only supported parser for MacOS pack") if not self.options.use_validation_parser: raise ConanInvalidConfiguration("Packaging requires validation parser") + # the current CCI xerces-c recipe is not supported + if (self.options.xml_parser == "xerces" and + self.options["xerces-c"].char_type != "char16_t"): + raise ConanInvalidConfiguration("Only char16_t is supported for xerces-c") def source(self): tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) From f25ff8fbc0ce14b40c9da7b14d1ecacde6726158 Mon Sep 17 00:00:00 2001 From: vaerizk Date: Fri, 13 Aug 2021 20:25:59 +0300 Subject: [PATCH 14/18] add msix/1.7 - polish the recipe --- recipes/msix/all/conanfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/msix/all/conanfile.py b/recipes/msix/all/conanfile.py index 254636649f43d..1f61a6b25ce1b 100644 --- a/recipes/msix/all/conanfile.py +++ b/recipes/msix/all/conanfile.py @@ -110,7 +110,6 @@ def validate(self): raise ConanInvalidConfiguration("Xerces is the only supported parser for MacOS pack") if not self.options.use_validation_parser: raise ConanInvalidConfiguration("Packaging requires validation parser") - # the current CCI xerces-c recipe is not supported if (self.options.xml_parser == "xerces" and self.options["xerces-c"].char_type != "char16_t"): raise ConanInvalidConfiguration("Only char16_t is supported for xerces-c") From 1d6d01a088a395ac07835c576cc5b8084e0f5fe3 Mon Sep 17 00:00:00 2001 From: vaerizk Date: Fri, 13 Aug 2021 20:36:14 +0300 Subject: [PATCH 15/18] add msix/1.7 - remove the restriction for openssl --- recipes/msix/all/conanfile.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/recipes/msix/all/conanfile.py b/recipes/msix/all/conanfile.py index 1f61a6b25ce1b..678a3b5e7eaaf 100644 --- a/recipes/msix/all/conanfile.py +++ b/recipes/msix/all/conanfile.py @@ -93,9 +93,6 @@ def validate(self): raise ConanInvalidConfiguration("javaxml is supported only for Android") if self.settings.os == "Linux" and self.settings.compiler != "clang": raise ConanInvalidConfiguration("Only clang is supported on Linux") - # openssl/1.0.2t is not available for Macos+armv8 at the moment - if self.settings.os == "Macos" and self.options.crypto_lib == "openssl": - raise ConanInvalidConfiguration("openssl is not supported for MacOS at the moment") if self.settings.os != "Macos" and self.options.xml_parser == "applexml": raise ConanInvalidConfiguration("applexml is supported only for MacOS") if self.settings.os != "Windows" and self.options.crypto_lib == "crypt32": From 206fea44206765ae57701df12a8bfe511722607d Mon Sep 17 00:00:00 2001 From: vaerizk Date: Mon, 16 Aug 2021 20:10:42 +0300 Subject: [PATCH 16/18] add msix/1.7 - add cxx standard check --- recipes/msix/all/conanfile.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/recipes/msix/all/conanfile.py b/recipes/msix/all/conanfile.py index 678a3b5e7eaaf..96b70668c3633 100644 --- a/recipes/msix/all/conanfile.py +++ b/recipes/msix/all/conanfile.py @@ -41,6 +41,12 @@ class MsixConan(ConanFile): _cmake = None + @property + def _minimum_compilers_version(self): + return { + "Visual Studio": "15" + } + @property def _source_subfolder(self): return "source_subfolder" @@ -67,6 +73,19 @@ def _configure_cmake(self): self._cmake.configure() return self._cmake + def _validate_compiler_settings(self): + compiler = self.settings.compiler + if compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, "17") + + min_version = self._minimum_compilers_version.get(str(self.settings.compiler)) + if not min_version: + self.output.warn("{} recipe lacks information about the {} compiler support.".format( + self.name, self.settings.compiler)) + elif tools.Version(self.settings.compiler.version) < min_version: + raise ConanInvalidConfiguration("{} requires C++17 support. The current compiler {} {} does not support it.".format( + self.name, self.settings.compiler, self.settings.compiler.version)) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -75,8 +94,6 @@ def config_options(self): def configure(self): if self.options.shared: del self.options.fPIC - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "14") def requirements(self): if self.settings.os == "Linux" and not self.options.skip_bundles: @@ -110,6 +127,8 @@ def validate(self): if (self.options.xml_parser == "xerces" and self.options["xerces-c"].char_type != "char16_t"): raise ConanInvalidConfiguration("Only char16_t is supported for xerces-c") + + self._validate_compiler_settings() def source(self): tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) From a3144aa600399cfd7cd535b10d847ed80b658bed Mon Sep 17 00:00:00 2001 From: vaerizk Date: Fri, 20 Aug 2021 22:40:47 +0300 Subject: [PATCH 17/18] add msix/1.7 - reduce the patch size --- recipes/msix/all/CMakeLists.txt | 2 +- recipes/msix/all/conanfile.py | 3 + recipes/msix/all/patches/1.7/cmake.patch | 345 +++++------------------ 3 files changed, 76 insertions(+), 274 deletions(-) diff --git a/recipes/msix/all/CMakeLists.txt b/recipes/msix/all/CMakeLists.txt index 5c33d80b7d7b4..c477e0c1e565e 100644 --- a/recipes/msix/all/CMakeLists.txt +++ b/recipes/msix/all/CMakeLists.txt @@ -2,6 +2,6 @@ cmake_minimum_required(VERSION 2.8.0) project(cmake_wrapper) include(conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(TARGETS) add_subdirectory("source_subfolder") diff --git a/recipes/msix/all/conanfile.py b/recipes/msix/all/conanfile.py index 96b70668c3633..9f55ee898f942 100644 --- a/recipes/msix/all/conanfile.py +++ b/recipes/msix/all/conanfile.py @@ -70,6 +70,8 @@ def _configure_cmake(self): self._cmake.definitions["USE_SHARED_ZLIB"] = self.options["zlib"].shared self._cmake.definitions["USE_VALIDATION_PARSER"] = self.options.use_validation_parser self._cmake.definitions["XML_PARSER"] = self.options.xml_parser + self._cmake.definitions["CALCULATE_VERSION"] = False + self._cmake.definitions["ENABLE_NUGET_PACKAGING"] = False self._cmake.configure() return self._cmake @@ -142,6 +144,7 @@ def build(self): def package(self): cmake = self._configure_cmake() cmake.install() + self.copy("LICENSE", dst="licenses", src=self._source_subfolder) def package_info(self): self.cpp_info.libs = tools.collect_libs(self) diff --git a/recipes/msix/all/patches/1.7/cmake.patch b/recipes/msix/all/patches/1.7/cmake.patch index b01387ce90a44..0ce1960532a1a 100644 --- a/recipes/msix/all/patches/1.7/cmake.patch +++ b/recipes/msix/all/patches/1.7/cmake.patch @@ -1,138 +1,68 @@ - CMakeLists.txt | 102 +++--------------------------------- - cmake/msix_options.cmake | 24 ++------- - src/CMakeLists.txt | 1 - - src/makemsix/CMakeLists.txt | 3 ++ - src/msix/CMakeLists.txt | 124 +++++++++++++++----------------------------- - 5 files changed, 59 insertions(+), 195 deletions(-) + CMakeLists.txt | 18 ++++++----- + cmake/msix_options.cmake | 10 +++---- + src/CMakeLists.txt | 1 - + src/makemsix/CMakeLists.txt | 3 ++ + src/msix/CMakeLists.txt | 73 ++++++++++++++++----------------------------- + 5 files changed, 45 insertions(+), 60 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index dc5908cd..c65cbf0f 100644 +index dc5908cd..447bd44b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -5,6 +5,9 @@ cmake_minimum_required(VERSION 3.8.0 FATAL_ERROR) - project(msix-sdk) - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) - -+include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -+conan_basic_setup(TARGETS) -+ - message(STATUS "--------------------------------") - message(STATUS "MSIX Packaging SDK") - message(STATUS "--------------------------------") -@@ -21,12 +24,6 @@ if(POLICY CMP0077) +@@ -21,11 +21,13 @@ if(POLICY CMP0077) cmake_policy(SET CMP0077 NEW) endif() --# Default version is 0.0.0 --set(VERSION_MAJOR "0") --set(VERSION_MINOR "0") --set(VERSION_PATCH "0") --set(GIT_BRANCH_NAME "master") -- ++if(CALCULATE_VERSION) + # Default version is 0.0.0 + set(VERSION_MAJOR "0") + set(VERSION_MINOR "0") + set(VERSION_PATCH "0") + set(GIT_BRANCH_NAME "master") ++endif() + # CMake useful variables set(MSIX_PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) - set(MSIX_BINARY_ROOT ${CMAKE_CURRENT_BINARY_DIR}) -@@ -35,97 +32,18 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin") +@@ -35,6 +37,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib") --## Git (and its revision) --find_package(Git) # QUIET) # if we don't find git or FindGit.cmake is not on the system we ignore it. -- --## GetGitRevisionDescription module to retreive branch and revision information from Git --## Starting with Git 1.9 the module will be part of official cMake distribution, until then it has to be --## part of the application --## The Git module will trigger a reconfiguration for each pull that will bring a new revision on the local repository --set(VCS_REVISION "-1") --if(GIT_FOUND) -- include(GetGitRevisionDescription) -- get_git_head_revision(GIT_REFSPEC GIT_SHA1) -- message(STATUS "GIT refspec ${GIT_REFSPEC}") -- message(STATUS "GIT revision ${GIT_SHA1}") -- set(VCS_REVISION ${GIT_SHA1}) -- -- git_describe(GIT_DESCRIPTION) -- message(STATUS "GIT Description '${GIT_DESCRIPTION}'" ) -- string(REGEX MATCH "v([0-9]+)\\.([0-9]+)\\-([0-9]+)" _dummy1 "${GIT_DESCRIPTION}") -- set(VERSION_MAJOR ${CMAKE_MATCH_1}) -- set(VERSION_MINOR ${CMAKE_MATCH_2}) -- set(VERSION_PATCH ${CMAKE_MATCH_3}) -- -- if(NOT VERSION_PATCH) -- message(STATUS "GIT Description is from NEW tag") -- string(REGEX MATCH "v([0-9]+)\\.([0-9]+)" _dummy2 "${GIT_DESCRIPTION}") -- set(VERSION_MAJOR ${CMAKE_MATCH_1}) -- set(VERSION_MINOR ${CMAKE_MATCH_2}) -- set(VERSION_PATCH "0") -- endif() -- -- if(NOT ${GIT_REFSPEC}) -- string(REGEX MATCH "refs/heads/([a-zA-Z0-9_/]+)" _dummy3 ${GIT_REFSPEC}) -- set(GIT_BRANCH_NAME ${CMAKE_MATCH_1}) -- else() -- # VSO doesn't checkout a branch do a pull, it checks out a hash and does a pull -- set(GIT_BRANCH_NAME "master") -- endif() -- -- message(STATUS "GIT branch name '${GIT_BRANCH_NAME}'" ) --else() -- message("git not found.") --endif() -- ++if(CALCULATE_VERSION) + ## Git (and its revision) + find_package(Git) # QUIET) # if we don't find git or FindGit.cmake is not on the system we ignore it. + +@@ -77,15 +80,22 @@ if(GIT_FOUND) + else() + message("git not found.") + endif() ++endif() + ++if(CALCULATE_VERSION) # Set the version number of your project here (format is MAJOR.MINOR.PATCHLEVEL - e.g. 1.0.0) --set(MSIX_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) --message(STATUS "MSIX Packaging SDK version ${MSIX_VERSION}") --message(STATUS "MSIX Packaging SDK branch name ${GIT_BRANCH_NAME}") --add_definitions(-DSDK_VERSION="${MSIX_VERSION}") + set(MSIX_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) + message(STATUS "MSIX Packaging SDK version ${MSIX_VERSION}") + message(STATUS "MSIX Packaging SDK branch name ${GIT_BRANCH_NAME}") + add_definitions(-DSDK_VERSION="${MSIX_VERSION}") ++else() +message(STATUS "MSIX Packaging SDK version ${PROJECT_VERSION}") +add_definitions(-DSDK_VERSION="${PROJECT_VERSION}") ++endif() # Validates CMake options. include(msix_options) --# Configure Package.nuspec --if(WIN32) -- set(MSIX_NUGET_NAME "Microsoft.MSIX.Packaging.Windows") --elseif(MACOS) -- set(MSIX_NUGET_NAME "Microsoft.MSIX.Packaging.MacOS") --elseif(IOS) -- set(MSIX_NUGET_NAME "Microsoft.MSIX.Packaging.iOS") --elseif(AOSP) -- set(MSIX_NUGET_NAME "Microsoft.MSIX.Packaging.AOSP") --else() -- set(MSIX_NUGET_NAME "Microsoft.MSIX.Packaging.Linux") --endif() -- --configure_file(${MSIX_PROJECT_ROOT}/Package.nuspec.cmakein ${MSIX_BINARY_ROOT}/Package.nuspec CRLF) --configure_file(${MSIX_PROJECT_ROOT}/Microsoft.MSIX.Packaging.targets ${MSIX_BINARY_ROOT}/build/native/${MSIX_NUGET_NAME}.targets) --message(STATUS "Package.Nuspec created") --message(STATUS "--------------------------------") -- - # Configure license txt - configure_file(${MSIX_PROJECT_ROOT}/LICENSE ${MSIX_BINARY_ROOT}/build/LICENSE) - configure_file(${MSIX_PROJECT_ROOT}/THIRD\ PARTY\ CODE\ NOTICE ${MSIX_BINARY_ROOT}/build/THIRD\ PARTY\ CODE\ NOTICE) - message(STATUS "LICENSE created") ++if(ENABLE_NUGET_PACKAGING) + # Configure Package.nuspec + if(WIN32) + set(MSIX_NUGET_NAME "Microsoft.MSIX.Packaging.Windows") +@@ -103,6 +113,7 @@ configure_file(${MSIX_PROJECT_ROOT}/Package.nuspec.cmakein ${MSIX_BINARY_ROOT}/P + configure_file(${MSIX_PROJECT_ROOT}/Microsoft.MSIX.Packaging.targets ${MSIX_BINARY_ROOT}/build/native/${MSIX_NUGET_NAME}.targets) + message(STATUS "Package.Nuspec created") message(STATUS "--------------------------------") ++endif() --# Configure certificates --# list each certificate by name that is to be published in the nuget package --list(APPEND CERTS_TO_PUBLISH -- base64_MSFT_RCA_2010.cer -- base64_MSFT_RCA_2011.cer -- base64_STORE_PCA_2011.cer -- base64_Windows_Production_PCA_2011.cer -- base64_Windows_Production.cer -- Microsoft_MarketPlace_PCA_2011.cer --) --foreach(CERT_TO_PUBLISH ${CERTS_TO_PUBLISH}) -- configure_file(${MSIX_PROJECT_ROOT}/resources/certs/${CERT_TO_PUBLISH} ${MSIX_BINARY_ROOT}/build/certs/${CERT_TO_PUBLISH}) --endforeach() --message(STATUS "Certificates published") --message(STATUS "--------------------------------") -- - message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") - - if((CMAKE_BUILD_TYPE MATCHES RelWithDebInfo) OR (CMAKE_BUILD_TYPE MATCHES Release) OR (CMAKE_BUILD_TYPE MATCHES MinSizeRel)) -@@ -170,9 +88,6 @@ if((MACOS) OR (IOS)) + # Configure license txt + configure_file(${MSIX_PROJECT_ROOT}/LICENSE ${MSIX_BINARY_ROOT}/build/LICENSE) +@@ -170,9 +181,6 @@ if((MACOS) OR (IOS)) message(FATAL_ERROR "Unsupported iOS version: ${IOS_DEPLOYMENT_TARGET}, this project requires at least iOS version 10.0") endif() endif() @@ -142,7 +72,7 @@ index dc5908cd..c65cbf0f 100644 endif() # Mac needed variables -@@ -183,10 +98,9 @@ set(CMAKE_MACOSX_RPATH ON) +@@ -183,10 +191,6 @@ set(CMAKE_MACOSX_RPATH ON) #set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") #set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) @@ -152,19 +82,13 @@ index dc5908cd..c65cbf0f 100644 message(STATUS "src processed") -add_subdirectory(sample) -message(STATUS "sample processed") -+ -+install(FILES "LICENSE" DESTINATION licenses) -+ message(STATUS "DONE!") diff --git a/cmake/msix_options.cmake b/cmake/msix_options.cmake -index faba2fbe..df115885 100644 +index faba2fbe..5ccdb087 100644 --- a/cmake/msix_options.cmake +++ b/cmake/msix_options.cmake -@@ -10,10 +10,9 @@ option(LINUX "Build for Linux" OFF) - - option(USE_VALIDATION_PARSER "Turn on to validates using the resouce schemas. Default (OFF) validates XML files are just valid XML" OFF) - option(USE_SHARED_ZLIB "Choose the type of dependency for zlib, Use the -DUSE_SHARED_ZLIB=on to have a shared dependency. Default is 'off' (static)" OFF) --option(USE_STATIC_MSVC "Windows only. Pass /MT as a compiler flag to use the staic version of the run-time library. Default is 'off' (dynamic)" OFF) +@@ -13,7 +13,7 @@ option(USE_SHARED_ZLIB "Choose the type of dependency for zlib, Use the -DUSE_SH + option(USE_STATIC_MSVC "Windows only. Pass /MT as a compiler flag to use the staic version of the run-time library. Default is 'off' (dynamic)" OFF) option(SKIP_BUNDLES "Removes bundle functionality from the MSIX SDK. Default is 'off'" OFF) option(MSIX_PACK "Include packaging features for the MSIX SDK. Not supported for mobile. Default is 'off'" OFF) -option(USE_MSIX_SDK_ZLIB "Use zlib implementation under lib/zlib. If off, uses inbox compression library. For Windows and Linux this is no-opt." OFF) @@ -172,27 +96,7 @@ index faba2fbe..df115885 100644 set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel. Use the -DCMAKE_BUILD_TYPE=[option] to specify.") set(XML_PARSER "" CACHE STRING "Choose the type of parser, options are: [xerces, msxml6, javaxml]. Use the -DXML_PARSER=[option] to specify.") -@@ -24,19 +23,6 @@ if((NOT WIN32) AND (NOT MACOS) AND (NOT IOS) AND (NOT AOSP) AND (NOT LINUX)) - message(FATAL_ERROR "You must specify one of: -D[WIN32|MACOS|IOS|AOSP|LINUX]=on") - endif() - --if(USE_STATIC_MSVC) -- if(NOT WIN32) -- message(FATAL_ERROR "-DUSE_STATIC_MSVC=on can only be used for Windows") -- endif() -- # By default these flags have /MD set. Modified it to use /MT instead. -- foreach(buildType RELEASE MINSIZEREL RELWITHDEBINFO) -- set(cxxFlag "CMAKE_CXX_FLAGS_${buildType}") -- string(REPLACE "/MD" "/MT" ${cxxFlag} "${${cxxFlag}}") -- endforeach() -- set(cxxFlagDebug "CMAKE_CXX_FLAGS_DEBUG") -- string(REPLACE "/MDd" "/MTd" ${cxxFlagDebug} "${${cxxFlagDebug}}") --endif() -- - # Set xml parser if not set - if(NOT XML_PARSER) - if(WIN32) -@@ -70,8 +56,8 @@ if(MSIX_PACK) +@@ -70,8 +70,8 @@ if(MSIX_PACK) if(AOSP OR IOS) message(FATAL_ERROR "Packaging is not supported for mobile devices.") elseif(MAC) @@ -203,7 +107,7 @@ index faba2fbe..df115885 100644 endif() if(NOT (XML_PARSER MATCHES xerces)) message(FATAL_ERROR "Xerces is the only supported parser for MacOS pack. Use -DXML_PARSER=xerces") -@@ -84,9 +70,9 @@ endif() +@@ -84,9 +84,9 @@ endif() # Compression set(COMPRESSION_LIB "zlib") @@ -236,7 +140,7 @@ index 92b082e6..ebae9789 100644 +# define installing rules for target files +install(TARGETS ${PROJECT_NAME}) diff --git a/src/msix/CMakeLists.txt b/src/msix/CMakeLists.txt -index 75d3afdf..c8ddb23e 100644 +index 75d3afdf..17f313be 100644 --- a/src/msix/CMakeLists.txt +++ b/src/msix/CMakeLists.txt @@ -6,6 +6,11 @@ cmake_minimum_required(VERSION 3.8.0 FATAL_ERROR) @@ -251,112 +155,25 @@ index 75d3afdf..c8ddb23e 100644 # Handle exports and flags we need to set list(APPEND MSIX_UNPACK_EXPORTS "UnpackPackage" -@@ -92,10 +97,8 @@ set(LIB_PUBLIC_HEADERS - ../inc/MsixErrors.hpp - ) - --set(MsixSrc) # list with all the files we are going to use -- - # Common for pack and unpack --list(APPEND MsixSrc -+target_sources(${PROJECT_NAME} PRIVATE - common/AppxFactory.cpp - common/MSIXResource.cpp - common/Log.cpp -@@ -111,7 +114,7 @@ list(APPEND MsixSrc - ) - - # Unpack. Always add --list(APPEND MsixSrc -+target_sources(${PROJECT_NAME} PRIVATE - unpack/AppxBlockMapObject.cpp - unpack/AppxPackageObject.cpp - unpack/AppxSignature.cpp -@@ -122,7 +125,7 @@ list(APPEND MsixSrc - # Pack - if(MSIX_PACK) - add_definitions(-DMSIX_PACK=1) -- list(APPEND MsixSrc -+ target_sources(${PROJECT_NAME} PRIVATE - pack/AppxPackageWriter.cpp - pack/XmlWriter.cpp - pack/AppxBlockMapWriter.cpp -@@ -136,47 +139,47 @@ endif() - # Bundle specific files - if(NOT SKIP_BUNDLES) - add_definitions(-DBUNDLE_SUPPORT=1) -- list(APPEND MsixSrc -+ target_sources(${PROJECT_NAME} PRIVATE - unpack/AppxBundleManifest.cpp - unpack/ApplicabilityCommon.cpp - ) - # Applicability. +@@ -144,7 +149,7 @@ if(NOT SKIP_BUNDLES) if (WIN32) -- list(APPEND MsixSrc PAL/Applicability/Win32/Applicability.cpp) -+ target_sources(${PROJECT_NAME} PRIVATE PAL/Applicability/Win32/Applicability.cpp) + list(APPEND MsixSrc PAL/Applicability/Win32/Applicability.cpp) elseif(LINUX) - find_package(ICU REQUIRED COMPONENTS uc) -- list(APPEND MsixSrc PAL/Applicability/Linux/Applicability.cpp) -+ target_sources(${PROJECT_NAME} PRIVATE PAL/Applicability/Linux/Applicability.cpp) + target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::icu) + list(APPEND MsixSrc PAL/Applicability/Linux/Applicability.cpp) elseif(AOSP) -- list(APPEND MsixSrc PAL/Applicability/AOSP/Applicability.cpp) -+ target_sources(${PROJECT_NAME} PRIVATE PAL/Applicability/AOSP/Applicability.cpp) - else() # iOS and MACOS -- list(APPEND MsixSrc PAL/Applicability/Apple/Applicability.cpp) -+ target_sources(${PROJECT_NAME} PRIVATE PAL/Applicability/Apple/Applicability.cpp) - endif() + list(APPEND MsixSrc PAL/Applicability/AOSP/Applicability.cpp) +@@ -154,7 +159,7 @@ if(NOT SKIP_BUNDLES) endif() # Compression option -if(((IOS) OR (MACOS)) AND (NOT USE_MSIX_SDK_ZLIB)) -- list(APPEND MsixSrc PAL/DataCompression/Apple/CompressionObject.cpp) +if(((IOS) OR (MACOS)) AND (NOT USE_EXTERNAL_ZLIB)) -+ target_sources(${PROJECT_NAME} PRIVATE PAL/DataCompression/Apple/CompressionObject.cpp) - else() -- list(APPEND MsixSrc PAL/DataCompression/Zlib/CompressionObject.cpp) -+ target_sources(${PROJECT_NAME} PRIVATE PAL/DataCompression/Zlib/CompressionObject.cpp) - endif() - - # Directory object - if(WIN32) -- list(APPEND MsixSrc PAL/FileSystem/Win32/DirectoryObject.cpp) -+ target_sources(${PROJECT_NAME} PRIVATE PAL/FileSystem/Win32/DirectoryObject.cpp) + list(APPEND MsixSrc PAL/DataCompression/Apple/CompressionObject.cpp) else() -- list(APPEND MsixSrc PAL/FileSystem/POSIX/DirectoryObject.cpp) -+ target_sources(${PROJECT_NAME} PRIVATE PAL/FileSystem/POSIX/DirectoryObject.cpp) - endif() - - # Xml Parser - if(XML_PARSER MATCHES xerces) -- list(APPEND MsixSrc PAL/XML/xerces-c/XmlObject.cpp) -+ target_sources(${PROJECT_NAME} PRIVATE PAL/XML/xerces-c/XmlObject.cpp) - add_definitions(-DUSING_XERCES=1) - elseif(XML_PARSER MATCHES javaxml) -- list(APPEND MsixSrc PAL/XML/AOSP/XmlObject.cpp) -+ target_sources(${PROJECT_NAME} PRIVATE PAL/XML/AOSP/XmlObject.cpp) - add_definitions(-DUSING_JAVAXML=1) - elseif(XML_PARSER MATCHES applexml) - set(XmlParser) -- list(APPEND MsixSrc -+ target_sources(${PROJECT_NAME} PRIVATE - "PAL/XML/APPLE/XmlObject.cpp" - "PAL/XML/APPLE/NSXmlParserDelegateWrapper.mm" - "PAL/XML/APPLE/NSXmlParserWrapper.mm" -@@ -184,51 +187,38 @@ elseif(XML_PARSER MATCHES applexml) - ) - add_definitions(-DUSING_APPLE_XML=1) - elseif(XML_PARSER MATCHES msxml6) -- list(APPEND MsixSrc PAL/XML/msxml6/XmlObject.cpp) -+ target_sources(${PROJECT_NAME} PRIVATE PAL/XML/msxml6/XmlObject.cpp) - add_definitions(-DUSING_MSXML=1) - endif() - - # Crypto - if(CRYPTO_LIB MATCHES crypt32) -- list(APPEND MsixSrc -+ target_sources(${PROJECT_NAME} PRIVATE - PAL/Crypto/Win32/Crypto.cpp + list(APPEND MsixSrc PAL/DataCompression/Zlib/CompressionObject.cpp) +@@ -195,14 +200,16 @@ if(CRYPTO_LIB MATCHES crypt32) PAL/Signature/Win32/SignatureValidator.cpp ) elseif(CRYPTO_LIB MATCHES openssl) @@ -365,7 +182,7 @@ index 75d3afdf..c8ddb23e 100644 - PAL/Crypto/OpenSSL/Crypto.cpp - PAL/Signature/OpenSSL/SignatureValidator.cpp - ) -+ target_sources(${PROJECT_NAME} PRIVATE ++ list(APPEND MsixSrc + PAL/Crypto/OpenSSL/Crypto.cpp + PAL/Signature/OpenSSL/SignatureValidator.cpp + ) @@ -380,21 +197,10 @@ index 75d3afdf..c8ddb23e 100644 endif() endif() - # Interop - if(AOSP) -- list(APPEND MsixSrc -+ target_sources(${PROJECT_NAME} PRIVATE - PAL/Interop/AOSP/JniHelper.hpp - PAL/Interop/AOSP/JniHelper.cpp - ) - endif() +@@ -220,14 +227,7 @@ foreach(FILE ${MsixSrc}) + message(STATUS "\t${FILE}") + endforeach() --message(STATUS "Source files:") --message(STATUS "\tmsix.cpp") --foreach(FILE ${MsixSrc}) -- message(STATUS "\t${FILE}") --endforeach() -- -# Define the library -add_library(${PROJECT_NAME} SHARED - msix.cpp @@ -403,27 +209,20 @@ index 75d3afdf..c8ddb23e 100644 - -# Adding dependency to the third party libs directory -add_dependencies(${PROJECT_NAME} LIBS) -- ++target_sources(${PROJECT_NAME} PRIVATE ${MsixSrc}) + # Copy out public headers to /src/unpack configure_file(../inc/MSIXWindows.hpp ${CMAKE_CURRENT_BINARY_DIR}/MSIXWindows.hpp ) - configure_file(../inc/AppxPackaging.hpp ${CMAKE_CURRENT_BINARY_DIR}/AppxPackaging.hpp) -@@ -260,14 +250,7 @@ if(WIN32) +@@ -260,7 +260,7 @@ if(WIN32) "/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll") string(REPLACE ";" " " DELAYFLAGS "${DELAYFLAGS}") set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS "${DELAYFLAGS} /LTCG") - set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " /DEF:windowsexports.def") -- if(USE_STATIC_MSVC) -- if(CMAKE_BUILD_TYPE MATCHES Debug) -- set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " /NODEFAULTLIB:MSVCRTD") -- else() -- set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " /NODEFAULTLIB:MSVCRT") -- endif() -- endif() + set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " /DEF:${CMAKE_CURRENT_BINARY_DIR}/windowsexports.def") - target_link_libraries(${PROJECT_NAME} PRIVATE bcrypt crypt32 wintrust runtimeobject.lib delayimp.lib) - endif() - -@@ -279,35 +262,26 @@ set_target_properties(${PROJECT_NAME} PROPERTIES + if(USE_STATIC_MSVC) + if(CMAKE_BUILD_TYPE MATCHES Debug) + set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " /NODEFAULTLIB:MSVCRTD") +@@ -279,35 +279,26 @@ set_target_properties(${PROJECT_NAME} PROPERTIES ) # Compression @@ -465,7 +264,7 @@ index 75d3afdf..c8ddb23e 100644 endif() if(XML_PARSER MATCHES applexml) -@@ -363,18 +337,6 @@ endif() +@@ -363,18 +354,6 @@ endif() if((IOS) OR (MACOS)) target_link_libraries(${PROJECT_NAME} PRIVATE ${COREFOUNDATION_LIBRARY} ${FOUNDATION_LIBRARY}) endif() From e050a90f69494cd24755a65778701df358a08588 Mon Sep 17 00:00:00 2001 From: vaerizk Date: Mon, 23 Aug 2021 19:06:22 +0300 Subject: [PATCH 18/18] add msix/1.7 - revert the `USE_MSIX_SDK_ZLIB` option renaming --- recipes/msix/all/conanfile.py | 2 +- recipes/msix/all/patches/1.7/cmake.patch | 68 +++--------------------- 2 files changed, 8 insertions(+), 62 deletions(-) diff --git a/recipes/msix/all/conanfile.py b/recipes/msix/all/conanfile.py index 9f55ee898f942..470d43cd5b916 100644 --- a/recipes/msix/all/conanfile.py +++ b/recipes/msix/all/conanfile.py @@ -66,7 +66,7 @@ def _configure_cmake(self): self._cmake.definitions["MSIX_SAMPLES"] = False self._cmake.definitions["MSIX_TESTS"] = False self._cmake.definitions["SKIP_BUNDLES"] = self.options.skip_bundles - self._cmake.definitions["USE_EXTERNAL_ZLIB"] = self.options.use_external_zlib + self._cmake.definitions["USE_MSIX_SDK_ZLIB"] = self.options.use_external_zlib self._cmake.definitions["USE_SHARED_ZLIB"] = self.options["zlib"].shared self._cmake.definitions["USE_VALIDATION_PARSER"] = self.options.use_validation_parser self._cmake.definitions["XML_PARSER"] = self.options.xml_parser diff --git a/recipes/msix/all/patches/1.7/cmake.patch b/recipes/msix/all/patches/1.7/cmake.patch index 0ce1960532a1a..b64f3d1cd79c0 100644 --- a/recipes/msix/all/patches/1.7/cmake.patch +++ b/recipes/msix/all/patches/1.7/cmake.patch @@ -1,12 +1,11 @@ - CMakeLists.txt | 18 ++++++----- - cmake/msix_options.cmake | 10 +++---- + CMakeLists.txt | 18 +++++++----- src/CMakeLists.txt | 1 - src/makemsix/CMakeLists.txt | 3 ++ - src/msix/CMakeLists.txt | 73 ++++++++++++++++----------------------------- - 5 files changed, 45 insertions(+), 60 deletions(-) + src/msix/CMakeLists.txt | 67 ++++++++++++++++----------------------------- + 4 files changed, 37 insertions(+), 52 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index dc5908cd..447bd44b 100644 +index dc5908cd..b2e857a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,11 +21,13 @@ if(POLICY CMP0077) @@ -83,42 +82,6 @@ index dc5908cd..447bd44b 100644 -add_subdirectory(sample) -message(STATUS "sample processed") message(STATUS "DONE!") -diff --git a/cmake/msix_options.cmake b/cmake/msix_options.cmake -index faba2fbe..5ccdb087 100644 ---- a/cmake/msix_options.cmake -+++ b/cmake/msix_options.cmake -@@ -13,7 +13,7 @@ option(USE_SHARED_ZLIB "Choose the type of dependency for zlib, Use the -DUSE_SH - option(USE_STATIC_MSVC "Windows only. Pass /MT as a compiler flag to use the staic version of the run-time library. Default is 'off' (dynamic)" OFF) - option(SKIP_BUNDLES "Removes bundle functionality from the MSIX SDK. Default is 'off'" OFF) - option(MSIX_PACK "Include packaging features for the MSIX SDK. Not supported for mobile. Default is 'off'" OFF) --option(USE_MSIX_SDK_ZLIB "Use zlib implementation under lib/zlib. If off, uses inbox compression library. For Windows and Linux this is no-opt." OFF) -+option(USE_EXTERNAL_ZLIB "Use an external zlib package. If off, uses inbox compression library. For Windows and Linux this is no-opt." OFF) - - set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel. Use the -DCMAKE_BUILD_TYPE=[option] to specify.") - set(XML_PARSER "" CACHE STRING "Choose the type of parser, options are: [xerces, msxml6, javaxml]. Use the -DXML_PARSER=[option] to specify.") -@@ -70,8 +70,8 @@ if(MSIX_PACK) - if(AOSP OR IOS) - message(FATAL_ERROR "Packaging is not supported for mobile devices.") - elseif(MAC) -- if(NOT USE_MSIX_SDK_ZLIB) -- message(FATAL_ERROR "Using libCompression APIs and packaging features is not supported. Use -DUSE_MSIX_SDK_ZLIB=on") -+ if(NOT USE_EXTERNAL_ZLIB) -+ message(FATAL_ERROR "Using libCompression APIs and packaging features is not supported. Use -DUSE_EXTERNAL_ZLIB=on") - endif() - if(NOT (XML_PARSER MATCHES xerces)) - message(FATAL_ERROR "Xerces is the only supported parser for MacOS pack. Use -DXML_PARSER=xerces") -@@ -84,9 +84,9 @@ endif() - - # Compression - set(COMPRESSION_LIB "zlib") --if(((IOS) OR (MACOS)) AND (NOT USE_MSIX_SDK_ZLIB)) -+if(((IOS) OR (MACOS)) AND (NOT USE_EXTERNAL_ZLIB)) - set(COMPRESSION_LIB "libCompression") --elseif((AOSP) AND (NOT USE_MSIX_SDK_ZLIB)) -+elseif((AOSP) AND (NOT USE_EXTERNAL_ZLIB)) - set(COMPRESSION_LIB "inbox zlib") - endif() - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a2655a7b..5d224b64 100644 --- a/src/CMakeLists.txt @@ -140,7 +103,7 @@ index 92b082e6..ebae9789 100644 +# define installing rules for target files +install(TARGETS ${PROJECT_NAME}) diff --git a/src/msix/CMakeLists.txt b/src/msix/CMakeLists.txt -index 75d3afdf..17f313be 100644 +index 75d3afdf..e1fb2984 100644 --- a/src/msix/CMakeLists.txt +++ b/src/msix/CMakeLists.txt @@ -6,6 +6,11 @@ cmake_minimum_required(VERSION 3.8.0 FATAL_ERROR) @@ -164,15 +127,6 @@ index 75d3afdf..17f313be 100644 list(APPEND MsixSrc PAL/Applicability/Linux/Applicability.cpp) elseif(AOSP) list(APPEND MsixSrc PAL/Applicability/AOSP/Applicability.cpp) -@@ -154,7 +159,7 @@ if(NOT SKIP_BUNDLES) - endif() - - # Compression option --if(((IOS) OR (MACOS)) AND (NOT USE_MSIX_SDK_ZLIB)) -+if(((IOS) OR (MACOS)) AND (NOT USE_EXTERNAL_ZLIB)) - list(APPEND MsixSrc PAL/DataCompression/Apple/CompressionObject.cpp) - else() - list(APPEND MsixSrc PAL/DataCompression/Zlib/CompressionObject.cpp) @@ -195,14 +200,16 @@ if(CRYPTO_LIB MATCHES crypt32) PAL/Signature/Win32/SignatureValidator.cpp ) @@ -222,17 +176,9 @@ index 75d3afdf..17f313be 100644 if(USE_STATIC_MSVC) if(CMAKE_BUILD_TYPE MATCHES Debug) set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " /NODEFAULTLIB:MSVCRTD") -@@ -279,35 +279,26 @@ set_target_properties(${PROJECT_NAME} PROPERTIES - ) - - # Compression --if(((IOS) OR (MACOS)) AND (NOT USE_MSIX_SDK_ZLIB)) -+if(((IOS) OR (MACOS)) AND (NOT USE_EXTERNAL_ZLIB)) - # for macos and ios use the inbox libcompression zlib apis instead of zlib, unless zlib is explicitly requested. - target_include_directories(${PROJECT_NAME} PRIVATE ${MSIX_PROJECT_ROOT}/src/msix/PAL/DataCompression/Apple) +@@ -285,29 +285,20 @@ if(((IOS) OR (MACOS)) AND (NOT USE_MSIX_SDK_ZLIB)) target_link_libraries(${PROJECT_NAME} PRIVATE libcompression.dylib) --elseif((AOSP) AND (NOT USE_MSIX_SDK_ZLIB)) -+elseif((AOSP) AND (NOT USE_EXTERNAL_ZLIB)) + elseif((AOSP) AND (NOT USE_MSIX_SDK_ZLIB)) # for AOSP, use the libz.so from the android ndk. - find_package(ZLIB REQUIRED) target_link_libraries(${PROJECT_NAME} PRIVATE -lz)