Skip to content

Commit

Permalink
Packaging mods. Refs #327
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.nexusformat.org/code/trunk@1836 ff5d1e40-2be0-497f-93bd-dc18237bd3c7
  • Loading branch information
FreddieAkeroyd authored and Freddie Akeroyd committed Aug 15, 2012
1 parent 9901751 commit 7a7f168
Show file tree
Hide file tree
Showing 17 changed files with 260 additions and 327 deletions.
65 changes: 43 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# CMakeLists for building the NeXus library and applications.
#
# Copyright (C) 2010 Stephen Rankin
# Copyright (C) 2008-2012 NeXus International Advisory Committee (NIAC)
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
Expand All @@ -26,23 +26,44 @@
#
#====================================================================

# The name of our project is "NeXus". CMakeLists files in this project can
# refer to the root source directory of the project as ${NeXus_SOURCE_DIR} and
# to the root binary directory of the project as ${NeXus_BINARY_DIR}.
# we need 2.8.8 for correct component install with CPACK for archives
if(WIN32)
cmake_minimum_required (VERSION 2.8.7)
cmake_minimum_required (VERSION 2.8.8)
else()
cmake_minimum_required (VERSION 2.8.3)
set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove this line when CMake >= 2.8.4 is required
cmake_minimum_required (VERSION 2.8.8)
if (${CMAKE_VERSION} VERSION_LESS 2.8.4)
set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove this line when CMake >= 2.8.4 is required
endif()
endif()

if(WIN32)
set(CMAKE_INSTALL_PREFIX "c:/nxinstall" CACHE PATH "")
endif()

#
# convert a native windows path to its equivalent cygwin path
#
function(to_cygwin_path PATH RESULT)
file(TO_CMAKE_PATH ${PATH} CP) # changes \ to / on windows
string(REGEX REPLACE "^([a-zA-Z]):/" "/\\1/" CP2 ${CP}) # c:/ -> /c/
set(${RESULT} "/cygdrive${CP2}" PARENT_SCOPE) # /c/ -> /cygdrive/c/
endfunction()

#The name of our project
project (NeXus)

set (NeXus_VERSION_MAJOR 1)
set (NeXus_VERSION_MINOR 0)
set (NXLTVERSINFO '4:3:4')

# needed for windows NSIS installer
file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} CMAKE_SOURCE_DIR_NATIVE)
file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} CMAKE_BINARY_DIR_NATIVE)
string(REPLACE "\\" "\\\\" CMAKE_SOURCE_DIR_NATIVE_D ${CMAKE_SOURCE_DIR_NATIVE})
string(REPLACE "\\" "\\\\" CMAKE_BINARY_DIR_NATIVE_D ${CMAKE_BINARY_DIR_NATIVE})

find_program(SVNVERSION svnversion)

#Packages to find that are required for the build

set(HDF5_SEARCH "" CACHE PATH "Where to search for HDF5")
Expand Down Expand Up @@ -70,7 +91,7 @@ include(InstallRequiredSystemLibraries)
endif()

include(cmake_include/Utilities.cmake)
include(cmake_include/FindPython.cmake)
#include(cmake_include/FindPython.cmake)
include(cmake_include/FindCBFLib.cmake)
#include(cmake_include/FindJava.cmake)
#include(cmake_include/FindJNI.cmake)
Expand Down Expand Up @@ -129,6 +150,7 @@ find_package(Doxygen)
find_package(SWIG)
find_package(TCL)
find_package(LATEX)
find_package(PythonInterp)

#Find the java runtime and sdk
find_package(Java 1.6)
Expand Down Expand Up @@ -252,16 +274,15 @@ set(NX_INCLUDE "include/nexus")
configure_file("${CMAKE_SOURCE_DIR}/include/nxconfig_h_cmake.in" "${CMAKE_BINARY_DIR}/include/nxconfig.h" @ONLY)
include_directories("${CMAKE_BINARY_DIR}/include")

if(WIN32)
if(MSVC)
# warning 4820 is byte padding in structures
# warning 4996 is about using _strdup ratherthan strdup etc
# /W4 rather than /Wall
# /Zi to get pdb file in all configurations
set(NX_CFLAGS "/W4 /wd4820 /wd4996 /Zi")
set(NX_CPP -D_CRT_SECURE_NO_WARNINGS)
set(CMAKE_DEBUG_POSTFIX "D")

