Deprecate MSIX_VALIDATION_OPTION_SKIPAPPXMANIFEST and improve CMake MSIX SDK option processing (#177)

This commit is contained in:
Ruben Guerrero 2019-07-16 15:49:49 -07:00 коммит произвёл GitHub
Родитель 5e74c33992
Коммит a3f4e6b511
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
14 изменённых файлов: 158 добавлений и 141 удалений

Просмотреть файл

@ -20,23 +20,6 @@ if(POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif()
# Set build options
option(WIN32 "Build for Win32" OFF)
option(MACOS "Build for MacOS" OFF)
option(IOS "Build for iOS" OFF)
option(AOSP "Build for Android" OFF)
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)
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.")
set(CRYPTO_LIB "" CACHE STRING "Choose the cryptography library to use, options are: [openssl, crypt32]. Use the -DCRYPTO_LIB=[option] to specify.")
# Default version is 0.0.0
set(VERSION_MAJOR "0")
set(VERSION_MINOR "0")
@ -91,6 +74,8 @@ 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}")
# Validates CMake options.
include(msix_options)
# Configure Package.nuspec
if(WIN32)
@ -101,10 +86,8 @@ elseif(IOS)
set(MSIX_NUGET_NAME "Microsoft.MSIX.Packaging.iOS")
elseif(AOSP)
set(MSIX_NUGET_NAME "Microsoft.MSIX.Packaging.AOSP")
elseif(LINUX)
set(MSIX_NUGET_NAME "Microsoft.MSIX.Packaging.Linux")
else()
set(MSIX_NUGET_NAME "Microsoft.MSIX.Packaging") # cmake ..
set(MSIX_NUGET_NAME "Microsoft.MSIX.Packaging.Linux")
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Package.nuspec.cmakein ${CMAKE_CURRENT_BINARY_DIR}/Package.nuspec CRLF)
@ -116,7 +99,7 @@ message(STATUS "--------------------------------")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/LICENSE ${CMAKE_BINARY_DIR}/build/LICENSE)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/THIRD\ PARTY\ CODE\ NOTICE ${CMAKE_BINARY_DIR}/build/THIRD\ PARTY\ CODE\ NOTICE)
message(STATUS "LICENSE created")
message(STATUS "--------------------------------")
message(STATUS "--------------------------------")
# Configure certificates
# list each certificate by name that is to be published in the nuget package
@ -132,46 +115,7 @@ foreach(CERT_TO_PUBLISH ${CERTS_TO_PUBLISH})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/resources/certs/${CERT_TO_PUBLISH} ${CMAKE_BINARY_DIR}/build/certs/${CERT_TO_PUBLISH})
endforeach()
message(STATUS "Certificates published")
message(STATUS "--------------------------------")
# Enforce that target platform is specified.
if((NOT WIN32) AND (NOT MACOS) AND (NOT IOS) AND (NOT AOSP) AND (NOT LINUX))
message(STATUS "You must specify one of: [WIN32|MACOS|IOS|AOSP|LINUX]" )
message(STATUS "For example, use cmake -DWIN32=on .." )
return()
else()
if(WIN32)
message(STATUS "Building for WIN32")
if(USE_STATIC_MSVC)
# 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()
endif()
if(MACOS)
message(STATUS "Building for MacOS")
endif()
if(IOS)
message(STATUS "Building for iOS")
if(IOS_DEPLOYMENT_TARGET VERSION_LESS 10.0)
message(FATAL_ERROR "Unsupported iOS version: ${IOS_DEPLOYMENT_TARGET}, this project requires at least iOS version 10.0")
endif()
set(PLATFORM_APPLE 1)
endif()
if(AOSP)
message(STATUS "Building for Android")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
if(LINUX)
message(STATUS "Building for Linux")
# Static libraries must be position independent to be linked with a shared object.
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
endif()
message(STATUS "--------------------------------")
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
@ -210,39 +154,16 @@ if((MACOS) OR (IOS))
set(CMAKE_CXX_CREATE_SHARED_LIBRARY
"${CMAKE_CXX_CREATE_SHARED_LIBRARY}"
"${DSYMUTIL_PROGRAM} <TARGET>")
endif ()
endif()
endif()
endif()
# Packing is not enabled for mobile devices
if(MSIX_PACK AND (AOSP OR IOS))
set(MSIX_PACK OFF)
message(STATUS "Packaging is not supported for mobile devices.")
endif()
# If not defined as a cmake argument do a best effort
if(NOT XML_PARSER)
include(CheckIncludeFileCXX)
check_include_file_cxx(msxml6.h HAVE_MSXML6)
if(HAVE_MSXML6)
set(XML_PARSER msxml6 CACHE STRING "XML Parser not defined. Using msxml6" FORCE)
elseif(AOSP)
set(XML_PARSER javaxml CACHE STRING "XML Parser not defined. Using javaxml" FORCE)
elseif(MAC OR IOS)
set(XML_PARSER applexml CACHE STRING "XML Parser not defined. Using applexml" FORCE)
else()
set(XML_PARSER xerces CACHE STRING "XML Parser not defined. Using xerces" FORCE)
endif()
endif()
if(NOT CRYPTO_LIB)
include(CheckIncludeFileCXX)
check_include_file_cxx(wincrypt.h HAVE_CRYPT32)
if(HAVE_CRYPT32)
set(CRYPTO_LIB crypt32 CACHE STRING "Crypto Lib not defined. Using crypt32" FORCE)
else()
set(CRYPTO_LIB openssl CACHE STRING "Crypto Lib not defined. Using openssl" FORCE)
if(IOS)
if(IOS_DEPLOYMENT_TARGET VERSION_LESS 10.0)
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()
# CMake useful variables
@ -264,10 +185,6 @@ set(CMAKE_MACOSX_RPATH ON)
#set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
add_subdirectory(lib)
message(STATUS " ")
message(STATUS "--------------------------------")
message(STATUS "MSIX Packaging SDK")
message(STATUS "--------------------------------")
message(STATUS "libs processed")
add_subdirectory(src)
message(STATUS "src processed")

