Skip to content

Commit 658ea22

Browse files
authored
cpack configs for jpscore (PedestrianDynamics#666)
* create dmg for jpscore * refactor cpack config * testing windows works * Debian configs * add target to make guide * control titlepage generation from cmake
1 parent 6904bbf commit 658ea22

12 files changed

+240
-125
lines changed

CMakeLists.txt

+35-59
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ if (GIT_SCM AND GITDIR)
178178
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
179179
OUTPUT_VARIABLE GIT_SHA1
180180
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
181-
182181
# branch
183182
execute_process(
184183
COMMAND "${GIT_EXECUTABLE}" rev-parse --abbrev-ref HEAD
@@ -194,6 +193,12 @@ if (GIT_SCM AND GITDIR)
194193
OUTPUT_VARIABLE GIT_DATE
195194
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
196195

196+
execute_process(COMMAND
197+
"${GIT_EXECUTABLE}" describe --tags --abbrev=0
198+
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
199+
OUTPUT_VARIABLE GIT_TAG
200+
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
201+
197202
# the subject of the commit
198203
execute_process(COMMAND
199204
"${GIT_EXECUTABLE}" log -1 --format=%s
@@ -207,20 +212,21 @@ if (GIT_SCM AND GITDIR)
207212

208213
else()
209214
message(STATUS "Not in a git repo")
210-
set(GIT_SHA1 "UNKNONW")
211-
set(GIT_DATE "UNKNONW")
212-
set(GIT_COMMIT_SUBJECT "UNKNONW")
213-
set(GIT_BRANCH "UNKNONW")
215+
set(GIT_SHA1 "UNKNOWN")
216+
set(GIT_DATE "UNKNOWN")
217+
set(GIT_COMMIT_SUBJECT "UNKNOWN")
218+
set(GIT_BRANCH "UNKNOWN")
219+
set(GIT_TAG "UNKNOWN")
214220
endif()
215221

216222
add_library(git-info INTERFACE)
217223
target_compile_definitions(git-info INTERFACE
218224
GIT_COMMIT_HASH="${GIT_SHA1}"
219225
GIT_COMMIT_DATE="${GIT_DATE}"
226+
GIT_TAG="${GIT_TAG}"
220227
GIT_COMMIT_SUBJECT="${GIT_COMMIT_SUBJECT}"
221228
GIT_BRANCH="${GIT_BRANCH}"
222229
)
223-
224230
################################################################################
225231
# Documentation
226232
################################################################################
@@ -236,7 +242,20 @@ if(BUILD_DOC)
236242
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
237243
COMMENT "Generating API documentation with Doxygen"
238244
VERBATIM
239-
)
245+
)
246+
# generate file titlepage.tex based on titlepage.tex.in
247+
configure_file(
248+
${CMAKE_CURRENT_SOURCE_DIR}/docs/jps_guide/titlepage.tex.in
249+
${CMAKE_CURRENT_SOURCE_DIR}/docs/jps_guide/titlepage.tex
250+
@ONLY
251+
)
252+
add_custom_target(guide
253+
"${PYTHON_EXECUTABLE}" ${CMAKE_CURRENT_SOURCE_DIR}/docs/jps_guide/make_guide.py
254+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/docs/jps_guide
255+
COMMENT "Generating guide"
256+
VERBATIM
257+
)
258+
240259
endif(BUILD_DOC)
241260

242261
################################################################################
@@ -263,59 +282,16 @@ endif (BUILD_TESTING)
263282
################################################################################
264283
# Packaging with CPack
265284
################################################################################
266-
IF(UNIX)
267-
SET(CPACK_GENERATOR "DEB")
268-
SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
269-
SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://jupedsim.org")
270-
SET(CPACK_DEBIAN_PACKAGE_SUGGESTS, "jpsvis, jpsreport, jpseditor")
271-
SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
272-
SET(CPACK_DEBIAN_PACKAGE_SECTION "science")
273-
SET(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
285+
include(CPackUtilities)
286+
IF(UNIX AND NOT APPLE)
287+
cpack_write_deb_config()
274288
endif()
275289
if(WIN32 AND NOT UNIX)
276-
message(STATUS "Package generation - Windows")
277-
set(CPACK_GENERATOR "NSIS")
278-
find_program(NSIS_PATH nsis PATH_SUFFIXES nsis)
279-
if(NSIS_PATH)
280-
set(CPACK_GENERATOR "${CPACK_GENERATOR};NSIS")
281-
message(STATUS " + NSIS YES ")
282-
else(NSIS_PATH)
283-
message(STATUS " + NSIS NO ")
284-
endif(NSIS_PATH)
285-
286-
#CPACK_NSIS_URL_INFO_ABOUT
287-
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
288-
include(InstallRequiredSystemLibraries)
289-
290-
message(STATUS "System Dependencies: " ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS})
291-
install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
292-
DESTINATION sys
293-
COMPONENT applications)
294-
elseif(APPLE)
295-
set(DEFAULT_CPACK_GENERATOR "DragNDrop")
290+
cpack_write_windows_config()
291+
endif()
292+
if(APPLE)
293+
cpack_write_osx_config()
296294
endif()
297295

298-
set(CPACK_COMPONENTS_ALL applications)
299-
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
300-
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/LICENSE")
301-
set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/forms/jpscore.ico")
302-
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/forms/jpscore.ico")
303-
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
304-
set(CPACK_NSIS_MODIFY_PATH ON)
305-
set(CPACK_COMPONENTS_ALL applications demos)
306-
set(CPACK_COMPONENT_CTDATA_GROUP "Demos")
307-
set(CPACK_COMPONENT_APPLICATIONS_DISPLAY_NAME "jpscore and dlls")
308-
set(CPACK_COMPONENT_GROUP_DATA_DESCRIPTION "demo files")
309-
set(CPACK_COMPONENT_DATA_FILES_DESCRIPTION "demo files to get started")
310-
SET(CPACK_PACKAGE_DESCRIPTION "Simulation core of JuPedSim")
311-
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The simulation core of JuPedSim, a framework for simulation and analysis of pedestrian dynamics")
312-
SET(CPACK_PACKAGE_VENDOR "Forschungszentrum Juelich GmbH")
313-
SET(CPACK_PACKAGE_NAME "jpscore")
314-
SET(CPACK_PACKAGE_CONTACT "[email protected]")
315-
SET(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_MAJOR_VERSION}")
316-
SET(CPACK_PACKAGE_VERSION_MINOR "${PROJET_MINOR_VERSION}")
317-
SET(CPACK_PACKAGE_VERSION_PATCH "${PROJET_PATCH_VERSION}")
318-
SET(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${PROJET_VERSION}")
319-
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${PROJET_VERSION}")
320-
321-
INCLUDE(CPack)
296+
cpack_write_config()
297+

LICENSE

+10-11
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,13 @@ use of this software and its documentation, even if JuPedSim has been advised of
2323
the possibility of such damage.
2424
JuPedSim specifically disclaims any warranties, including, but not limited to,
2525
the implied warranties of merchantability and fitness for a particular purpose.
26-
The software and accompanying documentation, if any, provided hereunder is
27-
provided “as is”. JuPedSim has no obligation to provide maintenance, support,
28-
updates, enhancements, or modifications.
29-
Forschungszentrum Julich GmbH makes no warranty, expressed or implied,
30-
to users of JuPedSim, and accepts no responsibility for its use. Users of JuPedSim
31-
assume sole responsibility for determining the appropriateness of its use; and for
32-
any actions taken or not taken as a result of analyses performed using this tool.
33-
Users are warned that JuPedSim is intended for academic use only. This
34-
tool is an implementation of several computer models that may or may not have
35-
predictive capability when applied to a specific set of factual circumstances. Lack
36-
of accurate prediction
26+
The software and accompanying documentation, if any, provided hereunder is provided "as is".
27+
28+
JuPedSim has no obligation to provide maintenance, support, updates, enhancements, or modifications.
29+
Forschungszentrum Jülich GmbH makes no warranty, expressed or implied,
30+
to users of JuPedSim, and accepts no responsibility for its use.
31+
Users of JuPedSim assume sole responsibility for determining the appropriateness of its use;
32+
and for any actions taken or not taken as a result of analyses performed using this tool.
33+
Users are warned that JuPedSim is intended for academic use only.
34+
This tool is an implementation of several computer models that may or may not have
35+
predictive capability when applied to a specific set of factual circumstances.

cmake_modules/CPackUtilities.cmake

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# create win-exe, dmg, and deb
2+
#-------------------------------
3+
# Structure:
4+
# ├── LICENSE
5+
# ├── README.md
6+
# ├── JuPedSim.pdf
7+
# ├── bin
8+
# │ ├── jpscore
9+
# │ └── jpsreport
10+
# ├── jpscore_samples
11+
# └── jpsreport_samples
12+
#-------------------------------
13+
function (cpack_write_deb_config)
14+
message(STATUS "Package generation - LINUX")
15+
list(APPEND CPACK_GENERATOR "DEB")
16+
set (CPACK_GENERATOR ${CPACK_GENERATOR} PARENT_SCOPE)
17+
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON PARENT_SCOPE)
18+
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-dev (>=1.65), zlib1g-dev" PARENT_SCOPE)
19+
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://jupedsim.org" PARENT_SCOPE)
20+
set(CPACK_DEBIAN_PACKAGE_SUGGESTS, "jpsvis, jpseditor" PARENT_SCOPE)
21+
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional" PARENT_SCOPE)
22+
set(CPACK_DEBIAN_PACKAGE_SECTION "science" PARENT_SCOPE)
23+
set(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR} PARENT_SCOPE)
24+
set( CPACK_DEBIAN_PACKAGE_MAINTAINER "David Haensel" PARENT_SCOPE)
25+
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "JuPedSim: framework for simulation and analysis of pedestrian dynamics" PARENT_SCOPE)
26+
endfunction()
27+
28+
function (cpack_write_osx_config)
29+
message(STATUS "Package generation - MacOS")
30+
list(APPEND CPACK_GENERATOR "DragNDrop")
31+
set (CPACK_GENERATOR ${CPACK_GENERATOR} PARENT_SCOPE)
32+
Set(CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_SOURCE_DIR}/jpscore/forms/background.png" PARENT_SCOPE)
33+
set(CPACK_DMG_DS_STORE_SETUP_SCRIPT
34+
"${CMAKE_SOURCE_DIR}/jpscore/forms/DS_Store.scpt" PARENT_SCOPE)
35+
set(CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK ON PARENT_SCOPE)
36+
set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/jpscore/forms/JPScore.icns" PARENT_SCOPE)
37+
set(CPACK_DMG_VOLUME_NAME "${PROJECT_NAME}" PARENT_SCOPE)
38+
set(CPACK_SYSTEM_NAME "OSX" PARENT_SCOPE)
39+
endfunction()
40+
41+
function (cpack_write_windows_config)
42+
message(STATUS "Package generation - Windows")
43+
list(APPEND CPACK_GENERATOR "NSIS")
44+
set (CPACK_GENERATOR ${CPACK_GENERATOR} PARENT_SCOPE)
45+
find_program(NSIS_PATH nsis PATH_SUFFIXES nsis)
46+
if(NSIS_PATH)
47+
message(STATUS " + NSIS YES ")
48+
else(NSIS_PATH)
49+
message(STATUS " + NSIS NO ")
50+
endif(NSIS_PATH)
51+
52+
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
53+
set(VCPKG_DIR "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin/")
54+
set(DIRS ${VCPKG_DIR})
55+
set(DLL_FILES ${VCPKG_DIR}/zlib1.dll ${VCPKG_DIR}/fmt.dll)
56+
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS "${DLL_FILES}")
57+
set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION "${BUNDLE_RUNTIME_DESTINATION}")
58+
include(InstallRequiredSystemLibraries)
59+
60+
install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
61+
DESTINATION bin
62+
COMPONENT applications)
63+
64+
# some configs for installer
65+
set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/jpscore/forms/JPScore.ico" PARENT_SCOPE)
66+
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/jpscore/forms/JPScore.ico" PARENT_SCOPE)
67+
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON PARENT_SCOPE)
68+
set(CPACK_NSIS_MODIFY_PATH ON PARENT_SCOPE)
69+
set(CPACK_NSIS_HELP_LINK "http://www.jupedsim.org/jupedsim_install_on_windows.html" PARENT_SCOPE)
70+
set(CPACK_NSIS_URL_INFO_ABOUT "http://www.jupedsim.org/" PARENT_SCOPE)
71+
set(CPACK_NSIS_DISPLAY_NAME ${CMAKE_PROJECT_NAME} PARENT_SCOPE)
72+
# ----------------------------
73+
endfunction()
74+
75+
function (cpack_write_config)
76+
message(STATUS "Cpack write configs")
77+
set(CPACK_COMPONENTS_ALL applications PARENT_SCOPE)
78+
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE" PARENT_SCOPE)
79+
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md" PARENT_SCOPE)
80+
set(CPACK_COMPONENTS_ALL applications jpscore_samples jpsreport_samples PARENT_SCOPE)
81+
set(CPACK_COMPONENT_CTDATA_GROUP "Sample files" PARENT_SCOPE)
82+
set(CPACK_COMPONENT_APPLICATIONS_DISPLAY_NAME "jpscore and jpsreport" PARENT_SCOPE)
83+
set(CPACK_COMPONENT_GROUP_DATA_DESCRIPTION "Sample files" PARENT_SCOPE)
84+
set(CPACK_COMPONENT_DATA_FILES_DESCRIPTION "Sample files to get started" PARENT_SCOPE)
85+
set(CPACK_PACKAGE_DESCRIPTION "jpscore and jpsreport" PARENT_SCOPE)
86+
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "JuPedSim: framework for simulation and analysis of pedestrian dynamics" PARENT_SCOPE)
87+
set(CPACK_PACKAGE_VENDOR "Forschungszentrum Juelich GmbH" PARENT_SCOPE)
88+
set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME} PARENT_SCOPE)
89+
set(CPACK_PACKAGE_CONTACT "[email protected]" PARENT_SCOPE)
90+
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION} PARENT_SCOPE)
91+
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${PROJECT_VERSION}" PARENT_SCOPE)
92+
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${PROJECT_VERSION}")
93+
94+
install(FILES "${CMAKE_SOURCE_DIR}/LICENSE"
95+
DESTINATION .
96+
COMPONENT Documents)
97+
98+
install(FILES "${CMAKE_SOURCE_DIR}/README.md"
99+
DESTINATION .
100+
COMPONENT Documents)
101+
102+
set(jpsguide "${CMAKE_SOURCE_DIR}/docs/jps_guide/JuPedSim.pdf")
103+
if(EXISTS "${jpsguide}")
104+
install(FILES "${jpsguide}"
105+
DESTINATION .
106+
COMPONENT Documents)
107+
endif()
108+
109+
print_var(CPACK_SOURCE_PACKAGE_FILE_NAME)
110+
111+
include(CPack)
112+
endfunction()

