Skip to content
Snippets Groups Projects
Commit ad458bd6 authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

Merge branch 'packsource' into develop

parents 19a7569d d1baac0a
No related branches found
No related tags found
No related merge requests found
......@@ -7,17 +7,21 @@ cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(BornAgain)
# --- General project settings ---
if(NOT BORNAGAIN_PYTHON)
set(BORNAGAIN_PYTHON ON)
endif()
option(BORNAGAIN_PYTHON "Build with python support" ON)
option(BORNAGAIN_APP "Build test application" ON)
option(BORNAGAIN_GUI "Build a graphical user interface" OFF)
if(NOT BORNAGAIN_APP)
set(BORNAGAIN_APP ON)
endif()
#if(NOT BORNAGAIN_PYTHON)
# set(BORNAGAIN_PYTHON ON)
#endif()
if(NOT BORNAGAIN_GUI)
set(BORNAGAIN_GUI OFF)
endif()
#if(NOT BORNAGAIN_APP)
# set(BORNAGAIN_APP ON)
#endif()
#if(NOT BORNAGAIN_GUI)
# set(BORNAGAIN_GUI OFF)
#endif()
#--- Path for additional cmake modules ---
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
......
# file to build installer
option(BUILD_DEBIAN "Build a debian package" ON)
include(InstallRequiredSystemLibraries)
......@@ -10,7 +11,7 @@ set(BORNAGAIN_PATCH_VERSION "0")
set(BORNAGAIN_VERSION "${BORNAGAIN_MAJOR_VERSION}.${BORNAGAIN_MINOR_VERSION}.${BORNAGAIN_PATCH_VERSION}")
set(CPACK_PACKAGE_NAME "BornAgain")
set(CPACK_PACKAGE_DESCRIPTION "BornAgain: simulate and fit scattering at grazing incidence")
set(CPACK_PACKAGE_DESCRIPTION "BornAgain: simulate and fit scattering at grazing incidence.")
set(CPACK_PACKAGE_VENDOR "Sceintific Computing at MLZ")
set(CPACK_PACKAGE_VERSION ${BORNAGAIN_VERSION})
set(CPACK_PACKAGE_VERSION_MAJOR ${BORNAGAIN_MAJOR_VERSION})
......@@ -38,7 +39,10 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME}-${BORNAGAIN_VERSION}"
if(WIN32)
set(CPACK_GENERATOR "NSIS")
elseif(APPLE)
set(CPACK_GENERATOR "PackageMaker;TGZ")
#set(CPACK_GENERATOR "PackageMaker;TGZ")
set(CPACK_GENERATOR "STGZ;TGZ")
elseif(UNIX AND BUILD_DEBIAN) # one can build debian package only on UNIX system
set(CPACK_GENERATOR "DEB")
else()
set(CPACK_GENERATOR "STGZ;TGZ")
endif()
......@@ -48,6 +52,110 @@ endif()
set(CPACK_NSIS_MODIFY_PATH ON)
# Generating the source package
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
# Specify which files do not include into the source package generated by make package_source
set(CPACK_SOURCE_IGNORE_FILES
${CPACK_SOURCE_IGNORE_FILES} # first take the default parameters
"/Doc/UserManual/"
"/dev-tools/edit-scripts/"
"/dev-tools/packaging/"
"/dev-tools/tmp-examples/"
"/dev-tools/tmp-unsorted/"
"/GUI/"
"/XCode_BornAgain.xcodeproj/"
"~$"
"/.git/"
"/\\\\.git/"
"/\\\\\\\\.git/" # more screeneng symbols is neccesary because of double file processing by cmake and cpack
"\\\\\\\\.swp$"
"\\\\.swp$"
"/.metadata/"
"/.settings/"
"\\\\.cproject"
"\\\\.project"
"\\\\.lssrc"
"\\\\.DS_Store"
"\\\\.obj"
)
# parameters to build a debian package
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Marina Ganeva <m.ganeva@fz-juelich.de>")
# Architecture: (mandatory)
IF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
# There is no such thing as i686 architecture on debian, you should use i386 instead
# $ dpkg --print-architecture
FIND_PROGRAM(DPKG_CMD dpkg)
IF(NOT DPKG_CMD)
MESSAGE(STATUS "Can not find dpkg in your path, default to i386.")
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
ENDIF(NOT DPKG_CMD)
EXECUTE_PROCESS(COMMAND "${DPKG_CMD}" --print-architecture
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
ENDIF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
if(${CPACK_DEBIAN_PACKAGE_ARCHITECTURE} MATCHES "i686")
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
endif()
set(CPACK_DEBIAN_PACKAGE_NAME "${CPACK_PACKAGE_NAME}")
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
set(CPACK_STRIP_FILES "TRUE")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libgsl, libboost, libfftw3, libpython") # [TODO:] set versions
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}")
set(CPACK_DEBIAN_PACKAGE_VERSION 1)
set(CPACK_PACKAGE_FILE_NAME "${CPACK_DEBIAN_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}-${CPACK_DEBIAN_PACKAGE_VERSION}_${CMAKE_SYSTEM_PROCESSOR}")
# write copyrite file [TODO:] fix the text of copyright
file(WRITE "${CMAKE_BINARY_DIR}/copyright"
"Copyright (C) 2013 Sceintific Computing at MLZ
This software is licensed under the terms of the
GNU General Public License Version 3.
Software distributed under the License is distributed
on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
express or implied. See the GPL for the specific language
governing rights and limitations.
You should have received a copy of the GPL along with this
program. If not, go to http://www.gnu.org/licenses/gpl.html
or write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
On Debian systems, the complete text of the GNU General Public
License can be found in `/usr/share/common-licenses/GPL-3'.")
install(FILES "${CMAKE_BINARY_DIR}/copyright"
DESTINATION "share/doc/${CPACK_DEBIAN_PACKAGE_NAME}")
# write changelog file
FIND_PROGRAM(GIT_EXECUTABLE git)
FIND_PROGRAM(GIT2CL_EXECUTABLE git2cl)
IF(GIT_EXECUTABLE AND GIT2CL_EXECUTABLE)
set(GIT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/.git")
execute_process(COMMAND ${GIT_EXECUTABLE} --git-dir=${GIT_DIR} log
COMMAND ${GIT2CL_EXECUTABLE}
COMMAND gzip -9
OUTPUT_FILE "${CMAKE_BINARY_DIR}/changelog.gz")
install(FILES "${CMAKE_BINARY_DIR}/changelog.gz"
DESTINATION "share/doc/${CPACK_DEBIAN_PACKAGE_NAME}")
else()
MESSAGE(STATUS "W: git or git2cl not found. Can't create the debian changelog file.")
ENDIF(GIT_EXECUTABLE AND GIT2CL_EXECUTABLE)
# check if such commands are exist
include(CPack)
set(CPACK_COMPONENTS_ALL Libraries Headers Examples)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment