This commit is contained in:
Ruben Guerrero 2019-05-02 11:29:11 -07:00 коммит произвёл GitHub
Родитель ab9725dee6
Коммит 77c2b1297b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
16 изменённых файлов: 288 добавлений и 226 удалений

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

@ -31,6 +31,7 @@ option(USE_VALIDATION_PARSER "Turn on to validates using the resouce schemas. De
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. Default is 'on'" ON)
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.")
@ -172,28 +173,6 @@ else()
endif()
endif()
if(NOT XML_PARSER)
include(CheckIncludeFileCXX)
check_include_file_cxx(msxml6.h HAVE_MSXML6)
if(HAVE_MSXML6)
set(XML_PARSER msxml6 CACHE STRING "Using XML Parser: msxml6" FORCE)
elseif (AOSP)
set(XML_PARSER javaxml CACHE STRING "Using XML Parser: javaxml" FORCE)
else()
set(XML_PARSER xerces CACHE STRING "Using XML Parser: 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 "Using Crypto Lib: crypt32" FORCE)
else()
set(CRYPTO_LIB openssl CACHE STRING "Using Crypto Lib: openssl" FORCE)
endif()
endif()
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))
@ -237,6 +216,31 @@ endif()
enable_testing() # needed on top-level CMakeLists.txt
# 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)
endif()
endif()
# CMake useful variables
set(CMAKE_PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")

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

@ -36,6 +36,8 @@ 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>
list(APPEND CONTENT_TYPES

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

@ -9,23 +9,24 @@ sdk=
sdkver=24
dataCompressionLib=NDK_libz
bundle=off
xmlparserLib=javaxml
xmlparser="-DXML_PARSER=javaxml"
xmlparser=javaxml
validationParser=off
pack=on
usage()
{
echo "usage: makeaosp [-ndk ndk_path] [-arch arch] [-ndkver ndk_version] [-sdk sdk_path] [-sdkver sdk_version] [-b buildType] [-xzlib] [-sb] [-parser-xerces]"
echo $'\t' "-ndk Path to Android NDK. Default $ANDROID_NDK_ROOT or $ANDROID_NDK"
echo $'\t' "-ndkver Android NDK version. Default/minimum 19."
echo $'\t' "-sdk Path to Android SDK. Default $ANDROID_HOME."
echo $'\t' "-sdkver Android SDK version. Default/minimum 24."
echo $'\t' "-arch Architecture ABI. Default x86"
echo $'\t' "-b Build type. Default MinSizeRel"
echo $'\t' "-xzlib Use MSIX SDK Zlib instead of inbox libz.so"
echo $'\t' "-parser-xerces Use xerces xml parser instead of default javaxml"
echo $'\t' "-sb Skip bundle support."
echo $'\t' "--validation-parser, -vp Enable XML schema validation."
echo "usage: makeaosp [options]"
echo $'\t' "-ndk ndk_pack Path to Android NDK. Default $ANDROID_NDK_ROOT or $ANDROID_NDK"
echo $'\t' "-ndkver ndk_version Android NDK version. Default/minimum 19."
echo $'\t' "-sdk sdk_path Path to Android SDK. Default $ANDROID_HOME."
echo $'\t' "-sdkver sdk_version Android SDK version. Default/minimum 24."
echo $'\t' "-arch arch Architecture ABI. Default x86"
echo $'\t' "-b build_type Default MinSizeRel"
echo $'\t' "-xzlib Use MSIX SDK Zlib insctead of inbox libz.so"
echo $'\t' "-parser-xerces Use xerces xml parser instead of default javaxml"
echo $'\t' "-sb Skip bundle support."
echo $'\t' "--validation-parser|-vp Enable XML schema validation."
echo $'\t' "--no-pack Don't include packaging features."
}
printsetup()
@ -37,9 +38,10 @@ printsetup()
echo "Architecture:" $arch
echo "Build Type:" $build
echo "Zlib:" $dataCompressionLib
echo "parser:" $xmlparserLib
echo "parser:" $xmlparser
echo "Skip bundle support:" $bundle
echo "Validation parser:" $validationParser
echo "Pack:" $pack
}
while [ "$1" != "" ]; do
@ -62,8 +64,8 @@ while [ "$1" != "" ]; do
-xzlib ) dataCompressionLib=MSIX_SDK_zlib
zlib="-DUSE_MSIX_SDK_ZLIB=on"
;;
-parser-xerces ) xmlparserLib=xerces
xmlparser="-DXML_PARSER=xerces"
-parser-xerces )
xmlparser=xerces
;;
-sdk ) shift
sdk=$1
@ -77,6 +79,8 @@ while [ "$1" != "" ]; do
;;
-vp ) validationParser=on
;;
--no-pack ) pack=off
;;
* ) usage
exit 1
esac
@ -114,8 +118,8 @@ find . -name *msix* -d | xargs rm -r
echo "cmake -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK="$ndk "-DCMAKE_SYSTEM_VERSION="$version "-DANDROID_SDK="$sdk
echo "-DANDROID_SDK_VERSION="$sdkver "-DCMAKE_ANDROID_ARCH_ABI="$arch "-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang"
echo "-DCMAKE_ANDROID_STL_TYPE=c++_shared -DCMAKE_BUILD_TYPE="$build "-DSKIP_BUNDLES="$bundle $xmlparser "-DUSE_VALIDATION_PARSER="$validationParser
echo $zlib "-DAOSP=on .."
echo "-DCMAKE_ANDROID_STL_TYPE=c++_shared -DCMAKE_BUILD_TYPE="$build "-DSKIP_BUNDLES="$bundle "-DXML_PARSER="$xmlparser
echo "-DUSE_VALIDATION_PARSER="$validationParser "-DMSIX_PACK="$pack $zlib "-DAOSP=on .."
cmake -DCMAKE_SYSTEM_NAME=Android \
-DCMAKE_ANDROID_NDK="$ndk" \
-DCMAKE_SYSTEM_VERSION="$version" \
@ -126,7 +130,8 @@ cmake -DCMAKE_SYSTEM_NAME=Android \
-DCMAKE_ANDROID_STL_TYPE=c++_shared \
-DCMAKE_BUILD_TYPE="$build" \
-DSKIP_BUNDLES=$bundle \
$xmlparser \
-DXML_PARSER=$xmlparser \
-DUSE_VALIDATION_PARSER=$validationParser \
-DMSIX_PACK=$pack \
$zlib -DAOSP=on ..
make

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

