Fix Issue 224 (#239)
This commit is contained in:
Родитель
52ee40d65f
Коммит
add4a30436
|
@ -187,6 +187,8 @@ add_subdirectory(lib)
|
|||
message(STATUS "libs processed")
|
||||
add_subdirectory(src)
|
||||
message(STATUS "src processed")
|
||||
add_subdirectory(sample)
|
||||
message(STATUS "sample processed")
|
||||
if (MSIX_SAMPLES)
|
||||
add_subdirectory(sample)
|
||||
message(STATUS "sample processed")
|
||||
endif()
|
||||
message(STATUS "DONE!")
|
||||
|
|
|
@ -15,6 +15,9 @@ option(SKIP_BUNDLES "Removes bundle functionality from the MSIX SDK. Default is
|
|||
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(MSIX_TESTS "Enables building MSIX SDK tests" ON)
|
||||
option(MSIX_SAMPLES "Enables building MSIX SDK samples" 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.")
|
||||
set(CRYPTO_LIB "" CACHE STRING "Choose the cryptography library to use, options are: [openssl, crypt32]. Use the -DCRYPTO_LIB=[option] to specify.")
|
||||
|
|
14
makeaosp.sh
14
makeaosp.sh
|
@ -11,6 +11,8 @@ dataCompressionLib=NDK_libz
|
|||
bundle=off
|
||||
xmlparser=javaxml
|
||||
validationParser=off
|
||||
samples=on
|
||||
tests=on
|
||||
|
||||
usage()
|
||||
{
|
||||
|
@ -25,6 +27,8 @@ usage()
|
|||
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' "--skip-samples Skip building samples."
|
||||
echo $'\t' "--skip-tests Skip building tests."
|
||||
}
|
||||
|
||||
printsetup()
|
||||
|
@ -39,6 +43,8 @@ printsetup()
|
|||
echo "parser:" $xmlparser
|
||||
echo "Skip bundle support:" $bundle
|
||||
echo "Validation parser:" $validationParser
|
||||
echo "Build samples:" $samples
|
||||
echo "Build tests:" $tests
|
||||
}
|
||||
|
||||
while [ "$1" != "" ]; do
|
||||
|
@ -76,6 +82,10 @@ while [ "$1" != "" ]; do
|
|||
;;
|
||||
-vp ) validationParser=on
|
||||
;;
|
||||
--skip-samples ) samples=off
|
||||
;;
|
||||
--skip-tests ) tests=off
|
||||
;;
|
||||
* ) usage
|
||||
exit 1
|
||||
esac
|
||||
|
@ -114,7 +124,7 @@ 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 "-DXML_PARSER="$xmlparser
|
||||
echo "-DUSE_VALIDATION_PARSER="$validationParser $zlib "-DAOSP=on .."
|
||||
echo "-DUSE_VALIDATION_PARSER="$validationParser $zlib "-DMSIX_SAMPLES="$samples "-DMSIX_TESTS="$tests "-DAOSP=on .."
|
||||
cmake -DCMAKE_SYSTEM_NAME=Android \
|
||||
-DCMAKE_ANDROID_NDK="$ndk" \
|
||||
-DCMAKE_SYSTEM_VERSION="$version" \
|
||||
|
@ -127,5 +137,7 @@ cmake -DCMAKE_SYSTEM_NAME=Android \
|
|||
-DSKIP_BUNDLES=$bundle \
|
||||
-DXML_PARSER=$xmlparser \
|
||||
-DUSE_VALIDATION_PARSER=$validationParser \
|
||||
-DMSIX_SAMPLES=$samples \
|
||||
-DMSIX_TESTS=$tests \
|
||||
$zlib -DAOSP=on ..
|
||||
make
|
||||
|
|
14
makeios.sh
14
makeios.sh
|
@ -6,6 +6,8 @@ dataCompressionLib=libcompression
|
|||
bundle=off
|
||||
xmlparser=applexml
|
||||
validationParser=off
|
||||
samples=on
|
||||
tests=on
|
||||
|
||||
usage()
|
||||
{
|
||||
|
@ -16,6 +18,8 @@ usage()
|
|||
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' "--skip-samples Skip building samples."
|
||||
echo $'\t' "--skip-tests Skip building tests."
|
||||
}
|
||||
|
||||
printsetup()
|
||||
|
@ -26,6 +30,8 @@ printsetup()
|
|||
echo "Skip bundle support:" $bundle
|
||||
echo "Parser:" $xmlparser
|
||||
echo "Validation parser:" $validationParser
|
||||
echo "Build samples:" $samples
|
||||
echo "Build tests:" $tests
|
||||
}
|
||||
|
||||
while [ "$1" != "" ]; do
|
||||
|
@ -51,6 +57,10 @@ while [ "$1" != "" ]; do
|
|||
-h ) usage
|
||||
exit
|
||||
;;
|
||||
--skip-samples ) samples=off
|
||||
;;
|
||||
--skip-tests ) tests=off
|
||||
;;
|
||||
* ) usage
|
||||
exit 1
|
||||
esac
|
||||
|
@ -65,12 +75,14 @@ cd .vs
|
|||
find . -name *msix* -d | xargs rm -r
|
||||
|
||||
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 .."
|
||||
echo "-DXML_PARSER="$xmlparser "-DUSE_VALIDATION_PARSER="$validationParser "-DSKIP_BUNDLES="$bundle "-DMSIX_SAMPLES="$samples "-DMSIX_TESTS="$tests "-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_SAMPLES=$samples \
|
||||
-DMSIX_TESTS=$tests \
|
||||
$zlib -DIOS=on ..
|
||||
make
|
||||
|
|
14
makelinux.sh
14
makelinux.sh
|
@ -4,6 +4,8 @@ build=MinSizeRel
|
|||
bundle=off
|
||||
validationParser=off
|
||||
pack=off
|
||||
samples=on
|
||||
tests=on
|
||||
|
||||
usage()
|
||||
{
|
||||
|
@ -12,6 +14,8 @@ usage()
|
|||
echo $'\t' "-sb Skip bundle support."
|
||||
echo $'\t' "--validation-parser|-vp Enable XML schema validation."
|
||||
echo $'\t' "--pack Include packaging features. Sets validation parser on."
|
||||
echo $'\t' "--skip-samples Skip building samples."
|
||||
echo $'\t' "--skip-tests Skip building tests."
|
||||
}
|
||||
|
||||
printsetup()
|
||||
|
@ -20,6 +24,8 @@ printsetup()
|
|||
echo "Skip bundle support:" $bundle
|
||||
echo "Validation parser:" $validationParser
|
||||
echo "Pack support:" $pack
|
||||
echo "Build samples:" $samples
|
||||
echo "Build tests:" $tests
|
||||
}
|
||||
|
||||
while [ "$1" != "" ]; do
|
||||
|
@ -39,6 +45,10 @@ while [ "$1" != "" ]; do
|
|||
--pack ) pack=on
|
||||
validationParser=on
|
||||
;;
|
||||
--skip-samples ) samples=off
|
||||
;;
|
||||
--skip-tests ) tests=off
|
||||
;;
|
||||
* ) usage
|
||||
exit 1
|
||||
esac
|
||||
|
@ -53,11 +63,13 @@ cd .vs
|
|||
find . -depth -name *msix* | xargs -0 -r rm -rf
|
||||
|
||||
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 .."
|
||||
echo "-DCMAKE_TOOLCHAIN_FILE=../cmake/linux.cmake" "-DMSIX_PACK="$pack "-DMSIX_SAMPLES="$samples "-DMSIX_TESTS="$tests "-DLINUX=on .."
|
||||
cmake -DCMAKE_BUILD_TYPE=$build \
|
||||
-DSKIP_BUNDLES=$bundle \
|
||||
-DUSE_VALIDATION_PARSER=$validationParser \
|
||||
-DCMAKE_TOOLCHAIN_FILE=../cmake/linux.cmake \
|
||||
-DMSIX_PACK=$pack \
|
||||
-DMSIX_SAMPLES=$samples \
|
||||
-DMSIX_TESTS=$tests \
|
||||
-DLINUX=on ..
|
||||
make
|
||||
|
|
14
makemac.sh
14
makemac.sh
|
@ -7,6 +7,8 @@ xmlparser=applexml
|
|||
addressSanitizer=off
|
||||
validationParser=off
|
||||
pack=off
|
||||
samples=on
|
||||
tests=on
|
||||
|
||||
usage()
|
||||
{
|
||||
|
@ -18,6 +20,8 @@ usage()
|
|||
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. Uses MSIX SDK Zlib and Xerces with validation parser on."
|
||||
echo $'\t' "--skip-samples Skip building samples."
|
||||
echo $'\t' "--skip-tests Skip building tests."
|
||||
}
|
||||
|
||||
printsetup()
|
||||
|
@ -29,6 +33,8 @@ printsetup()
|
|||
echo "Address Sanitizer:" $addressSanitizerFlag
|
||||
echo "Validation parser:" $validationParser
|
||||
echo "Pack support:" $pack
|
||||
echo "Build samples:" $samples
|
||||
echo "Build tests:" $tests
|
||||
}
|
||||
|
||||
while [ "$1" != "" ]; do
|
||||
|
@ -55,6 +61,10 @@ while [ "$1" != "" ]; do
|
|||
xmlparser=xerces
|
||||
validationParser=on
|
||||
;;
|
||||
--skip-samples ) samples=off
|
||||
;;
|
||||
--skip-tests ) tests=off
|
||||
;;
|
||||
-h ) usage
|
||||
exit
|
||||
;;
|
||||
|
@ -73,12 +83,14 @@ find . -name *msix* -d | xargs rm -r
|
|||
|
||||
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 .."
|
||||
echo "-DMSIX_PACK="$pack "-DMSIX_SAMPLES="$samples "-DMSIX_TESTS="$tests "-DMACOS=on .."
|
||||
cmake -DCMAKE_BUILD_TYPE=$build \
|
||||
-DXML_PARSER=$xmlparser \
|
||||
-DSKIP_BUNDLES=$bundle \
|
||||
-DASAN=$addressSanitizer \
|
||||
-DUSE_VALIDATION_PARSER=$validationParser \
|
||||
-DMSIX_PACK=$pack \
|
||||
-DMSIX_SAMPLES=$samples \
|
||||
-DMSIX_TESTS=$tests \
|
||||
$zlib -DMACOS=on ..
|
||||
make
|
||||
|
|
14
makewin.cmd
14
makewin.cmd
|
@ -35,6 +35,8 @@ set crypto="-DCRYPTO_LIB=crypt32"
|
|||
set msvc="-DUSE_STATIC_MSVC=off"
|
||||
set bundle="-DSKIP_BUNDLES=off"
|
||||
set pack="-DMSIX_PACK=off"
|
||||
set samples="-DMSIX_SAMPLES=on"
|
||||
set tests="-DMSIX_TESTS=on"
|
||||
|
||||
:parseArgs
|
||||
if /I "%~2" == "--debug" (
|
||||
|
@ -86,6 +88,12 @@ if /I "%~2" == "--pack" (
|
|||
set pack="-DMSIX_PACK=on"
|
||||
set validationParser="-DUSE_VALIDATION_PARSER=on"
|
||||
)
|
||||
if /I "%~2" == "--skip-samples" (
|
||||
set samples="-DMSIX_SAMPLES=off"
|
||||
)
|
||||
if /I "%~2" == "--skip-tests" (
|
||||
set tests="-DMSIX_TESTS=off"
|
||||
)
|
||||
shift /2
|
||||
if not "%~2"=="" goto parseArgs
|
||||
|
||||
|
@ -94,8 +102,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% %pack% -G"NMake Makefiles" ..
|
||||
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=%build% %validationParser% %zlib% %parser% %crypto% %msvc% %bundle% %pack% -G"NMake Makefiles" ..
|
||||
echo cmake -DWIN32=on -DCMAKE_BUILD_TYPE=%build% %validationParser% %zlib% %parser% %crypto% %msvc% %bundle% %pack% %samples% %tests% -G"NMake Makefiles" ..
|
||||
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=%build% %validationParser% %zlib% %parser% %crypto% %msvc% %bundle% %pack% %samples% %tests% -G"NMake Makefiles" ..
|
||||
nmake /NOLOGO
|
||||
|
||||
goto Exit
|
||||
|
@ -116,6 +124,8 @@ echo --crypto-openssl, -co = Use OpenSSL crypto [currently for testing]. D
|
|||
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. Sets validation parser on.
|
||||
echo --skip-samples = Skip building samples.
|
||||
echo --skip-test = Skip building tests.
|
||||
echo --help, -h, /? = Print this usage information and exit.
|
||||
:Exit
|
||||
EXIT /B 0
|
||||
|
|
|
@ -4,21 +4,25 @@
|
|||
cmake_minimum_required(VERSION 3.8.0 FATAL_ERROR)
|
||||
project (PackSample)
|
||||
|
||||
# Define two variables in order not to repeat ourselves.
|
||||
set(BINARY_NAME PackSample)
|
||||
|
||||
if(WIN32)
|
||||
set(DESCRIPTION "PackSample manifest")
|
||||
configure_file(${MSIX_PROJECT_ROOT}/manifest.cmakein ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}.exe.manifest CRLF)
|
||||
set(MANIFEST ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}.exe.manifest)
|
||||
configure_file(${MSIX_PROJECT_ROOT}/manifest.cmakein ${MSIX_SAMPLE_OUTPUT_DIRECTORY}/${PROJECT_NAME}.exe.manifest CRLF)
|
||||
set(MANIFEST ${MSIX_SAMPLE_OUTPUT_DIRECTORY}/${PROJECT_NAME}.exe.manifest)
|
||||
endif()
|
||||
|
||||
add_executable(${BINARY_NAME}
|
||||
add_executable(${PROJECT_NAME}
|
||||
PackSample.cpp
|
||||
${MANIFEST}
|
||||
)
|
||||
|
||||
target_include_directories(${BINARY_NAME} PRIVATE ${MSIX_BINARY_ROOT}/src/msix ../inc)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${MSIX_BINARY_ROOT}/src/msix ../inc)
|
||||
|
||||
add_dependencies(${BINARY_NAME} msix)
|
||||
target_link_libraries(${BINARY_NAME} PUBLIC msix)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC msix)
|
||||
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${MSIX_SAMPLE_OUTPUT_DIRECTORY}"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${MSIX_SAMPLE_OUTPUT_DIRECTORY}"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${MSIX_SAMPLE_OUTPUT_DIRECTORY}"
|
||||
)
|
||||
|
||||
add_dependencies(${PROJECT_NAME} msix)
|
||||
|
|
|
@ -6,12 +6,9 @@
|
|||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <experimental/filesystem>
|
||||
using namespace std::experimental::filesystem;
|
||||
#else
|
||||
#include <queue>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <fts.h>
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
@ -141,14 +138,45 @@ static const std::map<std::string, APPX_COMPRESSION_OPTION> extToContentType =
|
|||
#ifdef WIN32
|
||||
std::vector<std::string> GetAllFilesInDirectory(const std::string& directory)
|
||||
{
|
||||
static std::wstring dot(L".");
|
||||
static std::wstring dotdot(L"..");
|
||||
|
||||
std::vector<std::string> files;
|
||||
for (const auto& file : recursive_directory_iterator(directory))
|
||||
std::queue<std::wstring> directories;
|
||||
directories.push(utf8_to_utf16(directory));
|
||||
|
||||
do
|
||||
{
|
||||
if (!is_directory(file))
|
||||
std::wstring root = directories.front();
|
||||
std::wstring directory = root + L"\\*";
|
||||
directories.pop();
|
||||
|
||||
WIN32_FIND_DATA findFileData = {};
|
||||
std::unique_ptr<std::remove_pointer<HANDLE>::type, decltype(&::FindClose)> find(
|
||||
FindFirstFile(reinterpret_cast<LPCWSTR>(directory.c_str()), &findFileData),
|
||||
&FindClose);
|
||||
|
||||
if (INVALID_HANDLE_VALUE != find.get())
|
||||
{
|
||||
files.push_back(file.path().string());
|
||||
do
|
||||
{
|
||||
std::wstring utf16Name = std::wstring(findFileData.cFileName);
|
||||
std::wstring child = root + L"\\" + utf16Name;
|
||||
if (findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
{
|
||||
if (dot != utf16Name && dotdot != utf16Name)
|
||||
{
|
||||
directories.push(child);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
files.push_back(utf16_to_utf8(child));
|
||||
}
|
||||
} while(FindNextFile(find.get(), &findFileData));
|
||||
}
|
||||
}
|
||||
|
||||
} while (!directories.empty());
|
||||
return files;
|
||||
}
|
||||
#else
|
||||
|
|
|
@ -6,4 +6,7 @@ cmake_minimum_required(VERSION 3.8.0 FATAL_ERROR)
|
|||
|
||||
add_subdirectory(msix)
|
||||
add_subdirectory(makemsix)
|
||||
add_subdirectory(test)
|
||||
|
||||
if(MSIX_TESTS)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
|
Загрузка…
Ссылка в новой задаче