Skip to content

Commit 670d4cc

Browse files
author
Benedikt Hegner
committed
Merge github.com:HEP-SF/tools
2 parents f2620f7 + ada5544 commit 670d4cc

9 files changed

+122
-21
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Software Foundation (HSF).
66
## create_project
77
The tool create_project creates a template CMake project. The created project
88
contains the standard use patterns for small CMake projects, plus support for
9-
Doxygen, CPack, and gtest. Further documentation is provided within the created
9+
Doxygen and CPack. Further documentation is provided within the created
1010
package itself inside the README.md.
1111

1212
## hsf_get_platform and hsf_platform_compatibility

create_project.py

+3
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ def replace_templates(self):
104104
os.rename(join(self.target_dir,"cmake/PROJECTTEMPLATEConfig.cmake.in"),join(self.target_dir,"cmake/%sConfig.cmake.in" %self.name))
105105
os.rename(join(self.target_dir,"cmake/PROJECTTEMPLATECreateConfig.cmake"),join(self.target_dir,"cmake/%sCreateConfig.cmake" %self.name))
106106
os.rename(join(self.target_dir,"cmake/PROJECTTEMPLATEDoxygen.cmake"),join(self.target_dir,"cmake/%sDoxygen.cmake" %self.name))
107+
os.rename(join(self.target_dir,"cmake/PROJECTTEMPLATEUninstall.cmake"),join(self.target_dir,"cmake/%sUninstall.cmake" %self.name))
108+
os.rename(join(self.target_dir,"cmake/PROJECTTEMPLATE_uninstall.cmake.in"),join(self.target_dir,"cmake/%s_uninstall.cmake.in" %self.name))
109+
os.rename(join(self.target_dir,"cmake/PROJECTTEMPLATE.pc.in"),join(self.target_dir,"cmake/%s.pc.in" %self.name))
107110
os.rename(join(self.target_dir,"PROJECTTEMPLATEVersion.h"),join(self.target_dir,"%sVersion.h" %self.name))
108111
os.rename(join(self.target_dir,"package/include/example"),join(self.target_dir,"package/include/%s" %self.name))
109112
os.rename(join(self.target_dir,"package"),join(self.target_dir,"%s" %self.subpackage_name))

project_template/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,6 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE
7373

7474
#--- project specific subdirectories -------------------------------------------
7575
add_subdirectory(HSFSUBPACKAGE)
76+
77+
#--- create uninstall target ---------------------------------------------------
78+
include(cmake/HSFTEMPLATEUninstall.cmake)

project_template/README.md

+15-7
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,26 @@ Please add some lines describing the project!
66

77
mkdir build
88
cd build
9-
cmake -DCMAKE_INSTALL_PREFIX=<installdir> <path to sources>
9+
cmake -DCMAKE_INSTALL_PREFIX=<installdir> [-DPROJECTTEMPLATE_BUILD_DOCS=ON] <path to sources>
1010
make -j<number of cores on your machine>
1111
make install
1212