117
cmake/msix_options.cmake Normal file
Просмотреть файл

@ -0,0 +1,117 @@
# Copyright (C) 2019 Microsoft. All rights reserved.
# See LICENSE file in the project root for full license information.
# Validates CMake options for the MSIX SDK.
option(WIN32 "Build for Win32" OFF)
option(MACOS "Build for MacOS" OFF)
option(IOS "Build for iOS" OFF)
option(AOSP "Build for Android" OFF)
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)
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.")
set(CRYPTO_LIB "" CACHE STRING "Choose the cryptography library to use, options are: [openssl, crypt32]. Use the -DCRYPTO_LIB=[option] to specify.")
# Enforce that target platform is specified.
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)
set(XML_PARSER msxml6 CACHE STRING "XML Parser not defined. Using msxml6" FORCE)
elseif(AOSP)
set(XML_PARSER javaxml CACHE STRING "XML Parser not defined. Using javaxml" FORCE)
elseif(MAC)
if(MSIX_PACK)
set(XML_PARSER xerces CACHE STRING "XML Parser not defined. Using xerces" FORCE)
else()
set(XML_PARSER applexml CACHE STRING "XML Parser not defined. Using applexml" FORCE)
endif()
elseif(IOS)
set(XML_PARSER applexml CACHE STRING "XML Parser not defined. Using applexml" FORCE)
else()
set(XML_PARSER xerces CACHE STRING "XML Parser not defined. Using xerces" FORCE)
endif()
endif()
# Set crypto library if not set
if(NOT CRYPTO_LIB)
if(WIN32)
set(CRYPTO_LIB crypt32 CACHE STRING "Crypto Lib not defined. Using crypt32" FORCE)
else()
set(CRYPTO_LIB openssl CACHE STRING "Crypto Lib not defined. Using openssl" FORCE)
endif()
endif()
# Validates PACK options are correct
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")
endif()
if(NOT (XML_PARSER MATCHES xerces))
message(FATAL_ERROR "Xerces is the only supported parser for MacOS pack. Use -DXML_PARSER=xerces")
endif()
endif()
if(NOT USE_VALIDATION_PARSER)
message(FATAL_ERROR "Packaging requires validation parser. Use -DUSE_VALIDATION_PARSER=on")
endif()
endif()
# Compression
set(COMPRESSION_LIB "zlib")
if(((IOS) OR (MACOS)) AND (NOT USE_MSIX_SDK_ZLIB))
set(COMPRESSION_LIB "libCompression")
elseif((AOSP) AND (NOT USE_MSIX_SDK_ZLIB))
set(COMPRESSION_LIB "inbox zlib")
endif()
message(STATUS "MSIX SDK options validation")
message(STATUS "Configuration:")
if(WIN32)
message(STATUS "\tPlatform = WIN32")
elseif(MACOS)
message(STATUS "\tPlatform = MacOS")
elseif(IOS)
message(STATUS "\tPlatform = iOS")
message(STATUS "\tPlatform = iOS")
elseif(AOSP)
message(STATUS "\tPlatform = Android")
else()
message(STATUS "\tPlatform = Linux")
endif()
message(STATUS "\tPackaging support = ${MSIX_PACK}")
if(SKIP_BUNDLES)
message(STATUS "\tBundle support = off")
else()
message(STATUS "\tBundle support = on")
endif()
message(STATUS "\tCompression library = ${COMPRESSION_LIB}")
message(STATUS "\tXML Parser = ${XML_PARSER} with validation parser ${USE_VALIDATION_PARSER}")
message(STATUS "\tCrypto library = ${CRYPTO_LIB}")

