Skip to content

Commit bd05661

Browse files
committed
Create separate ProjectFiles.cmake file for easier management.
Update description in readme, including file/folder structure section. Update Travis config script to use sudoless container. Add new bash scripts for CMake and Doxygen installation. Add new script to check Doxygen output in Travis script.
1 parent c5c6bdb commit bd05661

11 files changed

+109
-53
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
build
3232
bin
3333
lib
34-
doxygen-docs
34+
doxydocs
3535
temp
3636
debug
3737
external

.travis.yml

+14-15
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
language: cpp
66

7+
sudo: false
8+
79
compiler:
810
- gcc
911
- clang
@@ -32,31 +34,28 @@ addons:
3234
branch_pattern: coverity_scan
3335

3436
before_install:
35-
- sudo chmod ugo+x scripts/update_doxygen.sh
36-
- sudo chmod ugo+x scripts/check_doxygen_output.sh
37-
# Fetch a newer CMake.
38-
# https://github.com/bjz/glfw-rs/commit/e9353a14afa5c647497837e16fd44d0e1d6eb326
39-
- yes | sudo add-apt-repository ppa:kalakris/cmake
40-
41-
install:
42-
- sudo apt-get install cmake
43-
- sudo apt-get autoremove
44-
- sudo ./scripts/update_doxygen.sh
37+
- bash scripts/install_cmake.sh
38+
- bash scripts/install_doxygen.sh
39+
- chmod ugo+x scripts/check_doxygen.sh
4540
- if [ "$COVERITY_SCAN_BRANCH_PATTERN" != "coverity_scan" ] && [ "$CXX" == "g++" ] && [ "$BUILD_TYPE" == "Debug" ]; then
46-
sudo pip install cpp-coveralls;
41+
pip install --user cpp-coveralls;
4742
fi
4843

44+
before_script::
45+
- ls -R $HOME/cmake
46+
- ls -R $HOME/doxygen
47+
4948
script:
5049
- if [ "$COVERITY_SCAN_BRANCH_PATTERN" != "coverity_scan" ]; then
5150
mkdir build;
5251
cd build;
53-
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_TESTS=on -DBUILD_TESTS_WITH_EIGEN=on -DBUILD_DOXYGEN_DOCS=on ..;
52+
$HOME/cmake/bin/cmake cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_TESTS=on -DBUILD_TESTS_WITH_EIGEN=on -DDOXYGEN_EXECUTABLE=$HOME/doxygen/bin/doxygen -DBUILD_DOXYGEN_DOCS=on ..;
5453
make;
55-
../scripts/check_doxygen_output.sh;
5654
ctest -V;
55+
../scripts/check_doxygen.sh;
5756
fi
5857

5958
after_success:
6059
- if [ "$COVERITY_SCAN_BRANCH_PATTERN" != "coverity_scan" ] && [ "$CXX" == "g++" ] && [ "$BUILD_TYPE" == "Debug" ]; then
61-
coveralls --root .. -E ".*external.*" -E ".*CMakeFiles.*" -E ".*test/.*.cpp.*";
62-
fi
60+
coveralls --root .. -E ".*external.*" -E ".*CMakeFiles.*" -E ".*test/.*.cpp.*" -E ".*src/main.cpp.*";
61+
fi

CMakeLists.txt

+5-10
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 2.6)
66

77
# Change this section to correspond with your project info.
88
project(SML C CXX)
9-
set(PROJECT_SUMMARY "A simple mathematics library")
9+
set(${CMAKE_PROJECT_NAME}_SUMMARY "A simple mathematics library")
1010
set(${CMAKE_PROJECT_NAME}_VENDOR_NAME "Kartik Kumar")
1111
set(${CMAKE_PROJECT_NAME}_VENDOR_CONTACT "[email protected]")
1212
set(${CMAKE_PROJECT_NAME}_VERSION_MAJOR 0)
@@ -23,15 +23,15 @@ if(NOT EXTERNAL_PATH)
2323
set(EXTERNAL_PATH "${PROJECT_PATH}/external")
2424
endif(NOT EXTERNAL_PATH)
2525
if(NOT DOXYGEN_PATH)
26-
set(DOXYGEN_PATH "${PROJECT_PATH}/doxygen-docs")
26+
set(DOXYGEN_PATH "${PROJECT_PATH}/doxydocs")
2727
endif(NOT DOXYGEN_PATH)
2828
if(NOT DOCS_PATH)
2929
set(DOCS_PATH "${PROJECT_PATH}/docs")
3030
endif(NOT DOCS_PATH)
3131
set(TEST_PATH "${PROJECT_BINARY_DIR}/test")
32-
set(TEST_NAME "test_sml")
32+
set(TEST_NAME "test_${CMAKE_PROJECT_NAME}")
3333

