This is an automated email from the ASF dual-hosted git repository.

bakaid pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git


The following commit(s) were added to refs/heads/master by this push:
     new 0cdb8e9  MINIFICPP-1163 - Add option to bundle DLLs or use Merge 
Modules for Windows MSI
0cdb8e9 is described below

commit 0cdb8e946356821502bb4f35a3da55013f921a9e
Author: amarmer <amar...@gmail.com>
AuthorDate: Tue Feb 18 00:46:07 2020 -0800

    MINIFICPP-1163 - Add option to bundle DLLs or use Merge Modules for Windows 
MSI
    
    Signed-off-by: Daniel Bakai <bak...@apache.org>
    
    This closes #739
---
 CMakeLists.txt                             | 75 +++++++++++++++++++++---------
 msi/WixWin.wsi                             | 26 ++++++-----
 msi/{WixWin.wsi => WixWinMergeModules.wsi} |  0
 win_build_vs.bat                           |  6 ++-
 4 files changed, 73 insertions(+), 34 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9c47e89..87fe4f3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,7 +53,7 @@ option(FORCE_WINDOWS "Instructs the build system to force 
Windows builds when WI
 option(DISABLE_CURL "Disables libCurl Properties." OFF)
 
 option(USE_GOLD_LINKER "Use Gold Linker" OFF)
-
+option(INSTALLER_MERGE_MODULES "Creates installer with merge modules" OFF)
 
 # Use ccache if present
 find_program(CCACHE_FOUND ccache)
@@ -550,27 +550,60 @@ if(WIN32)
                list(REVERSE VCRUNTIME_REDIST_VERSIONS)
                list(GET VCRUNTIME_REDIST_VERSIONS 0 VCRUNTIME_REDIST_DIR)
        endif()
-       file(GLOB VCRUNTIME_X86_MERGEMODULES 
"${VCRUNTIME_REDIST_DIR}/MergeModules/Microsoft_VC*_CRT_x86.msm")
-       file(GLOB VCRUNTIME_X64_MERGEMODULES 
"${VCRUNTIME_REDIST_DIR}/MergeModules/Microsoft_VC*_CRT_x64.msm")
-       if (NOT VCRUNTIME_X86_MERGEMODULES OR NOT VCRUNTIME_X64_MERGEMODULES)
-               message(FATAL_ERROR "Could not find the VC Redistributable 
Merge Modules. Please set VCRUNTIME_X86_MERGEMODULE_PATH and 
VCRUNTIME_X64_MERGEMODULE_PATH manually!")
-       else()
-               list(GET VCRUNTIME_X86_MERGEMODULES 0 
VCRUNTIME_X86_MERGEMODULE_PATH)
-               list(GET VCRUNTIME_X64_MERGEMODULES 0 
VCRUNTIME_X64_MERGEMODULE_PATH)
-       endif()
 
-       if(CMAKE_SIZEOF_VOID_P EQUAL 8)
-               message("Using ${VCRUNTIME_X64_MERGEMODULE_PATH} VC 
Redistributable Merge Module")
-               configure_file("msi/x64.wsi" "msi/x64.wsi" @ONLY)
-               set(CPACK_WIX_EXTRA_SOURCES 
"${CMAKE_CURRENT_BINARY_DIR}/msi/x64.wsi")
-       elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
-               message("Using ${VCRUNTIME_X86_MERGEMODULE_PATH} VC 
Redistributable Merge Module")
-               configure_file("msi/x86.wsi" "msi/x86.wsi" @ONLY)
-               set(CPACK_WIX_EXTRA_SOURCES 
"${CMAKE_CURRENT_BINARY_DIR}/msi/x86.wsi")
-       else()
-               message(FATAL_ERROR "Could not determine architecture, 
CMAKE_SIZEOF_VOID_P is unexpected: ${CMAKE_SIZEOF_VOID_P}")
-       endif()
-       set(CPACK_WIX_TEMPLATE "${CMAKE_CURRENT_SOURCE_DIR}/msi/WixWin.wsi")
+    if (INSTALLER_MERGE_MODULES)
+        message("Creating installer with merge modules")
+        file(GLOB VCRUNTIME_X86_MERGEMODULES 
"${VCRUNTIME_REDIST_DIR}/MergeModules/Microsoft_VC*_CRT_x86.msm")
+        file(GLOB VCRUNTIME_X64_MERGEMODULES 
"${VCRUNTIME_REDIST_DIR}/MergeModules/Microsoft_VC*_CRT_x64.msm")
+        if (NOT VCRUNTIME_X86_MERGEMODULES OR NOT VCRUNTIME_X64_MERGEMODULES)
+            message(FATAL_ERROR "Could not find the VC Redistributable Merge 
Modules. Please set VCRUNTIME_X86_MERGEMODULE_PATH and 
VCRUNTIME_X64_MERGEMODULE_PATH manually!")
+        else()
+            list(GET VCRUNTIME_X86_MERGEMODULES 0 
VCRUNTIME_X86_MERGEMODULE_PATH)
+            list(GET VCRUNTIME_X64_MERGEMODULES 0 
VCRUNTIME_X64_MERGEMODULE_PATH)
+        endif()
+
+        if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+            message("Using ${VCRUNTIME_X64_MERGEMODULE_PATH} VC 
Redistributable Merge Module")
+            configure_file("msi/x64.wsi" "msi/x64.wsi" @ONLY)
+            set(CPACK_WIX_EXTRA_SOURCES 
"${CMAKE_CURRENT_BINARY_DIR}/msi/x64.wsi")
+        elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
+            message("Using ${VCRUNTIME_X86_MERGEMODULE_PATH} VC 
Redistributable Merge Module")
+            configure_file("msi/x86.wsi" "msi/x86.wsi" @ONLY)
+            set(CPACK_WIX_EXTRA_SOURCES 
"${CMAKE_CURRENT_BINARY_DIR}/msi/x86.wsi")
+        else()
+            message(FATAL_ERROR "Could not determine architecture, 
CMAKE_SIZEOF_VOID_P is unexpected: ${CMAKE_SIZEOF_VOID_P}")
+        endif()
+        set(CPACK_WIX_TEMPLATE 
"${CMAKE_CURRENT_SOURCE_DIR}/msi/WixWinMergeModules.wsi")
+    else()
+        message("Creating installer with redistributables")
+        file(GLOB VCRUNTIME_X86_REDIST_CRT_DIR 
"${VCRUNTIME_REDIST_DIR}/x86/Microsoft.VC141.CRT")
+        file(GLOB VCRUNTIME_X64_REDIST_CRT_DIR 
"${VCRUNTIME_REDIST_DIR}/x64/Microsoft.VC141.CRT")
+
+        if (NOT VCRUNTIME_X86_REDIST_CRT_DIR OR NOT 
VCRUNTIME_X64_REDIST_CRT_DIR)
+            message(FATAL_ERROR "Could not find the VC Redistributable. Please 
set VCRUNTIME_X86_REDIST_CRT_DIR and VCRUNTIME_X64_REDIST_CRT_DIR manually!")
+        endif()
+
+        if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+            message("Using ${VCRUNTIME_X64_REDIST_CRT_DIR} VC 
Redistributables")
+            file(COPY "${VCRUNTIME_X64_REDIST_CRT_DIR}/concrt140.dll" 
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/redist")
+            file(COPY "${VCRUNTIME_X64_REDIST_CRT_DIR}/msvcp140.dll" 
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/redist")
+            file(COPY "${VCRUNTIME_X64_REDIST_CRT_DIR}/msvcp140_1.dll" 
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/redist")
+            file(COPY "${VCRUNTIME_X64_REDIST_CRT_DIR}/msvcp140_2.dll" 
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/redist")
+            file(COPY "${VCRUNTIME_X64_REDIST_CRT_DIR}/vccorlib140.dll" 
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/redist")
+            file(COPY "${VCRUNTIME_X64_REDIST_CRT_DIR}/vcruntime140.dll" 
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/redist")
+        elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
+            message("Using ${VCRUNTIME_X86_REDIST_CRT_DIR} VC 
Redistributables")
+            file(COPY "${VCRUNTIME_X86_REDIST_CRT_DIR}/concrt140.dll" 
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/redist")
+            file(COPY "${VCRUNTIME_X86_REDIST_CRT_DIR}/msvcp140.dll" 
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/redist")
+            file(COPY "${VCRUNTIME_X86_REDIST_CRT_DIR}/msvcp140_1.dll" 
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/redist")
+            file(COPY "${VCRUNTIME_X86_REDIST_CRT_DIR}/msvcp140_2.dll" 
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/redist")
+            file(COPY "${VCRUNTIME_X86_REDIST_CRT_DIR}/vccorlib140.dll" 
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/redist")
+            file(COPY "${VCRUNTIME_X86_REDIST_CRT_DIR}/vcruntime140.dll" 
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/redist")
+        else()
+            message(FATAL_ERROR "Could not determine architecture, 
CMAKE_SIZEOF_VOID_P is unexpected: ${CMAKE_SIZEOF_VOID_P}")
+        endif()
+        set(CPACK_WIX_TEMPLATE "${CMAKE_CURRENT_SOURCE_DIR}/msi/WixWin.wsi")
+    endif()
 else()
        set(CPACK_SOURCE_GENERATOR "TGZ")
 endif(WIN32)
diff --git a/msi/WixWin.wsi b/msi/WixWin.wsi
index 3543174..d8edf1e 100644
--- a/msi/WixWin.wsi
+++ b/msi/WixWin.wsi
@@ -49,10 +49,6 @@ Licensed to the Apache Software Foundation (ASF) under one 
or more
       <Custom Action="UpdateConfig" After="InstallFiles">NOT Installed</Custom>
     </InstallExecuteSequence> -->
 
-
-    <Feature Id="VCRedist" Title="Visual C++ 14.0 Runtime" 
AllowAdvertise="yes"  Level="1">
-      <MergeRef Id="VCRedist"/>
-    </Feature>
 <!--
     <Feature Id="VCRedist64" Title="Visual C++ 14.0 Runtime" 
AllowAdvertise="yes"  Level="1">
       <MergeRef Id="VCRedist64"/>
@@ -321,10 +317,13 @@ Licensed to the Apache Software Foundation (ASF) under 
one or more
 
             <Directory Id="INSTALLBINDIR" Name="bin">
               <Component Id="minifiService" 
Guid="87658309-0339-425c-8633-f54ffaaa4921">
-                <File Id="MiNiFiExe"
-                         Name="minifi.exe"
-                         KeyPath="yes"
-                         Source="main\minifi.exe"/>
+                <File Id="MiNiFiExe" Name="minifi.exe" KeyPath="yes" 
Source="main\minifi.exe"/>
+                <File Id="MiNiFiExe_concrt140" Name="concrt140.dll" 
KeyPath="no" Source="redist\concrt140.dll"/>
+                <File Id="MiNiFiExe_msvcp140" Name="msvcp140.dll" KeyPath="no" 
Source="redist\msvcp140.dll"/>
+                <File Id="MiNiFiExe_msvcp140_1" Name="msvcp140_1.dll" 
KeyPath="no" Source="redist\msvcp140_1.dll"/>
+                <File Id="MiNiFiExe_msvcp140_2" Name="msvcp140_2.dll" 
KeyPath="no" Source="redist\msvcp140_2.dll"/>
+                <File Id="MiNiFiExe_vccorlib140" Name="vccorlib140.dll" 
KeyPath="no" Source="redist\vccorlib140.dll"/>
+                <File Id="MiNiFiExe_vcruntime140" Name="vcruntime140.dll" 
KeyPath="no" Source="redist\vcruntime140.dll"/>
                 <!-- 
                 It is not possible to set 'ServiceConfig' for 2 'Component' 
(error LGHT0130 : The primary key 'Apache NiFi MiNiFi' is duplicated in table 
'ServiceConfig').
                 Problem is described: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Installing-a-Service-with-Varying-Dependencies-td693097.html
@@ -362,10 +361,13 @@ Licensed to the Apache Software Foundation (ASF) under 
one or more
                 <Condition><![CDATA[SERVICEACCOUNT="LocalSystem"]]></Condition>
               </Component>
               <Component Id="minifiServiceNotLocal" 
Guid="87658309-0339-425c-8633-f54ffaaa4922">
-                <File Id="MiNiFiExeWithPassword"
-                         Name="minifi.exe"
-                         KeyPath="yes"
-                         Source="main\minifi.exe"/>
+                <File Id="MiNiFiExeWithPassword" Name="minifi.exe" 
KeyPath="yes" Source="main\minifi.exe"/>
+                <File Id="MiNiFiExeWithPassword_concrt140" 
Name="concrt140.dll" KeyPath="no" Source="redist\concrt140.dll"/>
+                <File Id="MiNiFiExeWithPassword_msvcp140" Name="msvcp140.dll" 
KeyPath="no" Source="redist\msvcp140.dll"/>
+                <File Id="MiNiFiExeWithPassword_msvcp140_1" 
Name="msvcp140_1.dll" KeyPath="no" Source="redist\msvcp140_1.dll"/>
+                <File Id="MiNiFiExeWithPassword_msvcp140_2" 
Name="msvcp140_2.dll" KeyPath="no" Source="redist\msvcp140_2.dll"/>
+                <File Id="MiNiFiExeWithPassword_vccorlib140" 
Name="vccorlib140.dll" KeyPath="no" Source="redist\vccorlib140.dll"/>
+                <File Id="MiNiFiExeWithPassword_vcruntime140" 
Name="vcruntime140.dll" KeyPath="no" Source="redist\vcruntime140.dll"/>
                 <ServiceInstall Id="MiNiFiExeServiceWithPassword"
                                 Type="ownProcess"
                                 Vital="yes"
diff --git a/msi/WixWin.wsi b/msi/WixWinMergeModules.wsi
similarity index 100%
copy from msi/WixWin.wsi
copy to msi/WixWinMergeModules.wsi
diff --git a/win_build_vs.bat b/win_build_vs.bat
index f681db0..2ffef3d 100644
--- a/win_build_vs.bat
+++ b/win_build_vs.bat
@@ -30,6 +30,7 @@ set build_SQL=OFF
 set disable_libarchive=ON
 set generator="Visual Studio 15 2017"
 set cpack=OFF
+set installer_merge_modules=OFF
 
 set arg_counter=0
 for %%x in (%*) do (
@@ -53,6 +54,9 @@ for %%x in (%*) do (
        if [%%~x] EQU [/A] ( 
        set disable_libarchive=OFF
     )
+       if [%%~x] EQU [/M] ( 
+       set installer_merge_modules=ON
+    )
        rem if [%%~x] EQU [/C] ( 
        rem set build_coap=ON
     rem )
@@ -68,7 +72,7 @@ for %%x in (%*) do (
 mkdir %builddir%
 pushd %builddir%\
 
-cmake -G %generator% -DENABLE_SQL=%build_SQL% 
-DCMAKE_BUILD_TYPE_INIT=%cmake_build_type% 
-DCMAKE_BUILD_TYPE=%cmake_build_type% -DWIN32=WIN32 
-DENABLE_LIBRDKAFKA=%build_kafka% -DENABLE_JNI=%build_jni% -DOPENSSL_OFF=OFF 
-DENABLE_COAP=%build_coap% -DUSE_SHARED_LIBS=OFF -DDISABLE_CONTROLLER=ON  
-DBUILD_ROCKSDB=ON -DFORCE_WINDOWS=ON -DUSE_SYSTEM_UUID=OFF 
-DDISABLE_LIBARCHIVE=%disable_libarchive% -DDISABLE_SCRIPTING=ON 
-DEXCLUDE_BOOST=ON -DENABLE_WEL=TRUE -DFAIL_ON_WARNINGS=OFF -DSKIP_TESTS=%s 
[...]
+cmake -G %generator% -DINSTALLER_MERGE_MODULES=%installer_merge_modules% 
-DENABLE_SQL=%build_SQL% -DCMAKE_BUILD_TYPE_INIT=%cmake_build_type% 
-DCMAKE_BUILD_TYPE=%cmake_build_type% -DWIN32=WIN32 
-DENABLE_LIBRDKAFKA=%build_kafka% -DENABLE_JNI=%build_jni% -DOPENSSL_OFF=OFF 
-DENABLE_COAP=%build_coap% -DUSE_SHARED_LIBS=OFF -DDISABLE_CONTROLLER=ON  
-DBUILD_ROCKSDB=ON -DFORCE_WINDOWS=ON -DUSE_SYSTEM_UUID=OFF 
-DDISABLE_LIBARCHIVE=%disable_libarchive% -DDISABLE_SCRIPTING=ON 
-DEXCLUDE_BOOST=ON -DEN [...]
 IF %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL%
 if [%cpack%] EQU [ON] ( 
        cpack

Reply via email to