endif(WIN32)
endif(MSVC)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NX_CFLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${NX_CFLAGS}")
Expand Down Expand Up @@ -297,17 +318,17 @@ add_subdirectory (test)
configure_file("${PROJECT_SOURCE_DIR}/CPackOptions.cmake.in" "${PROJECT_BINARY_DIR}/CPackOptions.cmake" @ONLY)
set(CPACK_PROJECT_CONFIG_FILE "${PROJECT_BINARY_DIR}/CPackOptions.cmake")
set (CPACK_GENERATOR TGZ) # not use ZIP on UNIX as problem with symlinks
if(UNIX)
set (CPACK_GENERATOR ${CPACK_GENERATOR};DEB;RPM)
#set (CPACK_RPM_PACKAGE_PROVIDES "")
endif(UNIX)
set (CPACK_SOURCE_GENERATOR TGZ) # not use ZIP on UNIX as problem with symlinks
if(WIN32)
set (CPACK_GENERATOR ${CPACK_GENERATOR};ZIP;NSIS)
endif(WIN32)
if(APPLE)
set (CPACK_GENERATOR ${CPACK_GENERATOR};NSIS)
set (CPACK_SOURCE_GENERATOR ${CPACK_SOURCE_GENERATOR};ZIP)
elseif(APPLE)
set (CPACK_GENERATOR ${CPACK_GENERATOR};PackageMaker)
endif(APPLE)
if(CYGWIN)
endif(CYGWIN)
# include of CPack must be last
elseif(CYGWIN)
set (CPACK_GENERATOR ${CPACK_GENERATOR};CygwinBinary)
set (CPACK_SOURCE_GENERATOR ${CPACK_SOURCE_GENERATOR};CygwinSource)
elseif(UNIX)
set (CPACK_GENERATOR ${CPACK_GENERATOR};DEB;RPM)
endif()
# Include of CPack must always be last
include(CPack)
188 changes: 154 additions & 34 deletions CPackOptions.cmake.in
Original file line number Diff line number Diff line change
@@ -1,69 +1,151 @@
#
# processed with configure_file @ONLY so may need @VAR@ rather than ${VAR} in some circumstances
# $Id: CPackOptions.cmake.in 1079 2012-05-05 22:17:36Z Freddie Akeroyd $
#
#====================================================================
# NeXus - A common data format for neutron, x-ray and muon science.
#
# CPackOptions.cmake.in for building the NeXus library and applications.
#
# Copyright (C) 2008-2012 NeXus International Advisory Committee (NIAC)
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
# For further information, see <http://www.nexusformat.org>
#
#
#====================================================================
#

include(CPackComponent)

#set(CPACK_ALL_INSTALL_TYPES Full)
#set(CPACK_COMPONENTS_ALL manual definitions) # default is all components mentioned

if (NOT WIN32)
set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove this line when CMake >= 2.8.4 is required
if (${CMAKE_VERSION} VERSION_LESS 2.8.4)
set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove this line when CMake >= 2.8.4 is required
endif()
endif()