34-
OPTION(BUILD_DOXYGEN_DOCS "Build Doxygen docs" OFF)
34+
OPTION(BUILD_DOXYGEN_DOCS "Build docs" OFF)
3535
OPTION(BUILD_TESTS "Build tests" OFF)
3636
OPTION(BUILD_DEPENDENCIES "Force build of dependencies" OFF)
3737

@@ -41,12 +41,7 @@ CMAKE_DEPENDENT_OPTION(BUILD_TESTS_WITH_EIGEN "Build tests with Eigen library"
4141
CMAKE_DEPENDENT_OPTION(BUILD_COVERAGE_ANALYSIS "Build code coverage analysis" OFF
4242
"BUILD_TESTS" OFF)
4343

44-
set(TEST_SRC
45-
"${TEST_SRC_PATH}/testSml.cpp"
46-
"${TEST_SRC_PATH}/testBasicFunctions.cpp"
47-
"${TEST_SRC_PATH}/testConstants.cpp"
48-
"${TEST_SRC_PATH}/testLinearAlgebra.cpp"
49-
)
44+
include(ProjectFiles.cmake)
5045

5146
# Set CMake build-type. If it not supplied by the user, the default built type is "Release".
5247
if(((NOT CMAKE_BUILD_TYPE)

Doxyfile.in

+25-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Doxyfile 1.8.10
1+
# Doxyfile 1.8.11
22

33
# This file describes the settings to be used by the documentation system
44
# doxygen (www.doxygen.org) for a project.
@@ -741,6 +741,12 @@ WARN_IF_DOC_ERROR = YES
741741

742742
WARN_NO_PARAMDOC = YES
743743

744+
# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
745+
# a warning is encountered.
746+
# The default value is: NO.
747+
748+
WARN_AS_ERROR = NO
749+
744750
# The WARN_FORMAT tag determines the format of the warning messages that doxygen
745751
# can produce. The string should contain the $file, $line, and $text tags, which
746752
# will be replaced by the file and line number from which the warning originated
@@ -791,8 +797,8 @@ INPUT_ENCODING = UTF-8
791797
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
792798
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
793799
# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
794-
# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd,
795-
# *.vhdl, *.ucf, *.qsf, *.as and *.js.
800+
# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f, *.for, *.tcl,
801+
# *.vhd, *.vhdl, *.ucf, *.qsf, *.as and *.js.
796802

797803
FILE_PATTERNS = *.hpp \
798804
*.cpp \
@@ -883,6 +889,10 @@ IMAGE_PATH =
883889
# Note that the filter must not add or remove lines; it is applied before the
884890
# code is scanned, but not when the output code is generated. If lines are added
885891
# or removed, the anchors will not be placed correctly.
892+
#
893+
# Note that for custom extensions or not directly supported extensions you also
894+
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
895+
# properly processed by doxygen.
886896

887897
INPUT_FILTER =
888898

@@ -892,6 +902,10 @@ INPUT_FILTER =
892902
# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
893903
# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
894904
# patterns match the file name, INPUT_FILTER is applied.
905+
#
906+
# Note that for custom extensions or not directly supported extensions you also
907+
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
908+
# properly processed by doxygen.
895909

896910
FILTER_PATTERNS =
897911

@@ -1734,6 +1748,14 @@ LATEX_SOURCE_CODE = NO
17341748

17351749
LATEX_BIB_STYLE = plain
17361750

1751+
# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
1752+
# page will contain the date and time when the page was generated. Setting this
1753+
# to NO can help when comparing the output of multiple runs.
1754+
# The default value is: NO.
1755+
# This tag requires that the tag GENERATE_LATEX is set to YES.
1756+
1757+
LATEX_TIMESTAMP = NO
1758+
17371759
#---------------------------------------------------------------------------
17381760
# Configuration options related to the RTF output
17391761
#---------------------------------------------------------------------------

ProjectFiles.cmake

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) 2014-2016 Kartik Kumar, Dinamica Srl ([email protected])
2+
# Distributed under the MIT License.
3+
# See accompanying file LICENSE.md or copy at http://opensource.org/licenses/MIT
4+
5+
# Set project test source files.
6+
set(TEST_SRC
7+
"${TEST_SRC_PATH}/testSml.cpp"
8+
"${TEST_SRC_PATH}/testBasicFunctions.cpp"
9+
"${TEST_SRC_PATH}/testConstants.cpp"
10+
"${TEST_SRC_PATH}/testLinearAlgebra.cpp"
11+
)

README.md

+24-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
SML
22
===
33

4-
[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT) [![Build Status](https://travis-ci.org/astropnp/sml.svg?branch=master)](https://travis-ci.org/astropnp/sml) [![Coverity Scan Build Status](https://scan.coverity.com/projects/3666/badge.svg)](https://scan.coverity.com/projects/3666) [![Coverage Status](https://coveralls.io/repos/astropnp/sml/badge.png)](https://coveralls.io/r/astropnp/sml)
4+
\cond [![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT) [![Build Status](https://travis-ci.org/astropnp/sml.svg?branch=master)](https://travis-ci.org/astropnp/sml) [![Coverity Scan Build Status](https://scan.coverity.com/projects/3666/badge.svg)](https://scan.coverity.com/projects/3666) [![Coverage Status](https://coveralls.io/repos/astropnp/sml/badge.png)](https://coveralls.io/r/astropnp/sml) \endcond
55

6-
SML (Simple Mathematics Library) is a C++ (template) library that provides basic mathematics functionality. It's intended to be lightweight and simple to use in other projects. A CMake module is available to make it easy to include SML in other CMake-based projects: [FindSML.cmake](https://github.com/astropnp/cmake-modules/Modules/FindSML.cmake).
6+
`SML` (Simple Mathematics Library) is a C++ (template) library that provides basic mathematics functionality. The library intended to be lightweight and simple to use in other projects. A CMake module is available to make it easy to include `SML` in other CMake-based projects: [FindSML.cmake](https://github.com/astropnp/cmake-modules/Modules/FindSML.cmake).
77

88
Features
99
------
@@ -25,7 +25,7 @@ To install this project, please ensure that you have installed the following (in
2525
- [Gcov](https://gcc.gnu.org/onlinedocs/gcc/Gcov.html) (optional)
2626
- [LCOV](http://ltp.sourceforge.net/coverage/lcov.php) (optional)
2727

28-
SML does not depend on any libraries. The following libraries are optional (see `Build options`):
28+
`SML` does not depend on any libraries. The following libraries are optional (see `Build options`):
2929

3030
- [CATCH](https://www.github.com/philsquared/Catch) (unit testing library necessary for `BUILD_TESTS` option)
3131
- [Eigen](http://eigen.tuxfamily.org/) (linear algebra library necessary for `BUILD_TESTS_WITH_EIGEN` option)
@@ -66,12 +66,31 @@ The following commands are conditional and can only be set if `BUILD_TESTS = ON`
6666

6767
Pass these options either directly to the `cmake ..` build command or run `ccmake ..` instead to bring up the interface that can be used to toggle options.
6868

69+
Project structure
70+
-------------
71+
72+
This project has been set up with a specific file/folder structure in mind. The following describes some important features of this setup:
73+
74+
- `cmake/Modules` : Contains `CMake` modules, including `FindCppProject.cmake` template for project-specific module.
75+
- `docs`: Contains project-specific docs in [Markdown](https://help.github.com/articles/github-flavored-markdown/ "GitHub Flavored Markdown") that are also parsed by [Doxygen](http://www.doxygen.org "Doxygen homepage"). This sub-directory includes `global_todo.md`, which contains a global list of TODO items for project that appear on TODO list generated in [Doxygen](http://www.doxygen.org "Doxygen homepage") documentation
76+
- `doxydocs`: HTML output generated by building [Doxygen](http://www.doxygen.org "Doxygen homepage") documentation
77+
- `include/CppProject`: Project header files (*.hpp)
78+
- `scripts`: Shell scripts used in [Travis CI](https://travis-ci.org/ "Travis CI homepage") build
79+
- `test`: Project test source files (*.cpp), including `testCppProject.cpp`, which contains include for [Catch](https://www.github.com/philsquared/Catch "Catch Github repository")
80+
- `.travis.yml`: Configuration file for [Travis CI](https://travis-ci.org/ "Travis CI homepage") build, including static analysis using [Coverity Scan](https://scan.coverity.com/ "Coverity Scan homepage") and code coverage using [Coveralls](https://coveralls.io "Coveralls.io homepage")
81+
- `CMakeLists.txt`: main `CMakelists.txt` file for project (should not need to be modified for basic build)
82+
- `Dependencies.cmake`: list of dependencies and automated build, triggered if dependency cannot be found locally
83+
- `Doxyfile.in`: [Doxygen](http://www.doxygen.org "Doxygen homepage") configuration file, adapted for generic use within project build (should not need to be modified)
84+
- `LICENSE.md`: license file for project (copyright statement needs to be edited)
85+
- `ProjectFiles.cmake`: list of project source files to build
86+
- `README.md`: project readme file, parsed as main page for [Doxygen](http://www.doxygen.org "Doxygen homepage") documentation
87+
6988
Contributing
7089
------------
7190

7291
Once you've made your great commits:
7392

74-
1. [Fork](https://github.com/astropnp/sml/fork) SML
93+
1. [Fork](https://github.com/astropnp/sml/fork) `SML`
7594
2. Create a topic branch - `git checkout -b my_branch`
7695
3. Push to your branch - `git push origin my_branch`
7796
4. Create a [Pull Request](http://help.github.com/pull-requests/) from your branch
@@ -80,4 +99,4 @@ Once you've made your great commits:
8099
Disclaimer
81100
------
82101

83-
The copyright holders are not liable for any damage(s) incurred due to improper use of SML.
102+
The copyright holders are not liable for any damage(s) incurred due to improper use of `SML`.

docs/global_todo.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ Global Todo
22
=======
33

44
@todo Find a way to provide an option to clean installation.
5-
@todo Extend test suite
6-
@todo Figure out better way (avoiding code duplication) to build STL-based and Eigen-based tests in the same build tree
5+
@todo Extend test suite.
6+
@todo Figure out better way (avoiding code duplication) to build STL-based and Eigen-based tests in the same build tree.
77
@todo Add version detection in CMake module so that find_package respects minimum version required.
8+
@todo Find a way to remove \cond \endcond workaround to get Doxygen to not throw warnings in readme.
9+
@todo Find a way to have nested variables in `Doxygen` config file so that e.g., `@@CMAKE_PROJECT_NAME@_VERSION@` works.
10+
@todo Add version detection in `CMake` module so that find_package respects minimum version required.

scripts/check_doxygen_output.sh renamed to scripts/check_doxygen.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Copyright (c) 2014-2016 Kartik Kumar, Dinamica Srl ([email protected])
2+
# Copyright (c) 2014-2016 Kartik Kumar ([email protected])
33
# Distributed under the MIT License.
44
# See accompanying file LICENSE.md or copy at http://opensource.org/licenses/MIT
55

scripts/install_cmake.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
# Copyright (c) 2014-2016 Kartik Kumar ([email protected])
3+
# Distributed under the MIT License.
4+
# See accompanying file LICENSE.md or copy at http://opensource.org/licenses/MIT
5+
6+
set -ev
7+
8+
# Fetch and build updated version of CMake from source.
9+
# Check to see if CMake folder is empty.
10+
wget https://cmake.org/files/v3.4/cmake-3.4.1-Linux-x86_64.tar.gz --no-check-certificate
11+
tar -xzvf cmake-3.4.1-Linux-x86_64.tar.gz
12+
mv cmake-3.4.1-Linux-x86_64 $HOME/cmake

scripts/install_doxygen.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
# Copyright (c) 2014-2016 Kartik Kumar ([email protected])
3+
# Distributed under the MIT License.
4+
# See accompanying file LICENSE.md or copy at http://opensource.org/licenses/MIT
5+
6+
set -ev
7+
8+
# Fetch and build updated version of Doxygen from source.
9+
wget http://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.11.linux.bin.tar.gz
10+
tar -xzvf doxygen-1.8.11.linux.bin.tar.gz
11+
mv doxygen-1.8.11 $HOME/doxygen

scripts/update_doxygen.sh

-16
This file was deleted.

0 commit comments

Comments
 (0)