@ -4,19 +4,20 @@ build=MinSizeRel
arch=x86_64
dataCompressionLib=libcompression
bundle=off
xmlparserLib=applexml
xmlparser="-DXML_PARSER=applexml"
xmlparser=applexml
validationParser=off
pack=on
usage()
{
echo "usage: makemac [-b buildType] [-arch] [-xzlib]"
echo $'\t' "-b Build type. Default MinSizeRel"
echo $'\t' "-arch OSX Architecture. Default x86_64 (simulator)"
echo $'\t' "-xzlib Use MSIX SDK Zlib instead of inbox libCompression api. Default on iOS is libCompression."
echo $'\t' "-sb Skip bundle support."
echo $'\t' "-parser-xerces Use xerces xml parser instead of default apple xml parser."
echo $'\t' "--validation-parser, -vp Enable XML schema validation."
echo "usage: makemac [options]"
echo $'\t' "-b build_type Default MinSizeRel"
echo $'\t' "-arch arch OSX Architecture. Default x86_64 (simulator)"
echo $'\t' "-xzlib Use MSIX SDK Zlib instead of inbox libCompression api. Default on iOS is libCompression. Required for pack support."
echo $'\t' "-sb Skip bundle support."
echo $'\t' "-parser-xerces Use xerces xml parser instead of default apple xml parser."
echo $'\t' "--validation-parser|-vp Enable XML schema validation."
echo $'\t' "--no-pack Don't include packaging features."
}
printsetup()
@ -25,8 +26,9 @@ printsetup()
echo "Architecture:" $arch
echo "Data Compression library:" $dataCompressionLib
echo "Skip bundle support:" $bundle
echo "parser:" $xmlparserLib
echo "Parser:" $xmlparser
echo "Validation parser:" $validationParser
echo "Pack support:" $pack
}
while [ "$1" != "" ]; do
@ -41,7 +43,7 @@ while [ "$1" != "" ]; do
zlib="-DUSE_MSIX_SDK_ZLIB=on"
;;
-parser-xerces ) xmlparserLib=xerces
xmlparser="-DXML_PARSER=xerces"
xmlparser=xerces
;;
-sb ) bundle="on"
;;
@ -49,6 +51,8 @@ while [ "$1" != "" ]; do
;;
-vp ) validationParser=on
;;
--no-pack ) pack=off
;;
-h ) usage
exit
;;
@ -65,6 +69,14 @@ cd .vs
# clean up any old builds of msix modules
find . -name *msix* -d | xargs rm -r
echo "cmake -DCMAKE_BUILD_TYPE="$build $zlib "-DCMAKE_TOOLCHAIN_FILE=../cmake/ios.cmake -DCMAKE_OSX_ARCHITECTURES="$arch $xmlparser "-DUSE_VALIDATION_PARSER="$validationParser "-DSKIP_BUNDLES="$bundle "-DIOS=on .."
cmake -DCMAKE_BUILD_TYPE=$build $zlib -DIOS=on -DCMAKE_TOOLCHAIN_FILE=../cmake/ios.cmake -DCMAKE_OSX_ARCHITECTURES=$arch $xmlparser -DUSE_VALIDATION_PARSER=$validationParser -DSKIP_BUNDLES=$bundle -DIOS=on ..
echo "cmake -DCMAKE_BUILD_TYPE="$build $zlib "-DCMAKE_TOOLCHAIN_FILE=../cmake/ios.cmake -DCMAKE_OSX_ARCHITECTURES="$arch
echo "-DXML_PARSER="$xmlparser "-DUSE_VALIDATION_PARSER="$validationParser "-DSKIP_BUNDLES="$bundle "-DIOS=on .."
cmake -DCMAKE_BUILD_TYPE=$build \
-DCMAKE_TOOLCHAIN_FILE=../cmake/ios.cmake \
-DCMAKE_OSX_ARCHITECTURES=$arch \
-DXML_PARSER=$xmlparser \
-DUSE_VALIDATION_PARSER=$validationParser \
-DSKIP_BUNDLES=$bundle \
-DMSIX_PACK=$pack \
$zlib -DIOS=on ..
make

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

