Move generation of headers to its own cmake module

This commit is contained in:
Ruben Guerrero Samaniego 2018-03-06 16:45:39 -08:00 коммит произвёл Phil Smith
Родитель 6f3221199a
Коммит 9f529df04c
4 изменённых файлов: 55 добавлений и 55 удалений

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

@ -91,7 +91,7 @@ LIST(APPEND CERTS_TO_PUBLISH
Microsoft_MarketPlace_PCA_2011.cer
)
FOREACH(CERT_TO_PUBLISH ${CERTS_TO_PUBLISH})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/certs/${CERT_TO_PUBLISH} ${CMAKE_BINARY_DIR}/build/certs/${CERT_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 "--------------------------------")

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

@ -0,0 +1,53 @@
# Create header for BlockMap schemas
file(READ "${CMAKE_PROJECT_ROOT}/resources/AppxPackaging/BlockMap/schema/BlockMapSchema.xsd" BLOCKMAP_SCHEMA)
file(READ "${CMAKE_PROJECT_ROOT}/resources/AppxPackaging/BlockMap/schema/BlockMapSchema2015.xsd" BLOCKMAP_SCHEMA_2015)
file(READ "${CMAKE_PROJECT_ROOT}/resources/AppxPackaging/BlockMap/schema/BlockMapSchema2017.xsd" BLOCKMAP_SCHEMA_2017)
set(BLOCKMAP_HEADER "// This file is generated by CMake and contains XSDs for parsing the AppxBlockMap.xml. Do not edit!!
#include <string>
#include <map>
std::map<std::string, std::string> blockMapSchema = {
{\"blockMapSchemaRaw\", R\"(${BLOCKMAP_SCHEMA})\" },
{\"blockMapSchema2015Raw\", R\"(${BLOCKMAP_SCHEMA_2015})\"},
{\"blockMapSchema2017Raw\", R\"(${BLOCKMAP_SCHEMA_2017})\"}
};
")
FILE(WRITE "${CMAKE_PROJECT_ROOT}/src/inc/AppxBlockMapSchemas.hpp" "${BLOCKMAP_HEADER}")
# Create header for [Content_Types] schema
FILE(READ "${CMAKE_PROJECT_ROOT}/resources/AppxPackaging/[Content_Types]/opc-contentTypes.xsd" CONTENT_TYPES_SCHEMA)
SET(CONTENT_TYPES_HEADER "// This file is generated by CMake and contains XSDs for parsing [Content_Types].xml. Do not edit!!
#include <string>
#include <map>
std::map<std::string, std::string> contentTypesSchema = {
{\"contentTypesSchemaRaw\", R\"###(${CONTENT_TYPES_SCHEMA})###\" }
};
")
FILE(WRITE "${CMAKE_PROJECT_ROOT}/src/inc/ContentTypesSchemas.hpp" "${CONTENT_TYPES_HEADER}")
# Create header for Appx certs
file(READ "${CMAKE_PROJECT_ROOT}/resources/certs/base64_MSFT_RCA_2010.cer" BASE64_MSFT_RCA_2010)
file(READ "${CMAKE_PROJECT_ROOT}/resources/certs/base64_MSFT_RCA_2011.cer" BASE64_MSFT_RCA_2011)
file(READ "${CMAKE_PROJECT_ROOT}/resources/certs/base64_STORE_PCA_2011.cer" BASE64_STORE_PCA_2011)
file(READ "${CMAKE_PROJECT_ROOT}/resources/certs/base64_Windows_Production.cer" BASE64_WINDOWS_PRODUCTION)
file(READ "${CMAKE_PROJECT_ROOT}/resources/certs/base64_Windows_Production_PCA_2011.cer" BASE64_WINDOWS_PRODUCTION_PCA_2011)
file(READ "${CMAKE_PROJECT_ROOT}/resources/certs/Microsoft_MarketPlace_PCA_2011.cer" BASE64_MSFT_MARKETPLACE_CA_G_016)
set(APPX_CERTS "// This file is generated by CMake and contains certs for parsing the AppxBlockMap.xml. Do not edit!!
#include <string>
#include <vector>
namespace MSIX {
// Do not alter the order of these certificates -- they are in chain order
std::vector<std::string> appxCerts = {
R\"(${BASE64_MSFT_RCA_2010})\",
R\"(${BASE64_WINDOWS_PRODUCTION_PCA_2011})\",
R\"(${BASE64_MSFT_RCA_2011})\",
R\"(${BASE64_STORE_PCA_2011})\",
R\"(${BASE64_MSFT_MARKETPLACE_CA_G_016})\",
R\"(${BASE64_WINDOWS_PRODUCTION})\",
};
}")
file(WRITE "${CMAKE_PROJECT_ROOT}/src/inc/AppxCerts.hpp" "${APPX_CERTS}")

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

@ -12,32 +12,3 @@ add_subdirectory(msix)
add_subdirectory(makemsix)
ADD_DEPENDENCIES(makemsix msix)
# Create header for BlockMap schemas
file(READ "${CMAKE_PROJECT_ROOT}/certs/base64_MSFT_RCA_2010.cer" BASE64_MSFT_RCA_2010)
file(READ "${CMAKE_PROJECT_ROOT}/certs/base64_MSFT_RCA_2011.cer" BASE64_MSFT_RCA_2011)
file(READ "${CMAKE_PROJECT_ROOT}/certs/base64_STORE_PCA_2011.cer" BASE64_STORE_PCA_2011)
file(READ "${CMAKE_PROJECT_ROOT}/certs/base64_Windows_Production.cer" BASE64_WINDOWS_PRODUCTION)
file(READ "${CMAKE_PROJECT_ROOT}/certs/base64_Windows_Production_PCA_2011.cer" BASE64_WINDOWS_PRODUCTION_PCA_2011)
file(READ "${CMAKE_PROJECT_ROOT}/certs/Microsoft_MarketPlace_PCA_2011.cer" BASE64_MSFT_MARKETPLACE_CA_G_016)
set(APPX_CERTS "// This file is generated by CMake and contains certs for parsing the AppxBlockMap.xml. Do not edit!!
#include <string>
#include <vector>
namespace MSIX {
// Do not alter the order of these certificates -- they are in chain order
std::vector<std::string> appxCerts = {
R\"(${BASE64_MSFT_RCA_2010})\",
R\"(${BASE64_WINDOWS_PRODUCTION_PCA_2011})\",
R\"(${BASE64_MSFT_RCA_2011})\",
R\"(${BASE64_STORE_PCA_2011})\",
R\"(${BASE64_MSFT_MARKETPLACE_CA_G_016})\",
R\"(${BASE64_WINDOWS_PRODUCTION})\",
};
}")
file(WRITE "${CMAKE_PROJECT_ROOT}/src/inc/AppxCerts.hpp" "${APPX_CERTS}")

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

@ -66,31 +66,7 @@ MESSAGE (STATUS "PAL: SHA256 = ${SHA256}")
MESSAGE (STATUS "PAL: Signature = ${Signature}")
MESSAGE (STATUS "PAL: XML = ${XmlParser}")
# Create header for BlockMap schemas
file(READ "${CMAKE_PROJECT_ROOT}/AppxPackaging/BlockMap/schema/BlockMapSchema.xsd" BLOCKMAP_SCHEMA)
file(READ "${CMAKE_PROJECT_ROOT}/AppxPackaging/BlockMap/schema/BlockMapSchema2015.xsd" BLOCKMAP_SCHEMA_2015)
file(READ "${CMAKE_PROJECT_ROOT}/AppxPackaging/BlockMap/schema/BlockMapSchema2017.xsd" BLOCKMAP_SCHEMA_2017)
set(BLOCKMAP_HEADER "// This file is generated by CMake and contains XSDs for parsing the AppxBlockMap.xml. Do not edit!!
#include <string>
#include <map>
std::map<std::string, std::string> blockMapSchema = {
{\"blockMapSchemaRaw\", R\"(${BLOCKMAP_SCHEMA})\" },
{\"blockMapSchema2015Raw\", R\"(${BLOCKMAP_SCHEMA_2015})\"},
{\"blockMapSchema2017Raw\", R\"(${BLOCKMAP_SCHEMA_2017})\"}
};
")
FILE(WRITE "../inc/AppxBlockMapSchemas.hpp" "${BLOCKMAP_HEADER}")
# Create header for [Content_Types] schema
FILE(READ "${CMAKE_PROJECT_ROOT}/AppxPackaging/[Content_Types]/opc-contentTypes.xsd" CONTENT_TYPES_SCHEMA)
SET(CONTENT_TYPES_HEADER "// This file is generated by CMake and contains XSDs for parsing [Content_Types].xml. Do not edit!!
#include <string>
#include <map>
std::map<std::string, std::string> contentTypesSchema = {
{\"contentTypesSchemaRaw\", R\"###(${CONTENT_TYPES_SCHEMA})###\" }
};
")
FILE(WRITE "../inc/ContentTypesSchemas.hpp" "${CONTENT_TYPES_HEADER}")
include(msix_resources)
SET(LIB_PUBLIC_HEADERS
../inc/AppxPackaging.hpp