set (CPACK_PACKAGE_NAME "NeXus")
set (CPACK_PACKAGE_VENDOR "NeXus International Advisory Committee")
set (CPACK_PACKAGE_VERSION_MAJOR "4")
set (CPACK_PACKAGE_VERSION_MINOR "3")
set (CPACK_PACKAGE_VERSION_PATCH "0")
set (CPACK_PACKAGE_CONTACT "nexus-tech@nexusformat.org")
#set (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/cmake_include/nexus_description.txt")
set (CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
set (CPACK_PACKAGE_CONTACT "NeXus Developers <nexus-tech@nexusformat.org>")
set (CPACK_PACKAGE_DESCRIPTION_FILE "@CMAKE_SOURCE_DIR@/cmake_include/nexus_description.txt")
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "NeXus - a common format for neutron and X-ray scattering data http://www.nexusformat.org/")
set (CPACK_PACKAGE_FILE_NAME "nexus-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}-${CPACK_PACKAGE_VERSION_PATCH}")
set (CPACK_SOURCE_PACKAGE_FILE_NAME "nexus-source-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
set (CPACK_PACKAGE_INSTALL_DIRECTORY "NeXus Data Format")

set (CPACK_RESOURCE_FILE_LICENSE "@CMAKE_SOURCE_DIR@/COPYING")
set (CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/cmake_include/nexus_description.txt")
set (CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/cmake_include/WELCOME")
#set (CPACK_MONOLITHIC_INSTALL)
set (CPACK_RESOURCE_FILE_LICENSE "@CMAKE_SOURCE_DIR@/InstallerBits/Licences/COPYING.txt")
set (CPACK_RESOURCE_FILE_README "@CMAKE_SOURCE_DIR@/cmake_include/nexus_description.txt")
set (CPACK_RESOURCE_FILE_WELCOME "@CMAKE_SOURCE_DIR@/cmake_include/WELCOME.txt")
set (CPACK_PACKAGE_ICON "@CMAKE_SOURCE_DIR@/InstallerBits/nexus.ico")

# we do not have any absolute paths, so do not need DESTDIR
SET(CPACK_SET_DESTDIR "OFF")
SET(CPACK_PACKAGE_RELOCATABLE "true")

# HKLM\Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@
set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "nexus")
#set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "nexus")

set(CPACK_BINARY_ZIP OFF)
set(CPACK_SOURCE_IGNORE_FILES
"nexus_spec.in;~$;/.svn/;/.cvsignore/;/CMakeFiles/;/nbproject/;autogen.sh;cmake_install.cmake;Makefile;${CPACK_SOURCE_IGNORE_FILES}")


# we do not set any absolute paths
SET(CPACK_SET_DESTDIR "OFF")

if(WIN32)
set(CPACK_BINARY_NSIS OFF)
set(CPACK_NSIS_PACKAGE_NAME "nexus ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}-${CPACK_PACKAGE_VERSION_PATCH}")
# set(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp")
if (${CPACK_GENERATOR} STREQUAL "DEB")
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_INSTALL_PREFIX "/usr")
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
set(CPACK_PACKAGE_NAME "nexus") # used for components
# set(CPACK_DEBIAN_PACKAGE_DEBUG TRUE)
set (CPACK_DEBIAN_PACKAGE_NAME "nexus")
set (CPACK_DEBIAN_PACKAGE_ARCHITECTURE "all")
set (CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
set (CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://www.nexusformat.org/")
endif()
if (${CPACK_GENERATOR} STREQUAL "RPM")
set(CPACK_INSTALL_PREFIX "/usr")
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
# set(CPACK_RPM_PACKAGE_PREFIX "/usr")
# set(CPACK_RPM_PACKAGE_DEBUG TRUE)
set (CPACK_RPM_PACKAGE_NAME "nexus")
# set (CPACK_RPM_PACKAGE_ARCHITECTURE "noarch")
set (CPACK_RPM_PACKAGE_RELEASE "1")
# set (CPACK_RPM_PACKAGE_REQUIRES "python >= 2.5.0, cmake >= 2.8.8")
set (CPACK_RPM_PACKAGE_REQUIRES "python >= 2.5.0")
# set (CPACK_RPM_PACKAGE_PROVIDES "")
set(CPACK_RPM_COMPONENT_INSTALL ON)
set(CPACK_RPM_PACKAGE_LICENSE "@CMAKE_SOURCE_DIR@/InstallerBits/Licences/COPYING.txt")
set(CPACK_RPM_PACKAGE_URL "http://www.nexusformat.org/")
# set(CPACK_RPM_CHANGELOG_FILE "")
endif()
if (${CPACK_GENERATOR} STREQUAL "TGZ")
set(CPACK_TGZ_COMPONENT_INSTALL ON)
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY ON)
set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY ON)
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
endif()
if (${CPACK_GENERATOR} STREQUAL "ZIP")
set(CPACK_ZIP_COMPONENT_INSTALL ON)
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY ON)
set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY ON)
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
endif()
if (${CPACK_GENERATOR} STREQUAL "CygwinBinary")
set(CPACK_CYGWIN_PATCH_NUMBER 1)
endif()
if (${CPACK_GENERATOR} STREQUAL "PackageMaker")
# set(CPACK_MONOLITHIC_INSTALL ON)
# 10.4 is "Tiger", component based install needs 10.4 and above
set(CPACK_OSX_PACKAGE_VERSION 10.4)
endif()
if (${CPACK_GENERATOR} STREQUAL "Bundle")
endif()
if (${CPACK_GENERATOR} STREQUAL "NSIS")
### NSIS component installs seem to trigger download option at the moment, so set monolithic install and a full package name until we can figure out why
set(CPACK_MONOLITHIC_INSTALL ON)
set(CPACK_PACKAGE_FILE_NAME "nexus-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_NSIS_PACKAGE_NAME "NeXus ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} NeXus")
set(CPACK_NSIS_HELP_LINK "http://www.nexusformat.org/")
set(CPACK_NSIS_URL_INFO_ABOUT "http://www.nexusformat.org/")
set(CPACK_NSIS_CONTACT "${CPACK_PACKAGE_CONTACT}")
set(CPACK_NSIS_MODIFY_PATH ON)
# set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "!include \"@CMAKE_SOURCE_DIR@/nsis_install.nsh\"")
# set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "!include \"@CMAKE_SOURCE_DIR@/nsis_uninstall.nsh\"")
# set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\MyExecutable.exe")
set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} NeXus")
set(CPACK_NSIS_HELP_LINK "http://www.nexusformat.org/")
set(CPACK_NSIS_URL_INFO_ABOUT "http://www.nexusformat.org/")
set(CPACK_NSIS_CONTACT "nexus-tech@nexusformat.org")
set(CPACK_NSIS_MODIFY_PATH ON)
# CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Name of the registry key for the installer
# set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "!include \"${CMAKE_SOURCE_DIR}/nsis_install.nsh\"")
# set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "!include \"${CMAKE_SOURCE_DIR}/nsis_uninstall.nsh\"")
endif(WIN32)
set(CPACK_PACKAGE_ICON "@CMAKE_SOURCE_DIR_NATIVE_D@\\InstallerBits\\nexus.ico")
set(CPACK_NSIS_MUI_ICON "@CMAKE_SOURCE_DIR_NATIVE_D@\\InstallerBits\\nexus.ico")
set(CPACK_NSIS_MUI_UNIICON "@CMAKE_SOURCE_DIR_NATIVE_D@\\InstallerBits\\nexus.ico")
set(CPACK_NSIS_MENU_LINKS "http://www.nexusformat.org/" "NeXus Web Site")
endif()

#set (CPACK_OUTPUT_CONFIG_FILE)
#set (CPACK_PACKAGE_EXECUTABLES)
#set (CPACK_STRIP_FILES)
set (CPACK_SOURCE_PACKAGE_FILE_NAME "nexus-source-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}-${CPACK_PACKAGE_VERSION_PATCH}")
#set (CPACK_SOURCE_STRIP_FILES)
#set (CPACK_SOURCE_GENERATOR)
#set (CPACK_SOURCE_OUTPUT_CONFIG_FILE)
#set (CPACK_SOURCE_IGNORE_FILES)
set(CPACK_RPM_COMPONENT_INSTALL ON)
set (CPACK_RPM_PACKAGE_RELEASE "1")
set (CPACK_RPM_PACKAGE_REQUIRES "python >= 2.5.0, cmake >= 2.8")

set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})

set(CPACK_CREATE_DESKTOP_LINKS "nxbrowse" "nxvalidate")
set(CPACK_PACKAGE_EXECUTABLES "nxbrowse" "NXbrowse" "nxvalidate" "NXvalidate")
set(CPACK_NSIS_MENU_LINKS "doc/a.html" "some file" "http://www.nexusformat.org/" "nexus web")

#cpack_add_component(Runtime
# DISPLAY_NAME "Binary Applications"
Expand All @@ -84,3 +166,41 @@ set(CPACK_NSIS_MENU_LINKS "doc/a.html" "some file" "http://www.nexusformat.org/"
# DISPLAY_NAME "Examples"
# DESCRIPTION "Code example files."
# )

#cpack_add_component(definitions
# DISPLAY_NAME "NeXus NXDL definitions"
# DESCRIPTION "Binary applications such as nxconvert, nxbrowse etc..."
# INSTALL_TYPES Full
# GROUP definitions_group
# )

#cpack_add_component(manual
# DISPLAY_NAME "NeXus Documentation"
# DESCRIPTION "NeXus User Guide and Reference Documentation with examples."
# INSTALL_TYPES Full
# GROUP manual_group
# )

#cpack_add_install_type(Full DISPLAY_NAME "Full")

#cpack_add_component_group(definitions_group
# DISPLAY_NAME definitions
# DESCRIPTION definitions
# EXPANDED
# BOLD_TITLE)

#cpack_add_component_group(manual_group
# DISPLAY_NAME manual
# DESCRIPTION manual
# EXPANDED
# BOLD_TITLE)

#cpack_add_component(Development
# DISPLAY_NAME "Development"
# DESCRIPTION "Development libraries and headers."
# )

#cpack_add_component(Examples
# DISPLAY_NAME "Examples"
# DESCRIPTION "Code example files."
# )
Binary file added InstallerBits/nexus.ico
Binary file not shown.
File renamed without changes.
Loading

0 comments on commit 7a7f168

Please sign in to comment.