@ -3,13 +3,15 @@
build=MinSizeRel
bundle=off
validationParser=off
pack=on
usage()
{
echo "usage: makelinux [-b buildType] [-sb]"
echo $'\t' "-b Build type. Default MinSizeRel"
echo $'\t' "-sb Skip bundle support."
echo $'\t' "--validation-parser, -vp Enable XML schema validation."
echo "usage: makelinux [options]"
echo $'\t' "-b build_type Default MinSizeRel"
echo $'\t' "-sb Skip bundle support."
echo $'\t' "--validation-parser|-vp Enable XML schema validation."
echo $'\t' "--no-pack Don't include packaging features."
}
printsetup()
@ -17,6 +19,7 @@ printsetup()
echo "Build Type:" $build
echo "Skip bundle support:" $bundle
echo "Validation parser:" $validationParser
echo "Pack support:" $pack
}
while [ "$1" != "" ]; do
@ -33,6 +36,8 @@ while [ "$1" != "" ]; do
;;
-vp ) validationParser=on
;;
--no-pack ) pack=off
;;
* ) usage
exit 1
esac
@ -46,6 +51,12 @@ cd .vs
# clean up any old builds of msix modules
find . -depth -name *msix* | xargs -0 -r rm -rf
echo "cmake -DCMAKE_BUILD_TYPE="$build "-DSKIP_BUNDLES="$bundle "-DUSE_VALIDATION_PARSER="$validationParser "-DCMAKE_TOOLCHAIN_FILE=../cmake/linux.cmake -DLINUX=on .."
cmake -DCMAKE_BUILD_TYPE=$build -DSKIP_BUNDLES=$bundle -DUSE_VALIDATION_PARSER=$validationParser -DCMAKE_TOOLCHAIN_FILE=../cmake/linux.cmake -DLINUX=on ..
echo "cmake -DCMAKE_BUILD_TYPE="$build "-DSKIP_BUNDLES="$bundle "-DUSE_VALIDATION_PARSER="$validationParser
echo "-DCMAKE_TOOLCHAIN_FILE=../cmake/linux.cmake" "-DMSIX_PACK="$pack "-DLINUX=on .."
cmake -DCMAKE_BUILD_TYPE=$build \
-DSKIP_BUNDLES=$bundle \
-DUSE_VALIDATION_PARSER=$validationParser \
-DCMAKE_TOOLCHAIN_FILE=../cmake/linux.cmake \
-DMSIX_PACK=$pack \
-DLINUX=on ..
make

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