13-
## Building the documentation
13+
The `PROJECTTEMPLATE_BUILD_DOCS` variable is optional, and should be passed if you wish to
14+
build the Doxygen based API documentation. Please note that this requires an existing
15+
installation of [Doxygen](http://www.doxygen.org/index.html). If CMake cannot locate
16+
Doxygen, its install location should be added into `CMAKE_PREFIX_PATH`.
17+
For further details please have a look at [the CMake tutorial](http://www.cmake.org/cmake-tutorial/).
1418

15-
The documentation of the project is based on doxygen.
16-
If you would like to build it, you have to configure the package with
19+
## Building the documentation
1720

18-
cmake -DPROJECTTEMPLATE_documentation -DCMAKE_INSTALL_PREFIX=<installdir> <path to sources>
19-
Invoking
21+
The documentation of the project is based on doxygen. To build the documentation,
22+
the project must have been configured with `PROJECTTEMPLATE_BUILD_DOCS` enabled, as
23+
described earlier. It can then be built and installed:
2024

2125
make doc
2226
make install
2327

24-
installs the documentation into installdir/share/doc/.
28+
By default, this installs the documentation into `<installdir>/share/doc/HSFTEMPLATE/share/doc`.
2529

2630
## Creating a package with CPack
2731

@@ -38,3 +42,7 @@ To run the tests of the project, first build it and then invoke
3842
## Inclusion into other projects
3943

4044
If you want to build your own project against PROJECTTEMPLATE, CMake may be the best option for you. Just add its location to _CMAKE_PREFIX_PATH_ and call _find_package(PROJECTTEMPLATE)_ within your CMakeLists.txt.
45+
46+
A `pkg-config` `.pc` file is also installed if you do not use CMake.
47+
Simply add the location of the `.pc` file (nominally `<installdir>/lib/pkgconfig`) and run `pkg-config --cflags --libs HSFTEMPLATE` to get the
48+
include paths and libraries needed to compile and link to HSFTEMPLATE.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
prefix=${pcfiledir}/@HSFTEMPLATE_PCFILEDIR_TO_PREFIX@
2+
libdir=${prefix}@CMAKE_INSTALL_LIBDIR@
3+
includedir=${prefix}@CMAKE_INSTALL_INCLUDEDIR@
4+
5+
Name: @PROJECT_NAME@
6+
Version: @PROJECT_VERSION@
7+
Description: "Description of @PROJECT_NAME@"
8+
Libs: -L${libdir} -lexamplelibrary
9+
Cflags: -I${includedir}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#.rst:
2+
# HSFTEMPLATEUninstallTarget
3+
# ---------------------------
4+
# Add an `uninstall` target
5+
#
6+
7+
#=============================================================================
8+
# Copyright 2015 Alex Merry <[email protected]>
9+
#
10+
# Redistribution and use in source and binary forms, with or without
11+
# modification, are permitted provided that the following conditions
12+
# are met:
13+
#
14+
# 1. Redistributions of source code must retain the copyright
15+
# notice, this list of conditions and the following disclaimer.
16+
# 2. Redistributions in binary form must reproduce the copyright
17+
# notice, this list of conditions and the following disclaimer in the
18+
# documentation and/or other materials provided with the distribution.
19+
# 3. The name of the author may not be used to endorse or promote products
20+
# derived from this software without specific prior written permission.
21+
#
22+
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23+
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24+
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25+
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27+
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31+
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32+
33+
if (NOT TARGET uninstall)
34+
configure_file(
35+
"${CMAKE_CURRENT_LIST_DIR}/HSFTEMPLATE_uninstall.cmake.in"
36+
"${CMAKE_BINARY_DIR}/HSFTEMPLATE_uninstall.cmake"
37+
IMMEDIATE
38+
@ONLY
39+
)
40+
41+
add_custom_target(uninstall
42+
COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/HSFTEMPLATE_uninstall.cmake"
43+
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
44+
)
45+
endif()
46+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
2+
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
3+
endif()
4+
5+
file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
6+
string(REGEX REPLACE "\n" ";" files "${files}")
7+
foreach(file ${files})
8+
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
9+
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
10+
exec_program(
11+
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
12+
OUTPUT_VARIABLE rm_out
13+
RETURN_VALUE rm_retval
14+
)
15+
if(NOT "${rm_retval}" STREQUAL 0)
16+
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
17+
endif()
18+
else()
19+
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
20+
endif()
21+
endforeach()

project_template/doc/CMakeLists.txt

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
find_package(Doxygen)
2+
if(DOXYGEN_FOUND)
3+
configure_file(Doxyfile.in Doxyfile @ONLY)
4+
add_custom_target(doc
5+
${DOXYGEN_EXECUTABLE} Doxyfile
6+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
7+
COMMENT "Generating API documentation with Doxygen" VERBATIM)
8+
9+
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doxygen
10+
DESTINATION ${CMAKE_INSTALL_DOCDIR}/doxygen
11+
)
12+
endif()

project_template/doc/Doxyfile.in

+12-13
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ DOXYFILE_ENCODING = UTF-8
3232
# title of most generated pages and in a few other places.
3333
# The default value is: My Project.
3434

35-
PROJECT_NAME = "PROJECTTEMPLATE"
35+
PROJECT_NAME = "@PROJECT_NAME@"
3636

3737
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = @CMAKE_PROJECT_VERSION@
41+
PROJECT_NUMBER = @PROJECT_VERSION@
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a
@@ -58,7 +58,7 @@ PROJECT_LOGO =
5858
# entered, it will be relative to the location where doxygen was started. If
5959
# left blank the current directory will be used.
6060

61-
OUTPUT_DIRECTORY = @CMAKE_BINARY_DIR@/doxygen
61+
OUTPUT_DIRECTORY = @PROJECT_BINARY_DIR@/doc/doxygen
6262

6363
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
6464
# directories (in 2 levels) under the output directory of each output format and
@@ -144,7 +144,7 @@ FULL_PATH_NAMES = YES
144144
# will be relative from the directory where doxygen is started.
145145
# This tag requires that the tag FULL_PATH_NAMES is set to YES.
146146

147-
STRIP_FROM_PATH = @CMAKE_SOURCE_DIR@ @CMAKE_BINARY_DIR@
147+
STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@ @PROJECT_BINARY_DIR@
148148

149149
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
150150
# path mentioned in the documentation of a class, which tells the reader which
@@ -153,7 +153,7 @@ STRIP_FROM_PATH = @CMAKE_SOURCE_DIR@ @CMAKE_BINARY_DIR@
153153
# specify the list of include paths that are normally passed to the compiler
154154
# using the -I flag.
155155

156-
STRIP_FROM_INC_PATH = @DOXYGEN_INCLUDE_DIRS@ @CMAKE_BINARY_DIR@/include
156+
STRIP_FROM_INC_PATH = @DOXYGEN_INCLUDE_DIRS@ @PROJECT_BINARY_DIR@/include
157157

158158
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
159159
# less readable) file names. This can be useful is your file systems doesn't
@@ -731,7 +731,7 @@ WARN_FORMAT = "$file:$line: $text"
731731
# messages should be written. If left blank the output is written to standard
732732
# error (stderr).
733733

734-
WARN_LOGFILE = @CMAKE_BINARY_DIR@/doxygen-warnings.log
734+
WARN_LOGFILE = @PROJECT_BINARY_DIR@/doxygen-warnings.log
735735

736736
#---------------------------------------------------------------------------
737737
# Configuration options related to the input files
@@ -743,9 +743,8 @@ WARN_LOGFILE = @CMAKE_BINARY_DIR@/doxygen-warnings.log
743743
# spaces.
744744
# Note: If this tag is empty the current directory is searched.
745745

746-
INPUT = @CMAKE_SOURCE_DIR@
747-
INPUT += @CMAKE_BINARY_DIR@/include
748-
INPUT += @CMAKE_CURRENT_BINARY_DIR@
746+
INPUT = @PROJECT_SOURCE_DIR@
747+
INPUT += @PROJECT_BINARY_DIR@/include
749748

750749
# This tag can be used to specify the character encoding of the source files
751750
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@@ -801,7 +800,7 @@ EXCLUDE_SYMLINKS = NO
801800
# Note that the wildcards are matched against the file with absolute path, so to
802801
# exclude all test directories for example use the pattern */test/*
803802

804-
EXCLUDE_PATTERNS = */tests/* */dict/* */cmake/* @CMAKE_BINARY_DIR@
803+
EXCLUDE_PATTERNS = */tests/* */dict/* */cmake/* @PROJECT_BINARY_DIR@
805804

806805
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
807806
# (namespaces, classes, functions, etc.) that should be excluded from the
@@ -818,7 +817,7 @@ EXCLUDE_SYMBOLS =
818817
# that contain example code fragments that are included (see the \include
819818
# command).
820819

821-
EXAMPLE_PATH = @CMAKE_SOURCE_DIR@
820+
EXAMPLE_PATH = @PROJECT_SOURCE_DIR@
822821

823822
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
824823
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
@@ -886,7 +885,7 @@ FILTER_SOURCE_PATTERNS =
886885
# (index.html). This can be useful if you have a project on for instance GitHub
887886
# and want to reuse the introduction page also for the doxygen output.
888887

889-
USE_MDFILE_AS_MAINPAGE =
888+
USE_MDFILE_AS_MAINPAGE = README.md
890889

891890
#---------------------------------------------------------------------------
892891
# Configuration options related to source browsing
@@ -1096,7 +1095,7 @@ HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
10961095
# Minimum value: 0, maximum value: 359, default value: 220.
10971096
# This tag requires that the tag GENERATE_HTML is set to YES.
10981097

1099-
HTML_COLORSTYLE_HUE = 0
1098+
HTML_COLORSTYLE_HUE = 220
11001099

11011100
# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
11021101
# in the HTML output. For a value of 0 the output will use grayscales only. A

0 commit comments

Comments
 (0)