forked from jrl-umi3218/jrl-cmakemodules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.cmake
83 lines (80 loc) · 2.82 KB
/
release.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Copyright (C) 2008-2014,2018 LAAS-CNRS, JRL AIST-CNRS.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#.rst:
# .. command:: RELEASE_SETUP
#
# .. _target-release:
#
# This adds a *release* target which release a stable version of the
# current package.
#
# To release a package, please run:
#
# .. code-block:: bash
#
# make release VERSION=X.Y.Z
#
# where ``X.Y.Z`` is the version number of your new package.
#
# A release consists in:
#
# - adding a signed tag following the ``vVERSION`` pattern.
# - running ``make distcheck`` (:ref:`distcheck <target-distcheck>`) to make sure everything is ok.
# - running ``make dist`` to generate a tarball
# - running ``make distclean`` to remove the current dist directory
# - reminds that you should push the tag and tarball on the GitHub repository (to be done manually as
# it is simple but cannot be reverted).
#
# .. todo::
#
# The following steps are missing to the current release procedure:
#
# - uploading the stable documentation.
# - uploading the resulting tarball to GitHub.
# - announce the release by e-mail.
#
MACRO(RELEASE_SETUP)
IF(UNIX)
FIND_PROGRAM(GIT git)
#Set LD_LIBRARY_PATH
IF(APPLE)
SET(LD_LIBRARY_PATH_VARIABLE_NAME "DYLD_LIBRARY_PATH")
ELSE(APPLE)
SET(LD_LIBRARY_PATH_VARIABLE_NAME "LD_LIBRARY_PATH")
ENDIF(APPLE)
ADD_CUSTOM_TARGET(release
COMMAND
export LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}
&& export ${LD_LIBRARY_PATH_VARIABLE_NAME}=$ENV{${LD_LIBRARY_PATH_VARIABLE_NAME}}
&& export PYTHONPATH=$ENV{PYTHONPATH}
&& ! test x$$VERSION = x
|| (echo "Please set a version for this release" && false)
&& cd ${PROJECT_SOURCE_DIR}
&& ${GIT} tag -s v$$VERSION -m "Release of version $$VERSION."
&& cd ${CMAKE_BINARY_DIR}
&& cmake ${PROJECT_SOURCE_DIR}
&& make distcheck
|| (echo "Please fix distcheck first."
&& cd ${PROJECT_SOURCE_DIR}
&& ${GIT} tag -d v$$VERSION
&& cd ${CMAKE_BINARY_DIR}
&& cmake ${PROJECT_SOURCE_DIR}
&& false)
&& make dist
&& make distclean
&& echo "Please, run 'git push --tags' and upload the tarball to github to finalize this release."
)
ENDIF()
ENDMACRO()