docs/jps_guide/JuPedSim.tex

-28
Original file line numberDiff line numberDiff line change
@@ -73,31 +73,11 @@
7373
]{scrreprt}%
7474

7575

76-
% **************************************************
77-
% Debug LaTeX Information
78-
% **************************************************
79-
%\listfiles
80-
% \usepackage{etoc}
81-
% \etocsetlevel{authors}{1}
82-
% \etocsetlevel{section}{2}
83-
% \etocsetlevel{subsection}{3}
84-
% \etocsettocdepth{subsection}
8576
% **************************************************
8677
% Information and Commands for Reuse
8778
% **************************************************
8879
\newcommand{\thesisTitle}{JuPedSim User Guide}
8980
\newcommand{\thesisSubject}{Documentation}
90-
\newcommand{\thesisDate}{May 29, 2018}
91-
\newcommand{\Version}{0.8.4}
92-
93-
94-
\newcommand{\thesisUniversity}{\protect{Clean Thesis Style University}}
95-
\newcommand{\thesisUniversityDepartment}{Department of Clean Thesis Style}
96-
\newcommand{\thesisUniversityInstitute}{Institut for Clean Thesis Dev}
97-
\newcommand{\thesisUniversityGroup}{Clean Thesis Group (CTG)}
98-
\newcommand{\thesisUniversityCity}{City}
99-
\newcommand{\thesisUniversityStreetAddress}{Street address}
100-
\newcommand{\thesisUniversityPostalCode}{Postal Code}
10181
\newcommand{\thesisName}{JuPedSim}
10282
% **************************************************
10383
% Load and Configure Packages
@@ -177,8 +157,6 @@
177157
% --------------------------
178158
% rename document parts
179159
% --------------------------
180-
% \renewcaptionname{ngerman}{\figurename}{Abb.}
181-
% \renewcaptionname{ngerman}{\tablename}{Tab.}
182160
\renewcaptionname{english}{\figurename}{Fig.}
183161
\renewcaptionname{english}{\tablename}{Tab.}
184162