Просмотреть файл

@ -36,7 +36,6 @@ if ((XML_PARSER MATCHES msxml6) OR (XML_PARSER MATCHES xerces))
endif()
if(USE_VALIDATION_PARSER)
message(STATUS "Using validation parser")
add_definitions(-DVALIDATING=1)
# Schemas are defined in triplets in the form of
# <namespace> <alias> <file location relative to root/resources>

Просмотреть файл

@ -24,7 +24,7 @@ endif()
# Xerces
if(XML_PARSER MATCHES xerces)
message(STATUS "XML_PARSER defined. Configuring XERCES-C parser for inclusion as static library." )
message(STATUS "Configuring XERCES-C parser for inclusion as static library." )
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Only build static lib" FORCE)
set(network OFF CACHE BOOL "Disable network support" FORCE)
set(XERCES_TESTS OFF CACHE BOOL "Don't build test or samples" FORCE)

Просмотреть файл

@ -11,7 +11,7 @@ usage()
echo $'\t' "-b build_type Default MinSizeRel"
echo $'\t' "-sb Skip bundle support."
echo $'\t' "--validation-parser|-vp Enable XML schema validation."
echo $'\t' "--pack Include packaging features."
echo $'\t' "--pack Include packaging features. Sets validation parser on."
}
printsetup()
@ -37,7 +37,8 @@ while [ "$1" != "" ]; do
-vp ) validationParser=on
;;
--pack ) pack=on
;;
validationParser=on
;;
* ) usage
exit 1
esac

Просмотреть файл

@ -17,7 +17,7 @@ usage()
echo $'\t' "-parser-xerces Use xerces xml parser instead of default apple xml parser."
echo $'\t' "-asan Turn on address sanitizer for memory corruption detection."
echo $'\t' "--validation-parser|-vp Enable XML schema validation."
echo $'\t' "--pack Include packaging features. Must be used with -xzlib"
echo $'\t' "--pack Include packaging features. Uses MSIX SDK Zlib and Xerces with validation parser on."
}
printsetup()
@ -25,7 +25,7 @@ printsetup()
echo "Build Type:" $build
echo "Data Compression library:" $dataCompressionLib
echo "Skip bundle support:" $bundle
echo "parser:" $xmlparserLib
echo "parser:" $xmlparser
echo "Address Sanitizer:" $addressSanitizerFlag
echo "Validation parser:" $validationParser
echo "Pack support:" $pack
@ -50,6 +50,10 @@ while [ "$1" != "" ]; do
-vp ) validationParser=on
;;
--pack ) pack=on
dataCompressionLib=MSIX_SDK_zlib
zlib="-DUSE_MSIX_SDK_ZLIB=on"
xmlparser=xerces
validationParser=on
;;
-h ) usage
exit

Просмотреть файл

@ -84,6 +84,7 @@ if /I "%~2" == "-sb" (
)
if /I "%~2" == "--pack" (
set pack="-DMSIX_PACK=on"
set validationParser="-DUSE_VALIDATION_PARSER=on"
)
shift /2
if not "%~2"=="" goto parseArgs
@ -114,7 +115,7 @@ echo --shared-zlib, -sz = Don't statically link zlib.
echo --crypto-openssl, -co = Use OpenSSL crypto [currently for testing]. Default Crypt32.
echo -mt = Use compiler flag /MT to use static version of the run-time library.
echo --skip-bundles, -sb = Turn off bundle support.
echo --pack = Include packaging features.
echo --pack = Include packaging features. Sets validation parser on.
echo --help, -h, /? = Print this usage information and exit.
:Exit
EXIT /B 0

Просмотреть файл

@ -44,7 +44,7 @@ jobs:
_arguments: -b MinSizeRel -sb
_artifact: LINUX-nobundle
release_validation_parser:
_arguments: -b MinSizeRel -vp --pack
_arguments: -b MinSizeRel -vp
_artifact: LINUX-ValidationParser
release_pack:
_arguments: -b MinSizeRel --pack

