]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Mon, 9 Oct 2017 04:09:09 +0000 (23:09 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Mon, 9 Oct 2017 04:09:09 +0000 (23:09 -0500)
appli/bash/CreateWin32Installer.cxx
config/CTArteries.nsi [new file with mode: 0644]
config/EnvVarUpdate.nsh [new file with mode: 0644]
config/install_ivq.sh
config/install_mxe.sh [new file with mode: 0755]
config/ivq.nsi [new file with mode: 0644]
config/mxe.patch [new file with mode: 0644]
config/vtk.patch [new file with mode: 0644]

index 57874c9f7e9e2f8d857f116d088c1f23f08bb0a6..4f6ac375cdf3dc57d719a8921aa7028ea1f8869e 100644 (file)
@@ -48,15 +48,11 @@ int main( int argc, char* argv[] )
 {
   if( argc < 3 )
   {
-    std::cerr
-      << "Usage: " << argv[ 0 ]
-      << " entry_point objdump_tool [other_dir(s)]"
-      << std::endl;
+    std::cerr << "Usage: " << argv[ 0 ] << " dump_tool libs" << std::endl;
       return( 1 );
 
   } // fi
-  std::string entry_point, objdump_tool;
-  std::set< std::string > dirs;
+  std::string dump_tool;
 
   if( !Exists( argv[ 1 ] ) )
   {
@@ -66,29 +62,24 @@ int main( int argc, char* argv[] )
     return( 1 );
 
   } // fi
-  if( !Exists( argv[ 2 ] ) )
-  {
-    std::cerr
-      << "Error: file \"" << argv[ 2 ] << "\" does not exist."
-      << std::endl;
-    return( 1 );
-
-  } // fi
+  dump_tool = realpath( argv[ 1 ], NULL );
 
-  entry_point = realpath( argv[ 1 ], NULL );
-  objdump_tool = realpath( argv[ 2 ], NULL );
+  std::set< std::string > files, dirs;
+  std::queue< std::string > q;
+  for( int i = 2; i < argc; ++i )
+  {
+    if( Exists( argv[ i ] ) )
+    {
+      std::string fname = realpath( argv[ i ], NULL );
+      std::string fname_dir, fname_file;
+      Split( fname, fname_dir, fname_file );
+      q.push( fname );
+      dirs.insert( fname_dir );
 
-  std::string entry_point_dir, entry_point_file;
-  Split( entry_point, entry_point_dir, entry_point_file );
+    } // fi
 
-  dirs.insert( entry_point_dir );
-  for( int i = 3; i < argc; ++i )
-    if( Exists( argv[ i ] ) )
-      dirs.insert( std::string( realpath( argv[ i ], NULL ) ) );
+  } // rof
 
-  std::set< std::string > files;
-  std::queue< std::string > q;
-  q.push( entry_point );
   while( !q.empty( ) )
   {
     std::string e = q.front( );
@@ -100,7 +91,7 @@ int main( int argc, char* argv[] )
         if( Exists( e ) )
         {
           std::istringstream ss(
-            Exec( objdump_tool + " -x " + e + " | grep DLL\\ Name" )
+            Exec( dump_tool + " -x " + e + " | grep DLL\\ Name" )
             );
           files.insert( e );
           std::string line;
diff --git a/config/CTArteries.nsi b/config/CTArteries.nsi
new file mode 100644 (file)
index 0000000..d1dbe14
--- /dev/null
@@ -0,0 +1,17 @@
+OutFile "install_CTArteries.exe"
+InstallDir "$PROGRAMFILES\CTArteries"
+
+Section
+SetOutPath "$INSTDIR"
+File "CTArteries\*"
+WriteUninstaller $INSTDIR\uninstaller.exe
+SectionEnd
+
+Section "Uninstall"
+
+Delete $INSTDIR\uninstaller.exe
+RMDir /r $INSTDIR
+SectionEnd
+
+## eof
diff --git a/config/EnvVarUpdate.nsh b/config/EnvVarUpdate.nsh
new file mode 100644 (file)
index 0000000..f435531
--- /dev/null
@@ -0,0 +1,327 @@
+/**
+ *  EnvVarUpdate.nsh
+ *    : Environmental Variables: append, prepend, and remove entries
+ *
+ *     WARNING: If you use StrFunc.nsh header then include it before this file
+ *              with all required definitions. This is to avoid conflicts
+ *
+ *  Usage:
+ *    ${EnvVarUpdate} "ResultVar" "EnvVarName" "Action" "RegLoc" "PathString"
+ *
+ *  Credits:
+ *  Version 1.0 
+ *  * Cal Turney (turnec2)
+ *  * Amir Szekely (KiCHiK) and e-circ for developing the forerunners of this
+ *    function: AddToPath, un.RemoveFromPath, AddToEnvVar, un.RemoveFromEnvVar,
+ *    WriteEnvStr, and un.DeleteEnvStr
+ *  * Diego Pedroso (deguix) for StrTok
+ *  * Kevin English (kenglish_hi) for StrContains
+ *  * Hendri Adriaens (Smile2Me), Diego Pedroso (deguix), and Dan Fuhry  
+ *    (dandaman32) for StrReplace
+ *
+ *  Version 1.1 (compatibility with StrFunc.nsh)
+ *  * techtonik
+ *
+ *  http://nsis.sourceforge.net/Environmental_Variables:_append%2C_prepend%2C_and_remove_entries
+ *
+ */
+!ifndef ENVVARUPDATE_FUNCTION
+!define ENVVARUPDATE_FUNCTION
+!verbose push
+!verbose 3
+!include "LogicLib.nsh"
+!include "WinMessages.NSH"
+!include "StrFunc.nsh"
+; ---- Fix for conflict if StrFunc.nsh is already includes in main file -----------------------
+!macro _IncludeStrFunction StrFuncName
+  !ifndef ${StrFuncName}_INCLUDED
+    ${${StrFuncName}}
+  !endif
+  !ifndef Un${StrFuncName}_INCLUDED
+    ${Un${StrFuncName}}
+  !endif
+  !define un.${StrFuncName} "${Un${StrFuncName}}"
+!macroend
+!insertmacro _IncludeStrFunction StrTok
+!insertmacro _IncludeStrFunction StrStr
+!insertmacro _IncludeStrFunction StrRep
+; ---------------------------------- Macro Definitions ----------------------------------------
+!macro _EnvVarUpdateConstructor ResultVar EnvVarName Action Regloc PathString
+  Push "${EnvVarName}"
+  Push "${Action}"
+  Push "${RegLoc}"
+  Push "${PathString}"
+    Call EnvVarUpdate
+  Pop "${ResultVar}"
+!macroend
+!define EnvVarUpdate '!insertmacro "_EnvVarUpdateConstructor"'
+!macro _unEnvVarUpdateConstructor ResultVar EnvVarName Action Regloc PathString
+  Push "${EnvVarName}"
+  Push "${Action}"
+  Push "${RegLoc}"
+  Push "${PathString}"
+    Call un.EnvVarUpdate
+  Pop "${ResultVar}"
+!macroend
+!define un.EnvVarUpdate '!insertmacro "_unEnvVarUpdateConstructor"'
+; ---------------------------------- Macro Definitions end-------------------------------------
+;----------------------------------- EnvVarUpdate start----------------------------------------
+!define hklm_all_users     'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
+!define hkcu_current_user  'HKCU "Environment"'
+!macro EnvVarUpdate UN
+Function ${UN}EnvVarUpdate
+  Push $0
+  Exch 4
+  Exch $1
+  Exch 3
+  Exch $2
+  Exch 2
+  Exch $3
+  Exch
+  Exch $4
+  Push $5
+  Push $6
+  Push $7
+  Push $8
+  Push $9
+  Push $R0
+  /* After this point:
+  -------------------------
+     $0 = ResultVar     (returned)
+     $1 = EnvVarName    (input)
+     $2 = Action        (input)
+     $3 = RegLoc        (input)
+     $4 = PathString    (input)
+     $5 = Orig EnvVar   (read from registry)
+     $6 = Len of $0     (temp)
+     $7 = tempstr1      (temp)
+     $8 = Entry counter (temp)
+     $9 = tempstr2      (temp)
+     $R0 = tempChar     (temp)  */
+  ; Step 1:  Read contents of EnvVarName from RegLoc
+  ;
+  ; Check for empty EnvVarName
+  ${If} $1 == ""
+    SetErrors
+    DetailPrint "ERROR: EnvVarName is blank"
+    Goto EnvVarUpdate_Restore_Vars
+  ${EndIf}
+  ; Check for valid Action
+  ${If}    $2 != "A"
+  ${AndIf} $2 != "P"
+  ${AndIf} $2 != "R"
+    SetErrors
+    DetailPrint "ERROR: Invalid Action - must be A, P, or R"
+    Goto EnvVarUpdate_Restore_Vars
+  ${EndIf}
+  ${If} $3 == HKLM
+    ReadRegStr $5 ${hklm_all_users} $1     ; Get EnvVarName from all users into $5
+  ${ElseIf} $3 == HKCU
+    ReadRegStr $5 ${hkcu_current_user} $1  ; Read EnvVarName from current user into $5
+  ${Else}
+    SetErrors
+    DetailPrint 'ERROR: Action is [$3] but must be "HKLM" or HKCU"'
+    Goto EnvVarUpdate_Restore_Vars
+  ${EndIf}
+  ; Check for empty PathString
+  ${If} $4 == ""
+    SetErrors
+    DetailPrint "ERROR: PathString is blank"
+    Goto EnvVarUpdate_Restore_Vars
+  ${EndIf}
+  ; Make sure we've got some work to do
+  ${If} $5 == ""
+  ${AndIf} $2 == "R"
+    SetErrors
+    DetailPrint "$1 is empty - Nothing to remove"
+    Goto EnvVarUpdate_Restore_Vars
+  ${EndIf}
+  ; Step 2: Scrub EnvVar
+  ;
+  StrCpy $0 $5                             ; Copy the contents to $0
+  ; Remove spaces around semicolons (NOTE: spaces before the 1st entry or
+  ; after the last one are not removed here but instead in Step 3)
+  ${If} $0 != ""                           ; If EnvVar is not empty ...
+    ${Do}
+      ${${UN}StrStr} $7 $0 " ;"
+      ${If} $7 == ""
+        ${ExitDo}
+      ${EndIf}
+      ${${UN}StrRep} $0  $0 " ;" ";"         ; Remove '<space>;'
+    ${Loop}
+    ${Do}
+      ${${UN}StrStr} $7 $0 "; "
+      ${If} $7 == ""
+        ${ExitDo}
+      ${EndIf}
+      ${${UN}StrRep} $0  $0 "; " ";"         ; Remove ';<space>'
+    ${Loop}
+    ${Do}
+      ${${UN}StrStr} $7 $0 ";;" 
+      ${If} $7 == ""
+        ${ExitDo}
+      ${EndIf}
+      ${${UN}StrRep} $0  $0 ";;" ";"
+    ${Loop}
+    ; Remove a leading or trailing semicolon from EnvVar
+    StrCpy  $7  $0 1 0
+    ${If} $7 == ";"
+      StrCpy $0  $0 "" 1                   ; Change ';<EnvVar>' to '<EnvVar>'
+    ${EndIf}
+    StrLen $6 $0
+    IntOp $6 $6 - 1
+    StrCpy $7  $0 1 $6
+    ${If} $7 == ";"
+     StrCpy $0  $0 $6                      ; Change ';<EnvVar>' to '<EnvVar>'
+    ${EndIf}
+    ; DetailPrint "Scrubbed $1: [$0]"      ; Uncomment to debug
+  ${EndIf}
+  /* Step 3. Remove all instances of the target path/string (even if "A" or "P")
+     $6 = bool flag (1 = found and removed PathString)
+     $7 = a string (e.g. path) delimited by semicolon(s)
+     $8 = entry counter starting at 0
+     $9 = copy of $0
+     $R0 = tempChar      */
+  ${If} $5 != ""                           ; If EnvVar is not empty ...
+    StrCpy $9 $0
+    StrCpy $0 ""
+    StrCpy $8 0
+    StrCpy $6 0
+    ${Do}
+      ${${UN}StrTok} $7 $9 ";" $8 "0"      ; $7 = next entry, $8 = entry counter
+      ${If} $7 == ""                       ; If we've run out of entries,
+        ${ExitDo}                          ;    were done
+      ${EndIf}                             ;
+      ; Remove leading and trailing spaces from this entry (critical step for Action=Remove)
+      ${Do}
+        StrCpy $R0  $7 1
+        ${If} $R0 != " "
+          ${ExitDo}
+        ${EndIf}
+        StrCpy $7   $7 "" 1                ;  Remove leading space
+      ${Loop}
+      ${Do}
+        StrCpy $R0  $7 1 -1
+        ${If} $R0 != " "
+          ${ExitDo}
+        ${EndIf}
+        StrCpy $7   $7 -1                  ;  Remove trailing space
+      ${Loop}
+      ${If} $7 == $4                       ; If string matches, remove it by not appending it
+        StrCpy $6 1                        ; Set 'found' flag
+      ${ElseIf} $7 != $4                   ; If string does NOT match
+      ${AndIf}  $0 == ""                   ;    and the 1st string being added to $0,
+        StrCpy $0 $7                       ;    copy it to $0 without a prepended semicolon
+      ${ElseIf} $7 != $4                   ; If string does NOT match
+      ${AndIf}  $0 != ""                   ;    and this is NOT the 1st string to be added to $0,
+        StrCpy $0 $0;$7                    ;    append path to $0 with a prepended semicolon
+      ${EndIf}                             ;
+      IntOp $8 $8 + 1                      ; Bump counter
+    ${Loop}                                ; Check for duplicates until we run out of paths
+  ${EndIf}
+  ; Step 4:  Perform the requested Action
+  ;
+  ${If} $2 != "R"                          ; If Append or Prepend
+    ${If} $6 == 1                          ; And if we found the target
+      DetailPrint "Target is already present in $1. It will be removed and"
+    ${EndIf}
+    ${If} $0 == ""                         ; If EnvVar is (now) empty
+      StrCpy $0 $4                         ;   just copy PathString to EnvVar
+      ${If} $6 == 0                        ; If found flag is either 0
+      ${OrIf} $6 == ""                     ; or blank (if EnvVarName is empty)
+        DetailPrint "$1 was empty and has been updated with the target"
+      ${EndIf}
+    ${ElseIf} $2 == "A"                    ;  If Append (and EnvVar is not empty),
+      StrCpy $0 $0;$4                      ;     append PathString
+      ${If} $6 == 1
+        DetailPrint "appended to $1"
+      ${Else}
+        DetailPrint "Target was appended to $1"
+      ${EndIf}
+    ${Else}                                ;  If Prepend (and EnvVar is not empty),
+      StrCpy $0 $4;$0                      ;     prepend PathString
+      ${If} $6 == 1
+        DetailPrint "prepended to $1"
+      ${Else}
+        DetailPrint "Target was prepended to $1"
+      ${EndIf}
+    ${EndIf}
+  ${Else}                                  ; If Action = Remove
+    ${If} $6 == 1                          ;   and we found the target
+      DetailPrint "Target was found and removed from $1"
+    ${Else}
+      DetailPrint "Target was NOT found in $1 (nothing to remove)"
+    ${EndIf}
+    ${If} $0 == ""
+      DetailPrint "$1 is now empty"
+    ${EndIf}
+  ${EndIf}
+  ; Step 5:  Update the registry at RegLoc with the updated EnvVar and announce the change
+  ;
+  ClearErrors
+  ${If} $3  == HKLM
+    WriteRegExpandStr ${hklm_all_users} $1 $0     ; Write it in all users section
+  ${ElseIf} $3 == HKCU
+    WriteRegExpandStr ${hkcu_current_user} $1 $0  ; Write it to current user section
+  ${EndIf}
+  IfErrors 0 +4
+    MessageBox MB_OK|MB_ICONEXCLAMATION "Could not write updated $1 to $3"
+    DetailPrint "Could not write updated $1 to $3"
+    Goto EnvVarUpdate_Restore_Vars
+  ; "Export" our change
+  SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+  EnvVarUpdate_Restore_Vars:
+  ;
+  ; Restore the user's variables and return ResultVar
+  Pop $R0
+  Pop $9
+  Pop $8
+  Pop $7
+  Pop $6
+  Pop $5
+  Pop $4
+  Pop $3
+  Pop $2
+  Pop $1
+  Push $0  ; Push my $0 (ResultVar)
+  Exch
+  Pop $0   ; Restore his $0
+FunctionEnd
+!macroend   ; EnvVarUpdate UN
+!insertmacro EnvVarUpdate ""
+!insertmacro EnvVarUpdate "un."
+;----------------------------------- EnvVarUpdate end----------------------------------------
+!verbose pop
+!endif
index 8d1422b7d13ee238d4ae87d5f0549a0b0ef49af2..e177331cbcfc9d656195f8987d9d35f3a4653a38 100755 (executable)
@@ -50,7 +50,7 @@ if \
     [ -z "$cmake" ] || \
     [ -z "$vtk" ] || \
     [ -z "$itk" ] ; then
-    (>&2 echo "Usage: $0 -prefix [dir] -qt [dir] -cmake [dir] -vtk [dir] -itk [dir] [-build_dir [dir]] [-cores [n]]")
+    (>&2 echo "Usage: $0 -prefix [dir] -qt [dir] -cmake [dir] -vtk [dir] -itk [dir] [-build_dir [dir]] [-suffix [string]] [-cores [n]]")
     exit 1
 fi
 
diff --git a/config/install_mxe.sh b/config/install_mxe.sh
new file mode 100755 (executable)
index 0000000..e43c7dd
--- /dev/null
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+## -- Command line options
+while [[ "$#" -gt 1 ]]; do
+    key="$1"
+    case $key in
+        -prefix)
+        prefix="$2"
+        shift
+        ;;
+        -suffix)
+        suffix="$2"
+        shift
+        ;;
+        -cores)
+        cores="$2"
+        shift
+        ;;
+        *)
+        # Do nothing
+        ;;
+    esac
+    shift
+done
+
+## -- Check command line options
+if [ -z "$prefix" ] ; then
+    (>&2 echo "Usage: $0 -prefix [dir] [-suffix [string]] [-cores [n]]")
+    exit 1
+fi
+
+## -- Complete optional parameters
+if [ -z "$cores" ] ; then
+    cores="1"
+fi
+if [ ! -z "$suffix" ] ; then
+    qt_suffix="-qtlibinfix $suffix"
+fi
+curr_dir=`pwd`
+
+## -- Get mxe
+cd $prefix
+git clone https://github.com/mxe/mxe.git
+
+## -- Create settings.mk
+cd $prefix/mxe
+echo "MXE_TARGETS := x86_64-w64-mingw32.shared" > settings.mk
+
+## -- Compile all
+make -j$cores -k qtbase vtk itk nsis
+
+## -- End
+cd $curr_dir
+
+## eof - $RCSfile$
diff --git a/config/ivq.nsi b/config/ivq.nsi
new file mode 100644 (file)
index 0000000..368daef
--- /dev/null
@@ -0,0 +1,57 @@
+OutFile "install_ivq.exe"
+InstallDir "$PROGRAMFILES\ivq"
+
+Section
+SetOutPath "$INSTDIR\bin"
+File "ivq\bin\*.dll"
+SetOutPath "$INSTDIR\plugins\bearer"
+File "ivq\plugins\bearer\*.dll"
+SetOutPath "$INSTDIR\plugins\designer"
+File "ivq\plugins\designer\*.dll"
+SetOutPath "$INSTDIR\plugins\generic"
+File "ivq\plugins\generic\*.dll"
+SetOutPath "$INSTDIR\plugins\iconengines"
+File "ivq\plugins\iconengines\*.dll"
+SetOutPath "$INSTDIR\plugins\imageformats"
+File "ivq\plugins\imageformats\*.dll"
+SetOutPath "$INSTDIR\plugins\platforms"
+File "ivq\plugins\platforms\*.dll"
+SetOutPath "$INSTDIR\plugins\printsupport"
+File "ivq\plugins\printsupport\*.dll"
+SetOutPath "$INSTDIR\plugins\qmltooling"
+File "ivq\plugins\qmltooling\*.dll"
+SetOutPath "$INSTDIR\plugins\sqldrivers"
+File "ivq\plugins\sqldrivers\*.dll"
+WriteUninstaller $INSTDIR\uninstaller.exe
+SectionEnd
+
+Section "Uninstall"
+
+Delete $INSTDIR\uninstaller.exe
+RMDir /r $INSTDIR
+SectionEnd
+
+!include EnvVarUpdate.nsh
+Section
+${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\bin"
+${EnvVarUpdate} $0 "QT_QPA_PLATFORM_PLUGIN_PATH" "A" "HKLM" "$INSTDIR\plugins\platforms"
+SectionEnd
+
+#QT_QPA_PLATFORM_PLUGIN_PATH
+#!include WriteEnvStr.nsh
+#Section "Add Env Var"
+#  !ifdef ALL_USERS
+#    !define ReadEnvStr_RegKey \
+#       'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
+#  !else
+#    !define ReadEnvStr_RegKey 'HKCU "Environment"'
+#  !endif
+#ReadEnvStr $R0 "PATH"
+#StrCpy $R0 "$R0;$INSTDIR\bin"
+#System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("PATH", R0).r2'
+#SectionEnd
+
+## eof
diff --git a/config/mxe.patch b/config/mxe.patch
new file mode 100644 (file)
index 0000000..1a354af
--- /dev/null
@@ -0,0 +1,117 @@
+diff --git a/src/itk.mk b/src/itk.mk
+index a8194fa9..ae5df898 100644
+--- a/src/itk.mk
++++ b/src/itk.mk
+@@ -31,6 +31,10 @@ define $(PKG)_BUILD
+         -DITK_USE_SYSTEM_PNG=TRUE \
+         -DITK_USE_SYSTEM_TIFF=TRUE \
+         -DITK_USE_SYSTEM_ZLIB=TRUE \
++        -DModule_ITKReview=TRUE \
++        -DModule_ITKVtkGlue=TRUE \
++        -DCMAKE_DEBUG_POSTFIX=_cpPlugins \
++        -DCMAKE_RELEASE_POSTFIX=_cpPlugins \
+         '$(1)'
+     $(MAKE) -C '$(1).build' -j '$(JOBS)' install VERBOSE=1
+ endef
+diff --git a/src/qtbase.mk b/src/qtbase.mk
+index c02650c4..c46867a6 100644
+--- a/src/qtbase.mk
++++ b/src/qtbase.mk
+@@ -64,51 +64,22 @@ define $(PKG)_BUILD
+             -dbus-linked \
+             -no-pch \
+             -v \
+-            $($(PKG)_CONFIGURE_OPTS)
++            $($(PKG)_CONFIGURE_OPTS) \
++            -qtlibinfix _cpPlugins
+     $(MAKE) -C '$(1)' -j '$(JOBS)'
+     rm -rf '$(PREFIX)/$(TARGET)/qt5'
+     $(MAKE) -C '$(1)' -j 1 install
+     ln -sf '$(PREFIX)/$(TARGET)/qt5/bin/qmake' '$(PREFIX)/bin/$(TARGET)'-qmake-qt5
+-    mkdir            '$(1)/test-qt'
+-    cd               '$(1)/test-qt' && '$(PREFIX)/$(TARGET)/qt5/bin/qmake' '$(PWD)/src/qt-test.pro'
+-    $(MAKE)       -C '$(1)/test-qt' -j '$(JOBS)' $(BUILD_TYPE)
+-    $(INSTALL) -m755 '$(1)/test-qt/$(BUILD_TYPE)/test-qt5.exe' '$(PREFIX)/$(TARGET)/bin/'
+-
+-    # build test the manual way
+-    mkdir '$(1)/test-$(PKG)-pkgconfig'
+-    '$(PREFIX)/$(TARGET)/qt5/bin/uic' -o '$(1)/test-$(PKG)-pkgconfig/ui_qt-test.h' '$(TOP_DIR)/src/qt-test.ui'
+-    '$(PREFIX)/$(TARGET)/qt5/bin/moc' \
+-        -o '$(1)/test-$(PKG)-pkgconfig/moc_qt-test.cpp' \
+-        -I'$(1)/test-$(PKG)-pkgconfig' \
+-        '$(TOP_DIR)/src/qt-test.hpp'
+-    '$(PREFIX)/$(TARGET)/qt5/bin/rcc' -name qt-test -o '$(1)/test-$(PKG)-pkgconfig/qrc_qt-test.cpp' '$(TOP_DIR)/src/qt-test.qrc'
+-    '$(TARGET)-g++' \
+-        -W -Wall -Werror -std=c++0x -pedantic \
+-        '$(TOP_DIR)/src/qt-test.cpp' \
+-        '$(1)/test-$(PKG)-pkgconfig/moc_qt-test.cpp' \
+-        '$(1)/test-$(PKG)-pkgconfig/qrc_qt-test.cpp' \
+-        -o '$(PREFIX)/$(TARGET)/bin/test-$(PKG)-pkgconfig.exe' \
+-        -I'$(1)/test-$(PKG)-pkgconfig' \
+-        `'$(TARGET)-pkg-config' Qt5Widgets$(BUILD_TYPE_SUFFIX) --cflags --libs`
+-
+     # setup cmake toolchain
+     echo 'set(CMAKE_SYSTEM_PREFIX_PATH "$(PREFIX)/$(TARGET)/qt5" ${CMAKE_SYSTEM_PREFIX_PATH})' > '$(CMAKE_TOOLCHAIN_DIR)/$(PKG).cmake'
+-    # batch file to run test programs
+-    (printf 'set PATH=..\\lib;..\\qt5\\bin;..\\qt5\\lib;%%PATH%%\r\n'; \
+-     printf 'set QT_QPA_PLATFORM_PLUGIN_PATH=..\\qt5\\plugins\r\n'; \
+-     printf 'test-qt5.exe\r\n'; \
+-     printf 'test-qtbase-pkgconfig.exe\r\n';) \
+-     > '$(PREFIX)/$(TARGET)/bin/test-qt5.bat'
+-
+     # add libs to CMake config of Qt5Core to fix static linking
+     $(SED) -i 's,set(_Qt5Core_LIB_DEPENDENCIES \"\"),set(_Qt5Core_LIB_DEPENDENCIES \"ole32;uuid;ws2_32;advapi32;shell32;user32;kernel32;mpr;version;winmm;z;pcre2-16\"),g' '$(PREFIX)/$(TARGET)/qt5/lib/cmake/Qt5Core/Qt5CoreConfig.cmake'
+     $(SED) -i 's,set(_Qt5Gui_LIB_DEPENDENCIES \"Qt5::Core\"),set(_Qt5Gui_LIB_DEPENDENCIES \"Qt5::Core;ole32;uuid;ws2_32;advapi32;shell32;user32;kernel32;mpr;version;winmm;z;pcre2-16;png16;harfbuzz;z\"),g' '$(PREFIX)/$(TARGET)/qt5/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake'
+     $(SED) -i 's,set(_Qt5Widgets_LIB_DEPENDENCIES \"Qt5::Gui;Qt5::Core\"),set(_Qt5Widgets_LIB_DEPENDENCIES \"Qt5::Gui;Qt5::Core;gdi32;comdlg32;oleaut32;imm32;opengl32;png16;harfbuzz;ole32;uuid;ws2_32;advapi32;shell32;user32;kernel32;mpr;version;winmm;z;pcre2-16;shell32;uxtheme;dwmapi\"),g' '$(PREFIX)/$(TARGET)/qt5/lib/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake'
+ endef
+-
+ $(PKG)_BUILD_SHARED = $(subst -static ,-shared ,\
+                       $($(PKG)_BUILD))
+diff --git a/src/vtk-1-fixes.patch b/src/vtk-1-fixes.patch
+index 1e13226f..23957a3f 100644
+--- a/src/vtk-1-fixes.patch
++++ b/src/vtk-1-fixes.patch
+@@ -68,3 +68,23 @@ Subject: [PATCH] fix libharu shared linking
+  endif()
+  # Maintain backward compatibility with user setting COMPILE_TOOLS_IMPORTED
+  if(DEFINED COMPILE_TOOLS_IMPORTED AND NOT DEFINED VTK_COMPILE_TOOLS_IMPORTED)
++
++--- a/GUISupport/Qt/PluginInstall.cmake.in    2017-08-30 15:55:05.000000000 -0500
+++++ b/GUISupport/Qt/PluginInstall.cmake.in    2017-10-06 18:20:24.746721343 -0500
++@@ -3,12 +3,10 @@
++ set(VTK_INSTALL_QT_DIR "@VTK_INSTALL_QT_DIR@")
++ set(VTK_INSTALL_QT_PLUGIN_DIR "@VTK_INSTALL_QT_PLUGIN_DIR@")
++ set(BUILDTYPE_SUFFIX)
++-if (WIN32)
++-  if (BUILD_TYPE STREQUAL "Debug")
++-    set(BUILDTYPE_SUFFIX @CMAKE_DEBUG_POSTFIX@)
++-  else ()
++-    set(BUILDTYPE_SUFFIX @CMAKE_RELEASE_POSTFIX@)
++-  endif ()
+++if (BUILD_TYPE STREQUAL "Debug")
+++  set(BUILDTYPE_SUFFIX @CMAKE_DEBUG_POSTFIX@)
+++else ()
+++  set(BUILDTYPE_SUFFIX @CMAKE_RELEASE_POSTFIX@)
++ endif ()
++ set(VTK_INSTALL_QT_PLUGIN_FILE "@CMAKE_SHARED_LIBRARY_PREFIX@QVTKWidgetPlugin${BUILDTYPE_SUFFIX}@CMAKE_SHARED_LIBRARY_SUFFIX@")
++ set(VTK_CONFIGURATIONS "@CMAKE_CONFIGURATION_TYPES@")
+diff --git a/src/vtk.mk b/src/vtk.mk
+index 47d5419c..d7d397ad 100644
+--- a/src/vtk.mk
++++ b/src/vtk.mk
+@@ -49,7 +49,10 @@ define $(PKG)_BUILD
+         -DVTK_FORBID_DOWNLOADS=ON \
+         -DVTK_USE_SYSTEM_LIBHARU=ON \
+         -DBUILD_EXAMPLES=OFF \
+-        -DBUILD_TESTING=OFF
++        -DBUILD_TESTING=OFF \
++        -DCMAKE_DEBUG_POSTFIX=_cpPlugins \
++        -DCMAKE_RELEASE_POSTFIX=_cpPlugins
++
+     $(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)' VERBOSE=1
+     $(MAKE) -C '$(BUILD_DIR)' -j 1 install VERBOSE=1
diff --git a/config/vtk.patch b/config/vtk.patch
new file mode 100644 (file)
index 0000000..1e12e7b
--- /dev/null
@@ -0,0 +1,20 @@
+diff -ruN VTK-8.0.1/GUISupport/Qt/PluginInstall.cmake.in VTK-8.0.1-patched/GUISupport/Qt/PluginInstall.cmake.in
+--- VTK-8.0.1/GUISupport/Qt/PluginInstall.cmake.in     2017-08-30 15:55:05.000000000 -0500
++++ VTK-8.0.1-patched/GUISupport/Qt/PluginInstall.cmake.in     2017-10-06 18:20:24.746721343 -0500
+@@ -3,12 +3,10 @@
+ set(VTK_INSTALL_QT_DIR "@VTK_INSTALL_QT_DIR@")
+ set(VTK_INSTALL_QT_PLUGIN_DIR "@VTK_INSTALL_QT_PLUGIN_DIR@")
+ set(BUILDTYPE_SUFFIX)
+-if (WIN32)
+-  if (BUILD_TYPE STREQUAL "Debug")
+-    set(BUILDTYPE_SUFFIX @CMAKE_DEBUG_POSTFIX@)
+-  else ()
+-    set(BUILDTYPE_SUFFIX @CMAKE_RELEASE_POSTFIX@)
+-  endif ()
++if (BUILD_TYPE STREQUAL "Debug")
++  set(BUILDTYPE_SUFFIX @CMAKE_DEBUG_POSTFIX@)
++else ()
++  set(BUILDTYPE_SUFFIX @CMAKE_RELEASE_POSTFIX@)
+ endif ()
+ set(VTK_INSTALL_QT_PLUGIN_FILE "@CMAKE_SHARED_LIBRARY_PREFIX@QVTKWidgetPlugin${BUILDTYPE_SUFFIX}@CMAKE_SHARED_LIBRARY_SUFFIX@")
+ set(VTK_CONFIGURATIONS "@CMAKE_CONFIGURATION_TYPES@")