Enable a switch to make zlib a dynamic dependency for msix.dll

This commit is contained in:
Ruben Guerrero Samaniego 2018-04-06 00:47:53 +00:00 коммит произвёл msftrubengu
Родитель 76f373caab
Коммит 95c361b53d
8 изменённых файлов: 67 добавлений и 30 удалений

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

@ -150,6 +150,11 @@ SET(CMAKE_BUILD_TYPE Debug CACHE STRING
FORCE)
ENDIF()
# Enforce build libraries
IF(NOT USE_SHARED_ZLIB)
MESSAGE (STATUS "Choose the type of dependency of zlib, Use the -DUSE_SHARED_ZLIB=on to have a shared dependency. Default is 'off' (static)")
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))

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

@ -9,10 +9,14 @@ ADD_CUSTOM_TARGET(LIBS)
# set(AMD64 OFF CACHE BOOL "Disable building i686 assembly implementation" FORCE)
# set(ASM686 OFF CACHE BOOL "Disable building amd64 assembly implementation" FORCE)
set(MINGW OFF CACHE BOOL "Only build the static lib" FORCE)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Only build the static lib" FORCE)
set(HAVE_OFF64_T OFF CACHE BOOL "no need to build zlib tests as part of build" FORCE)
set(SKIP_INSTALL_SHARED ON CACHE BOOL "Don't install zlib.dll" FORCE)
set(ZLIB_TESTS OFF CACHE BOOL "Don't build zlib tests/examples" FORCE)
IF(USE_SHARED_ZLIB)
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build dll" FORCE)
ELSE()
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build dll" FORCE)
ENDIF()
add_subdirectory(zlib)
# Xerces

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

@ -1,29 +1,36 @@
@echo off
set var=%1
set val=%2
echo var = %var%
echo val = %val%
IF /I "%val%" == "VALIDATE" (
set val="-DUSE_VALIDATION_PARSER=on"
) ELSE (
set val="-DUSE_VALIDATION_PARSER=off"
)
set build=%1
set val="-DUSE_VALIDATION_PARSER=off"
set zlib="-DUSE_SHARED_ZLIB=off"
IF /I "%var%" == "WIN32" (
echo calling makewin32.cmd %val%
call makewin32.cmd %val%
:parseargs
IF /I "%~2" == "VALIDATE" (
set val="-DUSE_VALIDATION_PARSER=on"
)
IF /I "%~2" == "SHARED_ZLIB" (
set zlib="-DUSE_SHARED_ZLIB=on"
)
shift /2
IF not "%~2"=="" goto parseargs
echo val = %val%
echo zlib = %zlib%
IF /I "%build%" == "WIN32" (
echo calling makewin32.cmd %val% %zlib%
call makewin32.cmd %val% %zlib%
) ELSE (
IF /I "%var%" == "WIN32-x64" (
echo calling makewin32x64.cmd %val%
call makewin32x64.cmd %val%
IF /I "%build%" == "WIN32-x64" (
echo calling makewin32x64.cmd %val% %zlib%
call makewin32x64.cmd %val% %zlib%
) ELSE (
IF /I "%var%" == "WIN32chk" (
echo calling makewin32chk.cmd %val%
call makewin32chk.cmd %val%
IF /I "%build%" == "WIN32chk" (
echo calling makewin32chk.cmd %val% %zlib%
call makewin32chk.cmd %val% %zlib%
) ELSE (
IF /I "%var%" == "WIN32-x64chk" (
echo calling makewin32x64chk.cmd %val%
call makewin32x64chk.cmd %val%
IF /I "%build%" == "WIN32-x64chk" (
echo calling makewin32x64chk.cmd %val% %zlib%
call makewin32x64chk.cmd %val% %zlib%
) ELSE (
goto FAIL
)
@ -32,8 +39,8 @@ IF /I "%var%" == "WIN32" (
)
goto EXIT
:FAIL
echo specify one of [WIN32, WIN32-x64, WIN32chk, WIN32-x64chk] for 1st option
echo specify VALIDATE for 2nd option to disable XML schema validation.
echo specify one of [WIN32, WIN32-x64, WIN32chk, WIN32-x64chk] for 1st option. Required.
echo other options: VALIDATE to enable XML schema validation. SHARED_ZLIB to don't statically link zlib.
EXIT /B 0
:Exit
echo done.

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

@ -3,6 +3,10 @@ if not exist .vs md .vs
cd .vs
if exist CMakeFiles rd /s /q CMakeFiles
if exist CMakeCache.txt del CMakeCache.txt
echo %cd%
set currentpath=%cd%
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=MinSizeRel %1 -G"NMake Makefiles" ..
cd /D %currentpath%
echo cmake -DWIN32=on -DCMAKE_BUILD_TYPE=MinSizeRel %1 %2 -G"NMake Makefiles" ..
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=MinSizeRel %1 %2 -G"NMake Makefiles" ..
nmake

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

@ -3,6 +3,10 @@ if not exist .vs md .vs
cd .vs
if exist CMakeFiles rd /s /q CMakeFiles
if exist CMakeCache.txt del CMakeCache.txt
echo %cd%
set currentpath=%cd%
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=Debug %1 -G"NMake Makefiles" ..
cd /D %currentpath%
echo cmake -DWIN32=on -DCMAKE_BUILD_TYPE=MinSizeRel %1 %2 -G"NMake Makefiles" ..
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=Debug %1 %2 -G"NMake Makefiles" ..
nmake

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

@ -3,6 +3,10 @@ if not exist .vs md .vs
cd .vs
if exist CMakeFiles rd /s /q CMakeFiles
if exist CMakeCache.txt del CMakeCache.txt
echo %cd%
set currentpath=%cd%
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=MinSizeRel %1 -G"NMake Makefiles" ..
cd /D %currentpath%
echo cmake -DWIN32=on -DCMAKE_BUILD_TYPE=MinSizeRel %1 %2 -G"NMake Makefiles" ..
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=MinSizeRel %1 %2 -G"NMake Makefiles" ..
nmake

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

@ -3,6 +3,10 @@ if not exist .vs md .vs
cd .vs
if exist CMakeFiles rd /s /q CMakeFiles
if exist CMakeCache.txt del CMakeCache.txt
echo %cd%
set currentpath=%cd%
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=Debug %1 -G"NMake Makefiles" ..
cd /D %currentpath%
echo cmake -DWIN32=on -DCMAKE_BUILD_TYPE=MinSizeRel %1 %2 -G"NMake Makefiles" ..
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=Debug %1 %2 -G"NMake Makefiles" ..
nmake

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

@ -142,13 +142,18 @@ SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES
PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers
)
MESSAGE(STATUS "MSIX takes a static dependency on zlib")
INCLUDE_DIRECTORIES(
${include_directories}
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/zlib
${CMAKE_PROJECT_ROOT}/lib/zlib
)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE zlibstatic)
IF(USE_SHARED_ZLIB)
MESSAGE(STATUS "MSIX takes a static dependency on zlib")
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE zlib)
else()
MESSAGE(STATUS "MSIX takes a dynamic dependency on zlib")
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE zlibstatic)
endif()
IF (XML_PARSER MATCHES xerces)
MESSAGE(STATUS "MSIX takes a static dependency on xerces")