@@ -187,12 +165,6 @@
187165
% --------------------------
188166
\pagenumbering{arabic} % roman page numbing (invisible for empty page style)
189167
\pagestyle{plain}
190-
% \pagestyle{fancy}
191-
% \fancyhf{}
192-
% \fancyhead[LE,RO]{JuPedSim}
193-
% \fancyhead[RE,LO]{User's Guide \Version}
194-
% \fancyfoot[CE,CO]{\leftmark}
195-
% \fancyfoot[LE,RO]{\thepage}
196168
\input{titlepage} % INCLUDE: all titlepages
197169
\pdfbookmark[1]{Disclaimer}{sec:disclaimer} % Bookmark im pdf file
198170
\let\cleardoublepage\clearpage

docs/jps_guide/make_guide.py

+11-19
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import os
1616
import re
1717
import shlex
18+
import shutil
1819
import subprocess
1920
from shutil import copyfile
2021

@@ -58,6 +59,7 @@ def clean_file(filename, img_dir):
5859

5960

6061
if __name__ == "__main__":
62+
pathname = os.path.dirname(sys.argv[0])
6163
if not os.path.exists("_tex"):
6264
os.makedirs("_tex")
6365
print("make _tex")
@@ -69,6 +71,12 @@ def clean_file(filename, img_dir):
6971

7072
markdown_files = glob.glob("../pages/%s/*.md" % module)
7173
img_dir = ".."
74+
if shutil.which("kramdown") is None:
75+
sys.exit("error: kramdown not found.")
76+
77+
if shutil.which("xelatex") is None:
78+
sys.exit("error: xelatex not found.")
79+
7280
for markdown_file in markdown_files:
7381
latex_file = os.path.join("_tex", module, os.path.basename(os.path.splitext(markdown_file)[0]) ) + ".tex"
7482
print("markdown_file %s " % markdown_file)
@@ -83,28 +91,12 @@ def clean_file(filename, img_dir):
8391
clean_file(latex_file, img_dir)
8492

8593

86-
87-
post_checkout = "../../.git/hooks/post-checkout"
88-
if not os.path.exists(post_checkout):
89-
print("copy <post-checkout> to <../../.git/hooks>")
90-
copyfile("./post-checkout", post_checkout)
91-
92-
# make file executable
93-
print("change permission of <post-checkout>")
94-
os.chmod(post_checkout, 0o775)
95-
96-
# remove old titlepage.tex
97-
if os.path.exists("./titlepage.tex"):
98-
print("remove titlepage")
99-
os.remove("./titlepage.tex")
100-
101-
# create titlepage
102-
make_title_page = "git checkout master"
103-
res = subprocess.call(shlex.split(make_title_page))
104-
94+
source_path = os.path.normpath(pathname + os.sep + os.pardir + os.sep + os.pardir)
10595
if not os.path.exists("./titlepage.tex"):
10696
sys.exit("could not find titlepage.tex. git checkout was not successful!")
10797

10898
# process jupedsim.tex
10999
subprocess.call("make")
110100
res = subprocess.call(shlex.split("make clean"))
101+
102+

0 commit comments

Comments
 (0)