@ -3,20 +3,21 @@
build=MinSizeRel
dataCompressionLib=libcompression
bundle=off
xmlparserLib=applexml
xmlparser="-DXML_PARSER=applexml"
addressSanitizerFlag=off
xmlparser=applexml
addressSanitizer=off
validationParser=off
pack=on
usage()
{
echo "usage: makemac [-b buildType] [-xzlib] [-parser-xerces] [-asan]"
echo $'\t' "-b Build type. Default MinSizeRel"
echo $'\t' "-xzlib Use MSIX SDK Zlib instead of inbox libCompression api. Default on MacOS is libCompression."
echo $'\t' "-sb Skip bundle support."
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 "usage: makemac [options]"
echo $'\t' "-b build_type Default MinSizeRel"
echo $'\t' "-xzlib Use MSIX SDK Zlib instead of inbox libCompression api. Default on MacOS is libCompression. Required for pack support."
echo $'\t' "-sb Skip bundle support."
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' "--no-pack Don't include packaging features."
}
printsetup()
@ -27,6 +28,7 @@ printsetup()
echo "parser:" $xmlparserLib
echo "Address Sanitizer:" $addressSanitizerFlag
echo "Validation parser:" $validationParser
echo "Pack support:" $pack
}
while [ "$1" != "" ]; do
@ -37,11 +39,9 @@ while [ "$1" != "" ]; do
-xzlib )dataCompressionLib=MSIX_SDK_zlib
zlib="-DUSE_MSIX_SDK_ZLIB=on"
;;
-parser-xerces ) xmlparserLib=xerces
xmlparser="-DXML_PARSER=xerces"
;;
-asan ) addressSanitizerFlag=on
addressSanitizer="-DASAN=on"
-parser-xerces ) xmlparser=xerces
;;
-asan ) addressSanitizer=on
;;
-sb ) bundle="on"
;;
@ -49,6 +49,8 @@ while [ "$1" != "" ]; do
;;
-vp ) validationParser=on
;;
--no-pack ) pack=off
;;
-h ) usage
exit
;;
@ -65,6 +67,14 @@ cd .vs
# clean up any old builds of msix modules
find . -name *msix* -d | xargs rm -r
echo "cmake -DCMAKE_BUILD_TYPE="$build $zlib "-DSKIP_BUNDLES="$bundle $xmlparser $addressSanitizer "-DUSE_VALIDATION_PARSER="$validationParser "-DMACOS=on .."
cmake -DCMAKE_BUILD_TYPE=$build $zlib -DSKIP_BUNDLES=$bundle $xmlparser $addressSanitizer -DUSE_VALIDATION_PARSER=$validationParser -DMACOS=on ..
echo "cmake -DCMAKE_BUILD_TYPE="$build $zlib "-DSKIP_BUNDLES="$bundle
echo "-DXML_PARSER="$xmlparser "-DASAN="$addressSanitizer "-DUSE_VALIDATION_PARSER="$validationParser
echo "-DMSIX_PACK="$pack "-DMACOS=on .."
cmake -DCMAKE_BUILD_TYPE=$build \
-DXML_PARSER=$xmlparser \
-DSKIP_BUNDLES=$bundle \
-DASAN=$addressSanitizer \
-DUSE_VALIDATION_PARSER=$validationParser \
-DMSIX_PACK=$pack \
$zlib -DMACOS=on ..
make

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