Просмотреть файл

@ -43,11 +43,11 @@ jobs:
release_nobundle:
_arguments: -b MinSizeRel -sb
_artifact: MACOS-nobundle
relaese_pack:
_arguments: -b MinSizeRel --pack -xzlib
release_pack:
_arguments: -b MinSizeRel --pack
_artifact: MACOSchk-pack
debug_pack:
_arguments: -b Debug --pack -xzlib
_arguments: -b Debug --pack
_artifact: MACOSchk-pack
steps:
- task: Bash@3

Просмотреть файл

@ -47,10 +47,10 @@ jobs:
_arguments: x64
_artifact: WIN32-x64
release_32_validation_parser:
_arguments: x86 --validation-parser --pack
_arguments: x86 --validation-parser
_artifact: WIN32ValidationParser
release_64_validation_parser:
_arguments: x64 --validation-parser --pack
_arguments: x64 --validation-parser
_artifact: WIN32-x64ValidationParser
release_32_xerces:
_arguments: x86 --parser-xerces --pack

Просмотреть файл

@ -38,12 +38,6 @@ struct Option
// Tracks the state of the current parse operation as well as implements input validation
struct State
{
bool SkipManifestValidation()
{
validationOptions = static_cast<MSIX_VALIDATION_OPTION>(validationOptions | MSIX_VALIDATION_OPTION::MSIX_VALIDATION_OPTION_SKIPAPPXMANIFEST);
return true;
}
bool SkipSignature()
{
validationOptions = static_cast<MSIX_VALIDATION_OPTION>(validationOptions | MSIX_VALIDATION_OPTION::MSIX_VALIDATION_OPTION_SKIPSIGNATURE);

Просмотреть файл

@ -1490,7 +1490,10 @@ enum MSIX_VALIDATION_OPTION
MSIX_VALIDATION_OPTION_FULL = 0x0,
MSIX_VALIDATION_OPTION_SKIPSIGNATURE = 0x1,
MSIX_VALIDATION_OPTION_ALLOWSIGNATUREORIGINUNKNOWN = 0x2,
MSIX_VALIDATION_OPTION_SKIPAPPXMANIFEST = 0x4,
MSIX_VALIDATION_OPTION_SKIPAPPXMANIFEST_DEPRECATED = 0x4, // AppxManifest.xml must be always be valid.
// If the SDK is compiled without USE_VALIDATION_PARSER,
// no schema validation is done, but it needs to be
// valid xml.
} MSIX_VALIDATION_OPTION;
typedef /* [v1_enum] */

Просмотреть файл

@ -383,11 +383,6 @@ MSIX_VALIDATION_OPTION GetValidationOption(const Invocation& invocation)
{
MSIX_VALIDATION_OPTION validation = MSIX_VALIDATION_OPTION::MSIX_VALIDATION_OPTION_FULL;
if (invocation.IsOptionPresent("-mv"))
{
validation |= MSIX_VALIDATION_OPTION::MSIX_VALIDATION_OPTION_SKIPAPPXMANIFEST;
}
if (invocation.IsOptionPresent("-ac"))
{
validation |= MSIX_VALIDATION_OPTION::MSIX_VALIDATION_OPTION_ALLOWSIGNATUREORIGINUNKNOWN;
@ -461,7 +456,6 @@ Command CreateUnpackCommand()
Option{ "-p", "Input package file path.", true, 1, "package" },
Option{ "-d", "Output directory path.", true, 1, "directory" },
Option{ "-pfn", "Unpacks all files to a subdirectory under the output path, named after the package full name." },
Option{ "-mv", "Skips manifest validation. By default manifest validation is enabled." },
Option{ "-ac", "Allows any certificate. By default the signature origin must be known." },
Option{ "-ss", "Skips enforcement of signed packages. By default packages must be signed." },
// Identical behavior as -pfn. This option was created to create parity with unbundle's -pfn-flat option so that IT pros
@ -498,7 +492,6 @@ Command CreateUnbundleCommand()
Option{ "-p", "Input bundle file path.", true, 1, "bundle" },
Option{ "-d", "Output directory path.", true, 1, "directory" },
Option{ "-pfn", "Unpacks all files to a subdirectory under the output path, named after the package full name." },
Option{ "-mv", "Skips manifest validation. By default manifest validation is enabled." },
Option{ "-ac", "Allows any certificate. By default the signature origin must be known." },
Option{ "-ss", "Skips enforcement of signed packages. By default packages must be signed." },
Option{ "-sl", "Skips matching packages with the language of the system. By default unpacked resources packages will match the system languages." },

Просмотреть файл

@ -114,7 +114,6 @@ list(APPEND MsixSrc
# Pack
if(MSIX_PACK)
message(STATUS "Packaging enabled.")
add_definitions(-DMSIX_PACK=1)
list(APPEND MsixSrc
pack/AppxPackageWriter.cpp
@ -129,7 +128,6 @@ endif()
# Bundle specific files
if(NOT SKIP_BUNDLES)
message(STATUS "Bundle support enabled.")
add_definitions(-DBUNDLE_SUPPORT=1)
list(APPEND MsixSrc
unpack/AppxBundleManifest.cpp
@ -150,37 +148,26 @@ endif()
# Compression option
if(((IOS) OR (MACOS)) AND (NOT USE_MSIX_SDK_ZLIB))
# We don't support using libcompression APIs for packaging.
if(MSIX_PACK)
message(FATAL_ERROR "Using libCompression APIs and packaging features is not supported.")
endif()
message(STATUS "PAL: Compression = libCompression")
list(APPEND MsixSrc PAL/DataCompression/Apple/CompressionObject.cpp)
else()
message(STATUS "PAL: Compression = zlib")
list(APPEND MsixSrc PAL/DataCompression/Zlib/CompressionObject.cpp)
endif()
# Directory object
if(WIN32)
message(STATUS "PAL: DirectoryObject = Windows")
list(APPEND MsixSrc PAL/FileSystem/Win32/DirectoryObject.cpp)
else()
message(STATUS "PAL: DirectoryObject = POSIX")
list(APPEND MsixSrc PAL/FileSystem/POSIX/DirectoryObject.cpp)
endif()
# Xml Parser
if(XML_PARSER MATCHES xerces)
message(STATUS "PAL: XML = Xerces-C")
list(APPEND MsixSrc PAL/XML/xerces-c/XmlObject.cpp)
add_definitions(-DUSING_XERCES=1)
elseif(XML_PARSER MATCHES javaxml)
message(STATUS "PAL: XML = javaxml")
list(APPEND MsixSrc PAL/XML/AOSP/XmlObject.cpp)
add_definitions(-DUSING_JAVAXML=1)
elseif(XML_PARSER MATCHES applexml)
message(STATUS "PAL: XML = apple xml")
set(XmlParser)
list(APPEND MsixSrc
"PAL/XML/APPLE/XmlObject.cpp"
@ -190,21 +177,18 @@ elseif(XML_PARSER MATCHES applexml)
)
add_definitions(-DUSING_APPLE_XML=1)
elseif(XML_PARSER MATCHES msxml6)
message(STATUS "PAL: XML = msxml")
list(APPEND MsixSrc PAL/XML/msxml6/XmlObject.cpp)
add_definitions(-DUSING_MSXML=1)
endif()
# Crypto
if(CRYPTO_LIB MATCHES crypt32)
message(STATUS "PAL: Crypto = cryp32")
list(APPEND MsixSrc
PAL/Crypto/Win32/Crypto.cpp
PAL/Signature/Win32/SignatureValidator.cpp
)
elseif(CRYPTO_LIB MATCHES openssl)
if(OpenSSL_FOUND)
message(STATUS "PAL: Crypto = openssl ${OpenSLL_VERSION}")
list(APPEND MsixSrc
PAL/Crypto/OpenSSL/Crypto.cpp
PAL/Signature/OpenSSL/SignatureValidator.cpp
@ -223,6 +207,12 @@ if(AOSP)
)
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
@ -280,12 +270,10 @@ set_target_properties(${PROJECT_NAME} PROPERTIES
# Compression
if(((IOS) OR (MACOS)) AND (NOT USE_MSIX_SDK_ZLIB))
# for macos and ios use the inbox libcompression zlib apis instead of zlib, unless zlib is explicitly requested.
message(STATUS "MSIX takes a dependency on inbox libcompression")
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_PROJECT_ROOT}/src/msix/PAL/DataCompression/Apple)
target_link_libraries(${PROJECT_NAME} PRIVATE libcompression.dylib)
elseif((AOSP) AND (NOT USE_MSIX_SDK_ZLIB))
# for AOSP, use the libz.so from the android ndk.
message(STATUS "MSIX takes a dependency on inbox zlib")
find_package(ZLIB REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE -lz)
else() # WIN32 or USE_MSIX_SDK_ZLIB