Skip to content

Commit 94de63b

Browse files
author
Sergey Yakubov
committed
Added option to create .deb packages, adapted wpg patch to new wpg sources
1 parent 9e12385 commit 94de63b

File tree

7 files changed

+94
-32
lines changed

7 files changed

+94
-32
lines changed

CMakeLists.txt

+20-23
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,17 @@ option (DEVELOPER_INSTALL "Install modules only, do not install SimEx files" OFF
2020
CMAKE_DEPENDENT_OPTION(INSTALL_TESTS "Install test files" ON
2121
"NOT DEVELOPER_INSTALL" OFF)
2222

23-
24-
#if (DEVELOPER_INSTALL)
25-
# set (CMAKE_INSTALL_PREFIX "${SIMEX_SOURCE_DIR}" CACHE PATH "install path" FORCE )
26-
#endif()
27-
28-
# set install paths
29-
set (PREFIX_DIR ${CMAKE_INSTALL_PREFIX})
30-
31-
set (LIBDIR ${PREFIX_DIR}/lib)
32-
set (INCLUDEDIR ${PREFIX_DIR}/include)
33-
set (BINDIR ${PREFIX_DIR}/bin)
34-
set (PYPATH ${LIBDIR}/python)
35-
set (TESTSDIR ${PREFIX_DIR}/Tests)
23+
set (LIBDIR lib)
24+
set (INCLUDEDIR include)
25+
set (BINDIR bin)
26+
set (PYPATH ${LIBDIR}/python2.7)
27+
28+
option (PACKAGE_MAKE "Use this option to create linux packages" OFF)
29+
if (PACKAGE_MAKE)
30+
set (TESTSDIR share/simex/Tests)
31+
else()
32+
set (TESTSDIR Tests)
33+
endif()
3634

3735
if (DEVELOPER_INSTALL)
3836
set (FRAMEWORK_DIR ${SIMEX_SOURCE_DIR}/Sources)
@@ -43,19 +41,13 @@ if (DEVELOPER_INSTALL)
4341
else()
4442
set (UTILITIES_DIR ${PYPATH}/SimEx/Utilities/)
4543
set (CALCULATORS_DIR ${PYPATH}/SimEx/Calculators/)
46-
endif()
47-
48-
49-
50-
if (DEVELOPER_INSTALL)
51-
message ("Skip Simex source tree")
52-
else()
53-
if (INSTALL_TESTS)
44+
if (INSTALL_TESTS)
5445
add_subdirectory (Tests)
55-
endif()
56-
add_subdirectory (Sources)
46+
endif()
47+
add_subdirectory (Sources)
5748
endif()
5849

50+
5951
# find and add modules
6052
set (SIMEX_MODULES_ROOT "${SIMEX_SOURCE_DIR}/Modules")
6153
include (find_modules)
@@ -84,3 +76,8 @@ install(FILES ${CMAKE_BINARY_DIR}/simex_vars.sh
8476
DESTINATION ${BINDIR})
8577

8678

79+
if (PACKAGE_MAKE)
80+
add_subdirectory (Packages)
81+
endif()
82+
83+

Modules/Propagators/XFELPhotonPropagator/prop/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ add_custom_command (
2222
)
2323
add_custom_target(GeneratePyInit ALL DEPENDS ${pyfile})
2424

25+
add_dependencies(GeneratePyInit prop)
2526

2627
install( DIRECTORY ${SOURCE_DIR} DESTINATION ${PYPATH}
2728
)
2829

30+

Modules/Propagators/XFELPhotonPropagator/wpg/glossary.py.patch

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
1165c1165
2-
< self._wf._srwl_wf.arEx = array.array('f')
3-
---
4-
> self._wf._srwl_wf.arEx = array.array(str(u'f'))
51
1220c1220
62
< self._wf._srwl_wf.arEy = array.array('f')
73
---

Packages/CMakeLists.txt

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
2+
# create debian package
3+
4+
SET(CPACK_BINARY_DEB ON)
5+
SET (CPACK_DEBIAN_PACKAGE_MAINTAINER "Sergey Yakubov ([email protected])")
6+
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
7+
8+
SET(CPACK_PACKAGE_NAME "simex")
9+
SET(CPACK_PACKAGE_VENDOR "XEFL")
10+
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
11+
SET(CPACK_PACKAGE_VERSION_MINOR "1")
12+
SET(CPACK_PACKAGE_VERSION_PATCH "0")
13+
14+
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "SimEx Debian package")
15+
16+
#(>= 2.3.1-6), libgcc1 (>= 1:3.4.2-12)")
17+
SET (PACKAGE_DEPENDS
18+
#"libarmadillo4"
19+
"libarmadillo-dev"
20+
#"wget"
21+
"python2.7"
22+
"python-numpy"
23+
"python-scipy"
24+
"python-h5py"
25+
"python-setuptools"
26+
"python-matplotlib"
27+
#"build-essential"
28+
"libbz2-dev"
29+
"libgsl0-dev"
30+
"libfftw3-dev"
31+
"liblapack-dev"
32+
"libhdf5-dev"
33+
"libopenmpi-dev"
34+
"ssh"
35+
"libboost1.55-all-dev"
36+
#"unzip"
37+
#"cython"
38+
)
39+
40+
STRING(REGEX REPLACE ";" "," PACKAGE_DEPENDS "${PACKAGE_DEPENDS}")
41+
42+
SET(CPACK_DEBIAN_PACKAGE_DEPENDS ${PACKAGE_DEPENDS})
43+
44+
45+
SET(CPACK_BINARY_STGZ OFF)
46+
SET(CPACK_BINARY_TBZ2 OFF)
47+
SET(CPACK_BINARY_TGZ OFF)
48+
SET(CPACK_BINARY_TZ OFF)
49+
50+
51+
INCLUDE(CPack)
52+

README

+16-1
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,28 @@ will install all executables and libraries under the prefix directory given thro
9191
$> sudo make install
9292

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

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

101+
b) There is an option to create debian package which can then be installed along with all necessary dependencies via
102+
103+
$>dpkg -i <package_name>
104+
$>apt-get install -f
105+
106+
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.
107+
108+
To create the package call
109+
110+
$> cmake -DPACKAGE_MAKE=ON -DCMAKE_INSTALL_PREFIX=/usr <PATH TO SOURCE>
111+
$> make package
112+
113+
(probably you will have to call cmake two times because for some unknown reason CMake creates .tgz archives in the first time).
114+
115+
101116

102117
3.)
103118
Getting started

simex_vars.sh.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22

3-
export PATH=${BINDIR}:$PATH
4-
export PYTHONPATH=${PYPATH}:$PYTHONPATH
3+
export PATH=${CMAKE_INSTALL_PREFIX}/${BINDIR}:$PATH
4+
export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${PYPATH}:$PYTHONPATH

simex_vars_dev.sh.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22

3-
export PATH=${BINDIR}:$PATH
4-
export PYTHONPATH=${FRAMEWORK_DIR}/python:${PYPATH}:$PYTHONPATH
3+
export PATH=${CMAKE_INSTALL_PREFIX}/${BINDIR}:$PATH
4+
export PYTHONPATH=${FRAMEWORK_DIR}/python:${CMAKE_INSTALL_PREFIX}/${PYPATH}:$PYTHONPATH

0 commit comments

Comments
 (0)