Skip to content

Commit

Permalink
Added option to create .deb packages, adapted wpg patch to new wpg so…
Browse files Browse the repository at this point in the history
…urces
  • Loading branch information
Sergey Yakubov committed Mar 30, 2016
1 parent 9e12385 commit 94de63b
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 32 deletions.
43 changes: 20 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,17 @@ option (DEVELOPER_INSTALL "Install modules only, do not install SimEx files" OFF
CMAKE_DEPENDENT_OPTION(INSTALL_TESTS "Install test files" ON
"NOT DEVELOPER_INSTALL" OFF)


#if (DEVELOPER_INSTALL)
# set (CMAKE_INSTALL_PREFIX "${SIMEX_SOURCE_DIR}" CACHE PATH "install path" FORCE )
#endif()

# set install paths
set (PREFIX_DIR ${CMAKE_INSTALL_PREFIX})

set (LIBDIR ${PREFIX_DIR}/lib)
set (INCLUDEDIR ${PREFIX_DIR}/include)
set (BINDIR ${PREFIX_DIR}/bin)
set (PYPATH ${LIBDIR}/python)
set (TESTSDIR ${PREFIX_DIR}/Tests)
set (LIBDIR lib)
set (INCLUDEDIR include)
set (BINDIR bin)
set (PYPATH ${LIBDIR}/python2.7)

option (PACKAGE_MAKE "Use this option to create linux packages" OFF)
if (PACKAGE_MAKE)
set (TESTSDIR share/simex/Tests)
else()
set (TESTSDIR Tests)
endif()

if (DEVELOPER_INSTALL)
set (FRAMEWORK_DIR ${SIMEX_SOURCE_DIR}/Sources)
Expand All @@ -43,19 +41,13 @@ if (DEVELOPER_INSTALL)
else()
set (UTILITIES_DIR ${PYPATH}/SimEx/Utilities/)
set (CALCULATORS_DIR ${PYPATH}/SimEx/Calculators/)
endif()



if (DEVELOPER_INSTALL)
message ("Skip Simex source tree")
else()
if (INSTALL_TESTS)
if (INSTALL_TESTS)
add_subdirectory (Tests)
endif()
add_subdirectory (Sources)
endif()
add_subdirectory (Sources)
endif()


# find and add modules
set (SIMEX_MODULES_ROOT "${SIMEX_SOURCE_DIR}/Modules")
include (find_modules)
Expand Down Expand Up @@ -84,3 +76,8 @@ install(FILES ${CMAKE_BINARY_DIR}/simex_vars.sh
DESTINATION ${BINDIR})


if (PACKAGE_MAKE)
add_subdirectory (Packages)
endif()


2 changes: 2 additions & 0 deletions Modules/Propagators/XFELPhotonPropagator/prop/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ add_custom_command (
)
add_custom_target(GeneratePyInit ALL DEPENDS ${pyfile})

add_dependencies(GeneratePyInit prop)

install( DIRECTORY ${SOURCE_DIR} DESTINATION ${PYPATH}
)


Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
1165c1165
< self._wf._srwl_wf.arEx = array.array('f')
---
> self._wf._srwl_wf.arEx = array.array(str(u'f'))
1220c1220
< self._wf._srwl_wf.arEy = array.array('f')
---
Expand Down
52 changes: 52 additions & 0 deletions Packages/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

# create debian package

SET(CPACK_BINARY_DEB ON)
SET (CPACK_DEBIAN_PACKAGE_MAINTAINER "Sergey Yakubov ([email protected])")
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")

SET(CPACK_PACKAGE_NAME "simex")
SET(CPACK_PACKAGE_VENDOR "XEFL")
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
SET(CPACK_PACKAGE_VERSION_MINOR "1")
SET(CPACK_PACKAGE_VERSION_PATCH "0")

SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "SimEx Debian package")

#(>= 2.3.1-6), libgcc1 (>= 1:3.4.2-12)")
SET (PACKAGE_DEPENDS
#"libarmadillo4"
"libarmadillo-dev"
#"wget"
"python2.7"
"python-numpy"
"python-scipy"
"python-h5py"
"python-setuptools"
"python-matplotlib"
#"build-essential"
"libbz2-dev"
"libgsl0-dev"
"libfftw3-dev"
"liblapack-dev"
"libhdf5-dev"
"libopenmpi-dev"
"ssh"
"libboost1.55-all-dev"
#"unzip"
#"cython"
)

STRING(REGEX REPLACE ";" "," PACKAGE_DEPENDS "${PACKAGE_DEPENDS}")

SET(CPACK_DEBIAN_PACKAGE_DEPENDS ${PACKAGE_DEPENDS})


SET(CPACK_BINARY_STGZ OFF)
SET(CPACK_BINARY_TBZ2 OFF)
SET(CPACK_BINARY_TGZ OFF)
SET(CPACK_BINARY_TZ OFF)


INCLUDE(CPack)

17 changes: 16 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,28 @@ will install all executables and libraries under the prefix directory given thro
$> sudo make install

NOTE TO DEVELOPERS:
For simex_platform developers, it is recommended to install the platform
a) For simex_platform developers, it is recommended to install the platform
directly into the source tree, e.g. give the top level directory to the DCMAKE_INSTALL_PREFIX directive, e.g.
$> cmake -DCMAKE_INSTALL_PREFIX=.. ..
supposing the build directory is located in the top level source directory.

In this way, you will be able to run the unittests without having to recompile.

b) There is an option to create debian package which can then be installed along with all necessary dependencies via

$>dpkg -i <package_name>
$>apt-get install -f

on another computer with Debian based OS. In this case Simex will be installed in /usr/... , Tests are installed in /usr/share/simex/.... and should be system-wide available. Calling dpkg with --instdir option allows to change installation dir. In this case simex_vars.sh should be modified manually to set paths correctly.

To create the package call

$> cmake -DPACKAGE_MAKE=ON -DCMAKE_INSTALL_PREFIX=/usr <PATH TO SOURCE>
$> make package

(probably you will have to call cmake two times because for some unknown reason CMake creates .tgz archives in the first time).



3.)
Getting started
Expand Down
4 changes: 2 additions & 2 deletions simex_vars.sh.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh

export PATH=${BINDIR}:$PATH
export PYTHONPATH=${PYPATH}:$PYTHONPATH
export PATH=${CMAKE_INSTALL_PREFIX}/${BINDIR}:$PATH
export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${PYPATH}:$PYTHONPATH
4 changes: 2 additions & 2 deletions simex_vars_dev.sh.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh

export PATH=${BINDIR}:$PATH
export PYTHONPATH=${FRAMEWORK_DIR}/python:${PYPATH}:$PYTHONPATH
export PATH=${CMAKE_INSTALL_PREFIX}/${BINDIR}:$PATH
export PYTHONPATH=${FRAMEWORK_DIR}/python:${CMAKE_INSTALL_PREFIX}/${PYPATH}:$PYTHONPATH

0 comments on commit 94de63b

Please sign in to comment.