@ -34,6 +34,7 @@ set parser="-DXML_PARSER=msxml6"
set crypto="-DCRYPTO_LIB=crypt32"
set msvc="-DUSE_STATIC_MSVC=off"
set bundle="-DSKIP_BUNDLES=off"
set pack="-DMSIX_PACK=on"
:parseArgs
if /I "%~2" == "--debug" (
@ -75,6 +76,9 @@ if /I "%~2" == "--skip-bundles" (
if /I "%~2" == "-sb" (
set bundle="-DSKIP_BUNDLES=on"
)
if /I "%~2" == "--no-pack" (
set pack="-DMSIX_PACK=off"
)
shift /2
if not "%~2"=="" goto parseArgs
@ -83,8 +87,8 @@ cd .vs
if exist CMakeFiles rd /s /q CMakeFiles
if exist CMakeCache.txt del CMakeCache.txt
echo cmake -DWIN32=on -DCMAKE_BUILD_TYPE=%build% %validationParser% %zlib% %parser% %crypto% %msvc% %bundle% -G"NMake Makefiles" ..
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=%build% %validationParser% %zlib% %parser% %crypto% %msvc% %bundle% -G"NMake Makefiles" ..
echo cmake -DWIN32=on -DCMAKE_BUILD_TYPE=%build% %validationParser% %zlib% %parser% %crypto% %msvc% %bundle% %pack% -G"NMake Makefiles" ..
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=%build% %validationParser% %zlib% %parser% %crypto% %msvc% %bundle% %pack% -G"NMake Makefiles" ..
nmake /NOLOGO
goto Exit
@ -103,6 +107,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 --no-pack = Don't include packaging features.
echo --help, -h, /? = print this usage information and exit.
:Exit
EXIT /B 0

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

@ -43,6 +43,9 @@ jobs:
release_arm:
_arguments: -b MinSizeRel -arch armeabi-v7a
_artifact: AOSP-arm
debug_emulator_nopack:
_arguments: -b Debug --no-pack
_artifact: AOSP-x86chk-nopack
steps:
- task: Bash@3
displayName: Build

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

@ -35,14 +35,17 @@ jobs:
# TODO: add builds using xerces if needed.
matrix:
debug_x86:
_arguments: -b Debug
_arguments: -b Debug -xzlib
_artifact: iOS-x86chk
release_x86:
_arguments: -b MinSizeRel
_arguments: -b MinSizeRel -xzlib
_artifact: iOS-x86
release_arm64:
_arguments: -b MinSizeRel -arch arm64
_arguments: -b MinSizeRel -arch arm64 -xzlib
_artifact: iOS-arm64
debug_x86_nopack:
_arguments: -b Debug --no-pack
_artifact: iOS-x86chk-nopack
steps:
- task: Bash@3
displayName: Build

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

@ -43,6 +43,9 @@ jobs:
release_xerces_validation_parser:
_arguments: -b MinSizeRel -vp
_artifact: LINUX
debug_nopack:
_arguments: -b Debug --no-pack
_artifact: LINUXchk-nopack
steps:
- task: Bash@3

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

@ -35,11 +35,14 @@ jobs:
# TODO: add builds using xerces if needed.
matrix:
debug:
_arguments: -b Debug
_arguments: -b Debug -xzlib
_artifact: MACOSchk
release:
_arguments: -b MinSizeRel
_arguments: -b MinSizeRel -xzlib
_artifact: MACOS
debug_nopack:
_arguments: -b Debug --no-pack
_artifact: MACOSchk-nopack
steps:
- task: Bash@3
displayName: Build

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

@ -58,6 +58,9 @@ jobs:
release_64_xerces:
_arguments: x64 --parser-xerces
_artifact: WIN32-x64Xerces
debug_32_nopack:
_arguments: x86 -d --no-pack
_artifact: WIN32chk-no-pack
steps:
- task: BatchScript@1

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

@ -8,8 +8,9 @@ project (makemsix)
# Define two variables in order not to repeat ourselves.
set(BINARY_NAME makemsix)
# TODO: Only define this when we want pack
add_definitions(-DMSIX_PACK=1)
if(MSIX_PACK)
add_definitions(-DMSIX_PACK=1)
endif()
if(WIN32)
set(DESCRIPTION "makemsix manifest")

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

@ -19,7 +19,9 @@ enum class UserSpecified
Help,
Unpack,
Unbundle,
#ifdef MSIX_PACK
Pack
#endif
};
// Tracks the state of the current parse operation as well as implements input validation
@ -188,6 +190,7 @@ int Help(char* toolName, std::vector<Command>& commands, State& state)
std::cout << " specified output <directory>. The output has the same directory structure " << std::endl;
std::cout << " as the package. its packages will be unpacked in a directory named as the package full name" << std::endl;
break;
#ifdef MSIX_PACK
case UserSpecified::Pack:
command = std::find(commands.begin(), commands.end(), "pack");
std::cout << " " << toolName << " pack -p <output package> -d <directory to pack> [options] " << std::endl;
@ -195,6 +198,7 @@ int Help(char* toolName, std::vector<Command>& commands, State& state)
std::cout << "Description:" << std::endl;
std::cout << "------------" << std::endl;
std::cout << " TODO" << std::endl;
#endif
}
std::cout << std::endl;
std::cout << "Options:" << std::endl;
@ -277,10 +281,12 @@ int ParseAndRun(std::vector<Command>& commands, int argc, char* argv[])
const_cast<char*>(state.packageName.c_str()),
const_cast<char*>(state.directoryName.c_str())
);
#ifdef MSIX_PACK
case UserSpecified::Pack:
return PackPackage(state.validationOptions,
const_cast<char*>(state.directoryName.c_str()),
const_cast<char*>(state.packageName.c_str()));
#endif
}
return -1; // should never end up here.
}
@ -347,6 +353,7 @@ int main(int argc, char* argv[])
[](State& state, const std::string&) { return false; })
})
},
#ifdef MSIX_PACK
{ Command("pack", "Pack files from disk to a package",
[](State& state) { return state.Specify(UserSpecified::Pack); },
{
@ -358,6 +365,7 @@ int main(int argc, char* argv[])
[](State& state, const std::string&) { return false; })
})
},
#endif
{ Command("-?", "Displays this help text.",
[](State& state) { return state.Specify(UserSpecified::Help);}, {})
},

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

@ -6,70 +6,8 @@ cmake_minimum_required(VERSION 3.8.0 FATAL_ERROR)
project(msix)
# TODO: Only define this when we want pack
add_definitions(-DMSIX_PACK=1)
if(SKIP_BUNDLES)
message(STATUS "Bundle support disabled.")
else()
add_definitions(-DBUNDLE_SUPPORT=1)
endif()
# Define PALs
if(XML_PARSER MATCHES xerces)
message(STATUS "XML_PARSER defined. Using XERCES-C XML parser." )
set(XmlParser PAL/XML/xerces-c/XmlObject.cpp)
add_definitions(-DUSING_XERCES=1)
endif()
if(XML_PARSER MATCHES javaxml)
message(STATUS "XML_PARSER defined. Using javaxml parser." )
set(XmlParser PAL/XML/AOSP/XmlObject.cpp)
add_definitions(-DUSING_JAVAXML=1)
endif()
if(XML_PARSER MATCHES applexml)
message(STATUS "XML_PARSER defined. Using apple xml parser." )
set(XmlParser)
list(APPEND XmlParser
"PAL/XML/APPLE/XmlObject.cpp"
"PAL/XML/APPLE/NSXmlParserDelegateWrapper.mm"
"PAL/XML/APPLE/NSXmlParserWrapper.mm"
"PAL/XML/APPLE/XmlDocumentReader.cpp"
)
add_definitions(-DUSING_APPLE_XML=1)
endif()
if(XML_PARSER MATCHES msxml6)
message(STATUS "XML_PARSER defined. Using MSXML6 XML parser." )
set(XmlParser PAL/XML/msxml6/XmlObject.cpp)
add_definitions(-DUSING_MSXML=1)
endif()
if(CRYPTO_LIB MATCHES crypt32)
message(STATUS "CRYPTO_LIB defined. Using crypt32 library." )
set(Crypto PAL/Crypto/Win32/Crypto.cpp)
set(Signature PAL/Signature/Win32/SignatureValidator.cpp)
add_definitions(-DUSING_CRYPT32=1)
endif()
if(CRYPTO_LIB MATCHES openssl)
message(STATUS "CRYPTO_LIB defined. Using OpenSSL library." )
if(OpenSSL_FOUND)
message(STATUS "Using OpenSSL ${OpenSLL_VERSION}")
set(Crypto PAL/Crypto/OpenSSL/Crypto.cpp)
set(Signature PAL/Signature/OpenSSL/SignatureValidator.cpp)
else()
# ... and were done here... :/
message(STATUS "OpenSSL NOT FOUND!")
return()
endif()
endif()
if(WIN32)
set(DirectoryObject PAL/FileSystem/Win32/DirectoryObject.cpp)
set(Applicability PAL/Applicability/Win32/Applicability.cpp)
else()
# Handle exports and flags we need to set
if(NOT WIN32)
# Visibility variables for non-win32 platforms
list(APPEND MSIX_UNPACK_EXPORTS
"UnpackPackage"
@ -77,10 +15,11 @@ else()
"UnpackBundle"
"UnpackBundleFromStream"
)
# TODO: Only define this when we want pack
list(APPEND MSIX_PACK_EXPORTS
"PackPackage"
)
if(MSIX_PACK)
list(APPEND MSIX_PACK_EXPORTS
"PackPackage"
)
endif()
list(APPEND MSIX_EXPORTS
"CoCreateAppxFactory"
"CoCreateAppxFactoryWithHeap"
@ -106,15 +45,6 @@ else()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/exports.def.cmakein ${CMAKE_CURRENT_BINARY_DIR}/exports.def CRLF)
set(DEFINE_EXPORTS "-exported_symbols_list ${CMAKE_CURRENT_BINARY_DIR}/exports.def")
# used to get the languages of the device
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
if(NOT COREFOUNDATION_LIBRARY)
message(FATAL_ERROR "CoreFoundation library not found")
endif()
find_library(FOUNDATION_LIBRARY Foundation)
if(NOT FOUNDATION_LIBRARY)
message(FATAL_ERROR "Foundation library not found")
endif()
set(Applicability PAL/Applicability/Apple/Applicability.cpp)
if(IOS)
add_definitions(-DIOS)
else()
@ -123,8 +53,6 @@ else()
else()
if(LINUX)
add_definitions(-DLINUX)
find_package(ICU COMPONENTS uc)
set(Applicability PAL/Applicability/Linux/Applicability.cpp)
endif()
if(AOSP)
# add here any exports specific for android
@ -132,9 +60,6 @@ else()
list(APPEND MSIX_EXPORTS
"JNI_OnLoad"
)
set(InteropHpp PAL/Interop/AOSP/JniHelper.hpp)
set(InteropCpp PAL/Interop/AOSP/JniHelper.cpp)
set(Applicability PAL/Applicability/AOSP/Applicability.cpp)
endif()
# on Linux and linux-derived platforms, you use a version script to achieve similar ends.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
@ -145,33 +70,9 @@ else()
endif()
message(STATUS "Using export flag: ${DEFINE_EXPORTS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${DEFINE_EXPORTS}")
set(DirectoryObject PAL/FileSystem/POSIX/DirectoryObject.cpp)
endif()
if(USE_VALIDATION_PARSER)
message(STATUS "PAL: VALIDATING parser" )
add_definitions(-DVALIDATING=1)
else()
message(STATUS "PAL: non-validating parser" )
add_definitions(-DVALIDATING=0)
endif()
# Compression option
if(((IOS) OR (MACOS)) AND (NOT USE_MSIX_SDK_ZLIB))
set(CompressionObject PAL/DataCompression/Apple/CompressionObject.cpp)
else()
set(CompressionObject PAL/DataCompression/Zlib/CompressionObject.cpp)
endif()
message(STATUS "PAL: XML = ${XmlParser}")
message(STATUS "PAL: DirectoryObject = ${DirectoryObject}")
message(STATUS "PAL: Crypto = ${Crypto}")
message(STATUS "PAL: Signature = ${Signature}")
message(STATUS "PAL: Applicability = ${Applicability}")
message(STATUS "PAL: Compression = ${CompressionObject}")
include(msix_resources)
include(msix_resources) # Handles all the certificates and schemas we are going to use.
set(LIB_PUBLIC_HEADERS
../inc/AppxPackaging.hpp
@ -179,7 +80,10 @@ set(LIB_PUBLIC_HEADERS
../inc/MsixErrors.hpp
)
list(APPEND CommonSrc
set(MsixSrc) # list with all the files we are going to use
# Common for pack and unpack
list(APPEND MsixSrc
common/AppxFactory.cpp
common/MSIXResource.cpp
common/Log.cpp
@ -190,47 +94,130 @@ list(APPEND CommonSrc
common/AppxManifestObject.cpp
)
# Bundle specific files
set(BundleSources)
if(NOT SKIP_BUNDLES)
list(APPEND BundleSources
unpack/AppxBundleManifest.cpp
unpack/ApplicabilityCommon.cpp
${Applicability}
)
endif()
# TODO: haven't look into what can be shared from the PAL
# for now add all to unpack and refactor as necessary
list(APPEND UnpackSrc
# Unpack. Always add
list(APPEND MsixSrc
unpack/AppxBlockMapObject.cpp
unpack/AppxPackageObject.cpp
unpack/AppxSignature.cpp
unpack/InflateStream.cpp
unpack/ZipObject.cpp
${DirectoryObject}
${Crypto}
${Signature}
${XmlParser}
${CompressionObject}
${InteropCpp}
${BundleSources}
)
list(APPEND PackSrc
pack/AppxPackageWriter.cpp
pack/XmlWriter.cpp
pack/AppxBlockMapWriter.cpp
pack/ContentTypeWriter.cpp
pack/ContentType.cpp
)
# Pack
if(MSIX_PACK)
message(STATUS "Packaging enabled.")
add_definitions(-DMSIX_PACK=1)
list(APPEND MsixSrc
pack/AppxPackageWriter.cpp
pack/XmlWriter.cpp
pack/AppxBlockMapWriter.cpp
pack/ContentTypeWriter.cpp
pack/ContentType.cpp
)
endif()
# Bundle specific files
if(NOT SKIP_BUNDLES)
message(STATUS "Bundle support enabled.")
add_definitions(-DBUNDLE_SUPPORT=1)
list(APPEND MsixSrc
unpack/AppxBundleManifest.cpp
unpack/ApplicabilityCommon.cpp
)
# Applicability.
if (WIN32)
list(APPEND MsixSrc PAL/Applicability/Win32/Applicability.cpp)
elseif(LINUX)
find_package(ICU REQUIRED COMPONENTS uc)
list(APPEND MsixSrc PAL/Applicability/Linux/Applicability.cpp)
elseif(AOSP)
list(APPEND MsixSrc PAL/Applicability/AOSP/Applicability.cpp)
else() # iOS and MACOS
find_library(COREFOUNDATION_LIBRARY CoreFoundation REQUIRED)
find_library(FOUNDATION_LIBRARY Foundation REQUIRED)
list(APPEND MsixSrc PAL/Applicability/Apple/Applicability.cpp)
endif()
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"
"PAL/XML/APPLE/NSXmlParserDelegateWrapper.mm"
"PAL/XML/APPLE/NSXmlParserWrapper.mm"
"PAL/XML/APPLE/XmlDocumentReader.cpp"
)
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
)
else()
# ... and were done here... :/
message(FATAL_ERROR "OpenSSL NOT FOUND!")
endif()
endif()
# Interop
if(AOSP)
list(APPEND MsixSrc
PAL/Interop/AOSP/JniHelper.hpp
PAL/Interop/AOSP/JniHelper.cpp
)
endif()
# Define the library
add_library(${PROJECT_NAME} SHARED
msix.cpp
${CommonSrc}
${UnpackSrc}
${PackSrc}
${MsixSrc}
)
# Copy out public headers to <binary dir>/src/unpack

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

@ -21,10 +21,12 @@ namespace MSIX {
{
THROW_IF_PACK_NOT_ENABLED
ThrowErrorIf(Error::InvalidParameter, (outputStream == nullptr || *packageWriter != nullptr), "Invalid parameter");
// TODO: we problably will probably need the pass IMsixFactory to AppxPackageWriter constructor, but don't
// do it until is actually required.
// We should never be here is packing if disabled, but the compiler
// is not smart enough to remove it and the linker will fail.
#ifdef MSIX_PACK
auto result = ComPtr<IAppxPackageWriter>::Make<AppxPackageWriter>(outputStream);
*packageWriter = result.Detach();
#endif
return static_cast<HRESULT>(Error::OK);
} CATCH_RETURN();