From 0387afa8fc7bbe151056b76270eeab59fb2ae46c Mon Sep 17 00:00:00 2001
From: Marina Ganeva <m.ganeva@fz-juelich.de>
Date: Tue, 1 Oct 2013 13:30:11 +0200
Subject: [PATCH] 1. The variables to set the BornAgain version are all shifted
 to the main CMakeLists.txt. All options too. 2. Fixed dependencies for the
 debian package building. Fixed garbage production in the package/bin folder.

---
 CMakeLists.txt                      |  7 +++++++
 Core/CMakeLists.txt                 |  3 ++-
 cmake/modules/BornAgainCPack.cmake  | 18 ++++++++++--------
 cmake/modules/BornAgainMacros.cmake | 15 +++++----------
 4 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e1e42c27241..3643a2253e7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,11 +6,18 @@ cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
 
 project(BornAgain)
 
+# --- The version number. Please define it here only! ---
+set(BornAgain_VERSION_MAJOR 0)
+set(BornAgain_VERSION_MINOR 9)
+set(BornAgain_VERSION_PATCH 1)
+
 # --- General project settings ---
 option(BORNAGAIN_PYTHON "Build with python support" ON)
 option(BORNAGAIN_APP "Build test application" OFF)
 option(BORNAGAIN_GUI "Build a graphical user interface" OFF)
 option(BORNAGAIN_MAN "Build a user manual" OFF)
+option(BUILD_DEBIAN "Build a debian package" OFF)
+
 
 # --- Path for additional cmake modules ---
 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt
index 093d7dcb5d3..309a55cc89a 100644
--- a/Core/CMakeLists.txt
+++ b/Core/CMakeLists.txt
@@ -91,7 +91,8 @@ endif()
 # -----------------------------------------------
 install (DIRECTORY ${CMAKE_SOURCE_DIR}/Examples/ DESTINATION Examples COMPONENT Examples FILES_MATCHING PATTERN "*.py" )
 install (DIRECTORY ${CMAKE_SOURCE_DIR}/Examples/ DESTINATION Examples COMPONENT Examples FILES_MATCHING PATTERN "README")
-install (DIRECTORY ${CMAKE_SOURCE_DIR}/bin DESTINATION . COMPONENT Libraries)
+# the line below copies the contains ${CMAKE_SOURCE_DIR}/bin to the bin folder of the final package
+# install (DIRECTORY ${CMAKE_SOURCE_DIR}/bin DESTINATION . COMPONENT Libraries)
 
 if(WIN32)
     set(libdir "bin")
diff --git a/cmake/modules/BornAgainCPack.cmake b/cmake/modules/BornAgainCPack.cmake
index b4b9ea48e37..2cb018824ae 100644
--- a/cmake/modules/BornAgainCPack.cmake
+++ b/cmake/modules/BornAgainCPack.cmake
@@ -1,11 +1,11 @@
 # file to build installer
 
-option(BUILD_DEBIAN "Build a debian package" OFF)
+#option(BUILD_DEBIAN "Build a debian package" OFF)
 
 include(InstallRequiredSystemLibraries)
 
 # --- The BornAgain version is defined in ---
-# --- cmake/modules/ BornAgainMacros.cmake ---
+# --- the main file CMakeLists.txt ---
 #set(BORNAGAIN_MAJOR_VERSION "0")
 #set(BORNAGAIN_MINOR_VERSION "9")
 #set(BORNAGAIN_PATCH_VERSION "1")
@@ -104,21 +104,20 @@ IF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
     )
 ENDIF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
 
-if(${CPACK_DEBIAN_PACKAGE_ARCHITECTURE} MATCHES "i686")
-	SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
-endif()
+#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_DEPENDS "libgsl0-dev, libboost-dev(>=1.48), libfftw3-dev, libpython2.7, libc6(>= 2.7)") 
 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}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
 
-# write changelog file
 
 # write copyrite file [TODO:] fix the text of copyright
 file(WRITE "${CMAKE_BINARY_DIR}/copyright"
@@ -144,9 +143,13 @@ 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)
 
+# check if such commands are exist
+
     if(GIT_EXECUTABLE AND GIT2CL_EXECUTABLE)
 	set(GIT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/.git")
 	execute_process(COMMAND ${GIT_EXECUTABLE} --git-dir=${GIT_DIR} log 
@@ -161,7 +164,6 @@ install(FILES "${CMAKE_BINARY_DIR}/copyright"
 endif()
 
 
-# check if such commands are exist
 
 include(CPack)
 
diff --git a/cmake/modules/BornAgainMacros.cmake b/cmake/modules/BornAgainMacros.cmake
index 1c054f98fe9..08832abc567 100644
--- a/cmake/modules/BornAgainMacros.cmake
+++ b/cmake/modules/BornAgainMacros.cmake
@@ -1,21 +1,16 @@
 cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
 
-# --- The version number. Please define it here only! ---
-set(BornAgain_VERSION_MAJOR 0)
-set(BornAgain_VERSION_MINOR 9)
-set(BornAgain_VERSION_PATCH 1)
-
 # --- configure a header file to pass CMake settings to the source code
 configure_file(
   "${CMAKE_SOURCE_DIR}/Core/Samples/inc/BAVersion.h.in"
   "${CMAKE_SOURCE_DIR}/Core/Samples/inc/BAVersion.h"
 )
 
-# --- configure delpoyment script for release
-#configure_file(
-#  "${CMAKE_SOURCE_DIR}/bin/release.sh.in"
-#  "${CMAKE_BINARY_DIR}/bin/release.sh"
-#)
+# --- configure deployment script for release
+configure_file(
+  "${CMAKE_SOURCE_DIR}/bin/release.sh.in"
+  "${CMAKE_BINARY_DIR}/bin/release.sh"
+)
 
 # --- end of the version setting ---
 
-- 
GitLab