Integrate installer build into CMake build system

This commit is contained in:
DRC
2010-10-16 08:51:43 +00:00
parent edc8253164
commit 5b8f6495d1
3 changed files with 160 additions and 126 deletions

View File

@@ -234,3 +234,37 @@ add_test(jpegtran-static-prog jpegtran-static -outfile testoutt.jpg testoutp.jpg
add_test(jpegtran-static-prog-cmp cmp ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutt.jpg) add_test(jpegtran-static-prog-cmp cmp ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutt.jpg)
add_test(jpegtran-static-crop jpegtran-static -crop 120x90+20+50 -transpose -perfect -outfile testoutcrop.jpg ${CMAKE_SOURCE_DIR}/testorig.jpg) add_test(jpegtran-static-crop jpegtran-static -crop 120x90+20+50 -transpose -perfect -outfile testoutcrop.jpg ${CMAKE_SOURCE_DIR}/testorig.jpg)
add_test(jpegtran-static-crop-cmp cmp ${CMAKE_SOURCE_DIR}/testimgcrop.jpg testoutcrop.jpg) add_test(jpegtran-static-crop-cmp cmp ${CMAKE_SOURCE_DIR}/testimgcrop.jpg testoutcrop.jpg)
#
# Installer
#
set(INST_NAME ${CMAKE_PROJECT_NAME})
if(MSVC)
set(INST_PLATFORM "Visual C++")
elseif(MINGW)
set(INST_PLATFORM GCC)
set(INST_NAME ${INST_NAME}-gcc)
set(INST_DEFS -DGCC)
endif()
if(64BIT)
set(INST_PLATFORM "${INST_PLATFORM} 64-bit")
set(INST_NAME ${INST_NAME}64)
set(INST_DEFS ${INST_DEFS} -DWIN64)
endif()
if(MSVC_IDE)
set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=$(OutDir)\\")
else()
set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=")
endif()
configure_file(release/libjpeg-turbo.nsi.in libjpeg-turbo.nsi @ONLY)
add_custom_target(installer
makensis -nocd ${INST_DEFS} libjpeg-turbo.nsi
DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static
SOURCES libjpeg-turbo.nsi)

View File

@@ -1,126 +0,0 @@
!include x64.nsh
Name "libjpeg-turbo SDK for ${PLATFORM}"
OutFile ${WBLDDIR}\${APPNAME}.exe
InstallDir c:\${APPNAME}
SetCompressor bzip2
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
Section "libjpeg-turbo SDK for ${PLATFORM} (required)"
!ifdef WIN64
${If} ${RunningX64}
${DisableX64FSRedirection}
${Endif}
!endif
SectionIn RO
!ifdef GCC
IfFileExists $SYSDIR/libturbojpeg.dll exists 0
!else
IfFileExists $SYSDIR/turbojpeg.dll exists 0
!endif
goto notexists
exists:
!ifdef GCC
MessageBox MB_OK "An existing version of the libjpeg-turbo SDK for ${PLATFORM} is already installed. Please uninstall it first."
!else
MessageBox MB_OK "An existing version of the libjpeg-turbo SDK for ${PLATFORM} or the TurboJPEG SDK is already installed. Please uninstall it first."
!endif
quit
notexists:
SetOutPath $SYSDIR
!ifdef GCC
File "${WLIBDIR}\libturbojpeg.dll"
!else
File "${WLIBDIR}\turbojpeg.dll"
!endif
SetOutPath $INSTDIR\bin
!ifdef GCC
File "/oname=libjpeg-62.dll" "${WLIBDIR}\libjpeg-*.dll"
!else
File "${WLIBDIR}\jpeg62.dll"
!endif
SetOutPath $INSTDIR\lib
!ifdef GCC
File "${WLIBDIR}\libturbojpeg.dll.a"
File "${WLIBDIR}\libturbojpeg.a"
File "${WLIBDIR}\libjpeg.dll.a"
File "${WLIBDIR}\libjpeg.a"
!else
File "${WLIBDIR}\turbojpeg.lib"
File "${WLIBDIR}\turbojpeg-static.lib"
File "${WLIBDIR}\jpeg.lib"
File "${WLIBDIR}\jpeg-static.lib"
!endif
SetOutPath $INSTDIR\include
File "${WHDRDIR}\jconfig.h"
File "${WSRCDIR}\jerror.h"
File "${WSRCDIR}\jmorecfg.h"
File "${WSRCDIR}\jpeglib.h"
File "${WSRCDIR}\turbojpeg.h"
SetOutPath $INSTDIR
File "${WSRCDIR}\README"
File "${WSRCDIR}\README-turbo.txt"
File "${WSRCDIR}\libjpeg.txt"
File "${WSRCDIR}\LGPL.txt"
File "${WSRCDIR}\LICENSE.txt"
WriteRegStr HKLM "SOFTWARE\${APPNAME} ${VERSION}" "Install_Dir" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME} ${VERSION}" "DisplayName" "libjpeg-turbo SDK v${VERSION} for ${PLATFORM}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME} ${VERSION}" "UninstallString" '"$INSTDIR\uninstall_${VERSION}.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME} ${VERSION}" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME} ${VERSION}" "NoRepair" 1
WriteUninstaller "uninstall_${VERSION}.exe"
SectionEnd
Section "Uninstall"
!ifdef WIN64
${If} ${RunningX64}
${DisableX64FSRedirection}
${Endif}
!endif
SetShellVarContext all
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME} ${VERSION}"
DeleteRegKey HKLM "SOFTWARE\${APPNAME} ${VERSION}"
!ifdef GCC
Delete $INSTDIR\bin\libjpeg-62.dll
Delete $SYSDIR\libturbojpeg.dll
Delete $INSTDIR\lib\libturbojpeg.dll.a"
Delete $INSTDIR\lib\libturbojpeg.a"
Delete $INSTDIR\lib\libjpeg.dll.a"
Delete $INSTDIR\lib\libjpeg.a"
!else
Delete $INSTDIR\bin\jpeg62.dll
Delete $SYSDIR\turbojpeg.dll
Delete $INSTDIR\lib\jpeg.lib
Delete $INSTDIR\lib\jpeg-static.lib
Delete $INSTDIR\lib\turbojpeg.lib
Delete $INSTDIR\lib\turbojpeg-static.lib
!endif
Delete $INSTDIR\include\jconfig.h"
Delete $INSTDIR\include\jerror.h"
Delete $INSTDIR\include\jmorecfg.h"
Delete $INSTDIR\include\jpeglib.h"
Delete $INSTDIR\include\turbojpeg.h"
Delete $INSTDIR\uninstall_${VERSION}.exe
Delete $INSTDIR\README
Delete $INSTDIR\README-turbo.txt
Delete $INSTDIR\libjpeg.txt
Delete $INSTDIR\LGPL.txt
Delete $INSTDIR\LICENSE.txt
RMDir "$INSTDIR\include"
RMDir "$INSTDIR\lib"
RMDir "$INSTDIR\bin"
RMDir "$INSTDIR"
SectionEnd

126
release/libjpeg-turbo.nsi.in Executable file
View File

@@ -0,0 +1,126 @@
!include x64.nsh
Name "@CMAKE_PROJECT_NAME@ SDK for @INST_PLATFORM@"
OutFile @CMAKE_BINARY_DIR@\${BUILDDIR}@INST_NAME@.exe
InstallDir c:\@INST_NAME@
SetCompressor bzip2
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
Section "@CMAKE_PROJECT_NAME@ SDK for @INST_PLATFORM@ (required)"
!ifdef WIN64
${If} ${RunningX64}
${DisableX64FSRedirection}
${Endif}
!endif
SectionIn RO
!ifdef GCC
IfFileExists $SYSDIR/libturbojpeg.dll exists 0
!else
IfFileExists $SYSDIR/turbojpeg.dll exists 0
!endif
goto notexists
exists:
!ifdef GCC
MessageBox MB_OK "An existing version of the @CMAKE_PROJECT_NAME@ SDK for @INST_PLATFORM@ is already installed. Please uninstall it first."
!else
MessageBox MB_OK "An existing version of the @CMAKE_PROJECT_NAME@ SDK for @INST_PLATFORM@ or the TurboJPEG SDK is already installed. Please uninstall it first."
!endif
quit
notexists:
SetOutPath $SYSDIR
!ifdef GCC
File "@CMAKE_BINARY_DIR@\libturbojpeg.dll"
!else
File "@CMAKE_BINARY_DIR@\${BUILDDIR}turbojpeg.dll"
!endif
SetOutPath $INSTDIR\bin
!ifdef GCC
File "/oname=libjpeg-@DLL_VERSION@.dll" "@CMAKE_BINARY_DIR@\sharedlib\libjpeg-*.dll"
!else
File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}jpeg@DLL_VERSION@.dll"
!endif
SetOutPath $INSTDIR\lib
!ifdef GCC
File "@CMAKE_BINARY_DIR@\libturbojpeg.dll.a"
File "@CMAKE_BINARY_DIR@\libturbojpeg.a"
File "@CMAKE_BINARY_DIR@\sharedlib\libjpeg.dll.a"
File "@CMAKE_BINARY_DIR@\libjpeg.a"
!else
File "@CMAKE_BINARY_DIR@\${BUILDDIR}turbojpeg.lib"
File "@CMAKE_BINARY_DIR@\${BUILDDIR}turbojpeg-static.lib"
File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}jpeg.lib"
File "@CMAKE_BINARY_DIR@\${BUILDDIR}jpeg-static.lib"
!endif
SetOutPath $INSTDIR\include
File "@CMAKE_BINARY_DIR@\jconfig.h"
File "@CMAKE_SOURCE_DIR@\jerror.h"
File "@CMAKE_SOURCE_DIR@\jmorecfg.h"
File "@CMAKE_SOURCE_DIR@\jpeglib.h"
File "@CMAKE_SOURCE_DIR@\turbojpeg.h"
SetOutPath $INSTDIR
File "@CMAKE_SOURCE_DIR@\README"
File "@CMAKE_SOURCE_DIR@\README-turbo.txt"
File "@CMAKE_SOURCE_DIR@\libjpeg.txt"
File "@CMAKE_SOURCE_DIR@\LGPL.txt"
File "@CMAKE_SOURCE_DIR@\LICENSE.txt"
WriteRegStr HKLM "SOFTWARE\@INST_NAME@ @VERSION@" "Install_Dir" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_NAME@ @VERSION@" "DisplayName" "@CMAKE_PROJECT_NAME@ SDK v@VERSION@ for @INST_PLATFORM@"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_NAME@ @VERSION@" "UninstallString" '"$INSTDIR\uninstall_@VERSION@.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_NAME@ @VERSION@" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_NAME@ @VERSION@" "NoRepair" 1
WriteUninstaller "uninstall_@VERSION@.exe"
SectionEnd
Section "Uninstall"
!ifdef WIN64
${If} ${RunningX64}
${DisableX64FSRedirection}
${Endif}
!endif
SetShellVarContext all
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_NAME@ @VERSION@"
DeleteRegKey HKLM "SOFTWARE\@INST_NAME@ @VERSION@"
!ifdef GCC
Delete $INSTDIR\bin\libjpeg-@DLL_VERSION@.dll
Delete $SYSDIR\libturbojpeg.dll
Delete $INSTDIR\lib\libturbojpeg.dll.a"
Delete $INSTDIR\lib\libturbojpeg.a"
Delete $INSTDIR\lib\libjpeg.dll.a"
Delete $INSTDIR\lib\libjpeg.a"
!else
Delete $INSTDIR\bin\jpeg@DLL_VERSION@.dll
Delete $SYSDIR\turbojpeg.dll
Delete $INSTDIR\lib\jpeg.lib
Delete $INSTDIR\lib\jpeg-static.lib
Delete $INSTDIR\lib\turbojpeg.lib
Delete $INSTDIR\lib\turbojpeg-static.lib
!endif
Delete $INSTDIR\include\jconfig.h"
Delete $INSTDIR\include\jerror.h"
Delete $INSTDIR\include\jmorecfg.h"
Delete $INSTDIR\include\jpeglib.h"
Delete $INSTDIR\include\turbojpeg.h"
Delete $INSTDIR\uninstall_@VERSION@.exe
Delete $INSTDIR\README
Delete $INSTDIR\README-turbo.txt
Delete $INSTDIR\libjpeg.txt
Delete $INSTDIR\LGPL.txt
Delete $INSTDIR\LICENSE.txt
RMDir "$INSTDIR\include"
RMDir "$INSTDIR\lib"
RMDir "$INSTDIR\bin"
RMDir "$INSTDIR"
SectionEnd