Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
272 commits
Select commit Hold shift + click to select a range
5321f79
Create lib.txt
reinout91 Sep 14, 2020
1ff1eda
Update cookiecutter.json
reinout91 Sep 14, 2020
a14c7f3
Create tools.h
reinout91 Sep 14, 2020
016042c
Create tools.cpp
reinout91 Sep 14, 2020
ed866c5
Update CMakeLists.txt
reinout91 Sep 14, 2020
09ecd19
Create CMakeLists.txt
reinout91 Sep 14, 2020
76db9ad
Update tools.h
reinout91 Sep 14, 2020
c7dceda
Update tools.cpp
reinout91 Sep 14, 2020
3b546dd
Update tools.cpp
reinout91 Sep 14, 2020
7d10393
Update tools.cpp
reinout91 Sep 14, 2020
79d865d
Update main.cpp
reinout91 Sep 14, 2020
1cb43e9
Update CMakeLists.txt
reinout91 Sep 14, 2020
61a40c1
Create testBlah.cpp
reinout91 Sep 14, 2020
2de8aee
Update tools.cpp
reinout91 Sep 14, 2020
a259220
Update main.cpp
reinout91 Sep 14, 2020
b80bbbb
Update tools.cpp
reinout91 Sep 14, 2020
5abcc15
Update main.cpp
reinout91 Sep 14, 2020
e9fa88c
Update and rename testBlah.cpp to testSum.cpp
reinout91 Sep 14, 2020
9d6327b
Update and rename testSum.cpp to testTools.cpp
reinout91 Sep 14, 2020
62db99e
Update and rename tools.cpp to utils.cpp
reinout91 Sep 14, 2020
7d2366b
Update and rename tools.h to utils.h
reinout91 Sep 14, 2020
ae2bb64
Update and rename testTools.cpp to testUtils.cpp
reinout91 Sep 14, 2020
237a5e8
Update CMakeLists.txt
reinout91 Sep 14, 2020
b9fc08a
Update CMakeLists.txt
reinout91 Sep 14, 2020
b1d8b98
Update utils.cpp
reinout91 Sep 14, 2020
37b8573
Rename utils.cpp to {{cookiecutter.repo_name}}_utils.cpp
reinout91 Sep 14, 2020
cf48027
Rename utils.h to {{cookiecutter.repo_name}}_utils.h
reinout91 Sep 14, 2020
28b1cf5
Update CMakeLists.txt
reinout91 Sep 14, 2020
43edd3c
Update and rename testUtils.cpp to test{{cookiecutter.repo_name}}_uti…
reinout91 Sep 14, 2020
454e259
Update CMakeLists.txt
reinout91 Sep 14, 2020
b9e8643
Update CMakeLists.txt
reinout91 Sep 15, 2020
b92cd63
Update {{cookiecutter.repo_name}}_utils.cpp
reinout91 Sep 15, 2020
6952cc7
Update CMakeLists.txt
reinout91 Sep 15, 2020
6dcee21
Update {{cookiecutter.repo_name}}_utils.h
reinout91 Sep 15, 2020
e3859eb
Update main.cpp
reinout91 Sep 15, 2020
2ebe5fc
Update CMakeLists.txt
reinout91 Sep 15, 2020
2c1b3a8
Update main.cpp
reinout91 Sep 15, 2020
29eeef7
Update {{cookiecutter.repo_name}}_utils.h
reinout91 Sep 15, 2020
7db5c72
Update CMakeLists.txt
reinout91 Sep 15, 2020
9355cd9
Update CMakeLists.txt
reinout91 Sep 15, 2020
c53cd73
Update CMakeLists.txt
reinout91 Sep 15, 2020
b8a7abc
Update main.cpp
reinout91 Sep 15, 2020
b75717e
Update README.md
reinout91 Sep 15, 2020
8b8df88
Update README.md
reinout91 Sep 15, 2020
72a14c4
Update README.md
reinout91 Sep 15, 2020
595d417
Update README.md
reinout91 Sep 15, 2020
45b079b
Update README.md
reinout91 Sep 15, 2020
b7306cc
Update README.md
reinout91 Sep 15, 2020
bd0b5ed
Add packagemanager manager
reinout91 Sep 16, 2020
c07717f
Update CMakeLists.txt
reinout91 Sep 16, 2020
e29f190
Update README.md
reinout91 Sep 16, 2020
92cdb7a
Update README.md
reinout91 Sep 16, 2020
d6f6012
Update README.md
reinout91 Sep 16, 2020
9dc5337
Update CMakeLists.txt
reinout91 Sep 16, 2020
b18e0a6
Update CMakeLists.txt
reinout91 Sep 16, 2020
0aa33fc
Update CMakeLists.txt
reinout91 Sep 16, 2020
21edc2a
Update main.cpp
reinout91 Sep 16, 2020
7b8a298
Update main.cpp
reinout91 Sep 16, 2020
dd7b412
Update main.cpp
reinout91 Sep 16, 2020
364e04e
Update main.cpp
reinout91 Sep 16, 2020
001cde1
Update main.cpp
reinout91 Sep 16, 2020
fad8eb4
Update README.md
reinout91 Sep 16, 2020
9c32e0a
Update CMakeLists.txt
reinout91 Sep 16, 2020
1bb63b3
Update CMakeLists.txt
reinout91 Sep 16, 2020
6da55f6
Update CMakeLists.txt
reinout91 Sep 16, 2020
6fb2f01
Update CMakeLists.txt
reinout91 Sep 16, 2020
05dacab
Update CMakeLists.txt
reinout91 Sep 16, 2020
6137cb7
Update CMakeLists.txt
reinout91 Sep 16, 2020
00e1e6e
Update CMakeLists.txt
reinout91 Sep 16, 2020
a183b46
Update CMakeLists.txt
reinout91 Sep 16, 2020
d98b165
Update main.cpp
reinout91 Sep 16, 2020
0d6e09e
Update main.cpp
reinout91 Sep 16, 2020
cb38dd1
Update README.md
reinout91 Sep 16, 2020
23f96eb
Update README.md
reinout91 Sep 16, 2020
b239d96
Update README.md
reinout91 Sep 16, 2020
f1722d7
Update CMakeLists.txt
reinout91 Sep 19, 2020
fda08a1
Update main.cpp
reinout91 Sep 19, 2020
e54f90f
Update CMakeLists.txt
reinout91 Sep 19, 2020
19311c0
Update main.cpp
reinout91 Sep 19, 2020
4592076
Update CMakeLists.txt
reinout91 Sep 19, 2020
b928e96
Update CMakeLists.txt
reinout91 Sep 19, 2020
459a131
Update README.md
reinout91 Sep 20, 2020
ba1b4da
update
reinout91 Sep 20, 2020
f7b6159
Update CMakeLists.txt
reinout91 Sep 20, 2020
ab7b534
changing to better cmake style - pending
reinout91 Sep 20, 2020
32e273b
Update CMakeLists.txt
reinout91 Sep 20, 2020
e40f4cb
Update CMakeLists.txt
reinout91 Sep 20, 2020
fc58a47
Update CMakeLists.txt
reinout91 Sep 20, 2020
e5267da
Update CMakeLists.txt
reinout91 Sep 20, 2020
d55550b
Update CMakeLists.txt
reinout91 Sep 20, 2020
41408ff
Update CMakeLists.txt
reinout91 Sep 20, 2020
0e365aa
Update CMakeLists.txt
reinout91 Sep 20, 2020
8dcb2f5
Update CMakeLists.txt
reinout91 Sep 20, 2020
a638aa3
Update CMakeLists.txt
reinout91 Sep 20, 2020
de10851
Update CMakeLists.txt
reinout91 Sep 20, 2020
56ec027
Update CMakeLists.txt
reinout91 Sep 20, 2020
7c18bf5
Update CMakeLists.txt
reinout91 Sep 20, 2020
700dc56
Update CMakeLists.txt
reinout91 Sep 20, 2020
902161b
Update CMakeLists.txt
reinout91 Sep 20, 2020
375394d
Update CMakeLists.txt
reinout91 Sep 20, 2020
a8f5bd5
Update CMakeLists.txt
reinout91 Sep 20, 2020
8c87ebc
Update CMakeLists.txt
reinout91 Sep 20, 2020
d76d016
Update CMakeLists.txt
reinout91 Sep 20, 2020
d98686a
Update CMakeLists.txt
reinout91 Sep 20, 2020
4cf0637
Update CMakeLists.txt
reinout91 Sep 20, 2020
9bb49a7
Update CMakeLists.txt
reinout91 Sep 20, 2020
88758bb
Update CMakeLists.txt
reinout91 Sep 20, 2020
e5bd26e
Update CMakeLists.txt
reinout91 Sep 20, 2020
c83b34f
Update CMakeLists.txt
reinout91 Sep 20, 2020
e9c1085
Update CMakeLists.txt
reinout91 Sep 20, 2020
61c957a
Update CMakeLists.txt
reinout91 Sep 20, 2020
3c28ff2
Update CMakeLists.txt
reinout91 Sep 20, 2020
5daaa1f
Update CMakeLists.txt
reinout91 Sep 20, 2020
694c3c3
Update CMakeLists.txt
reinout91 Sep 20, 2020
bce76cc
Update CMakeLists.txt
reinout91 Sep 20, 2020
3310002
Update CMakeLists.txt
reinout91 Sep 20, 2020
ace3326
Update CMakeLists.txt
reinout91 Sep 20, 2020
d83649e
Update CMakeLists.txt
reinout91 Sep 20, 2020
81fbf8b
Update CMakeLists.txt
reinout91 Sep 20, 2020
f3adbd8
Update CMakeLists.txt
reinout91 Sep 20, 2020
c03497d
Update CMakeLists.txt
reinout91 Sep 20, 2020
01ba382
Update CMakeLists.txt
reinout91 Sep 20, 2020
2ede19f
Update CMakeLists.txt
reinout91 Sep 20, 2020
53a0d71
Update CMakeLists.txt
reinout91 Sep 20, 2020
cdf8f56
Update CMakeLists.txt
reinout91 Sep 20, 2020
edf1d19
Update CMakeLists.txt
reinout91 Sep 20, 2020
97fd9c2
Update CMakeLists.txt
reinout91 Sep 20, 2020
5024402
Update CMakeLists.txt
reinout91 Sep 20, 2020
9ee877a
Update CMakeLists.txt
reinout91 Sep 20, 2020
914c49d
Update CMakeLists.txt
reinout91 Sep 20, 2020
2151538
Update CMakeLists.txt
reinout91 Sep 20, 2020
55671ff
Update CMakeLists.txt
reinout91 Sep 20, 2020
4d9e7e9
Update CMakeLists.txt
reinout91 Sep 20, 2020
39f1aec
Rename main.cpp to {{ cookiecutter.project_name }}.cpp
reinout91 Sep 20, 2020
05d3e11
Update CMakeLists.txt
reinout91 Sep 20, 2020
d6544bf
Update CMakeLists.txt
reinout91 Sep 20, 2020
08ecc35
Update CMakeLists.txt
reinout91 Sep 20, 2020
488949a
Update CMakeLists.txt
reinout91 Sep 20, 2020
18f3014
Update CMakeLists.txt
reinout91 Sep 20, 2020
ffde76d
Update CMakeLists.txt
reinout91 Sep 21, 2020
3ccfae1
Update CMakeLists.txt
reinout91 Sep 21, 2020
96799fe
Update CMakeLists.txt
reinout91 Sep 21, 2020
3c575f6
Update CMakeLists.txt
reinout91 Sep 21, 2020
c023a93
Update CMakeLists.txt
reinout91 Sep 21, 2020
03c43b3
Update CMakeLists.txt
reinout91 Sep 21, 2020
b805dd7
Update CMakeLists.txt
reinout91 Sep 21, 2020
23d9997
Update CMakeLists.txt
reinout91 Sep 21, 2020
94d06d6
Update {{ cookiecutter.project_name }}.cpp
reinout91 Sep 21, 2020
9bae891
Update CMakeLists.txt
reinout91 Sep 21, 2020
fd965de
Update CMakeLists.txt
reinout91 Sep 21, 2020
529be9a
Update CMakeLists.txt
reinout91 Sep 21, 2020
04c215d
Update CMakeLists.txt
reinout91 Sep 21, 2020
9f9fcc5
test dit maar eventjes
reinout91 Sep 21, 2020
793334e
Update CMakeLists.txt
reinout91 Sep 21, 2020
d950303
Update CMakeLists.txt
reinout91 Sep 21, 2020
8e4b00c
Update CMakeLists.txt
reinout91 Sep 23, 2020
62f171d
Update CMakeLists.txt
reinout91 Sep 23, 2020
d9e5f2b
Update CMakeLists.txt
reinout91 Sep 23, 2020
721ce27
Update CMakeLists.txt
reinout91 Sep 23, 2020
2c39c9d
Update {{cookiecutter.repo_name}}_utils.cpp
reinout91 Sep 23, 2020
6f25e6d
Rename {{cookiecutter.repo_name}}_utils.cpp to {{cookiecutter.repo_na…
reinout91 Sep 23, 2020
1b60cbe
Rename {{cookiecutter.repo_name}}_utils.h to {{cookiecutter.repo_name…
reinout91 Sep 23, 2020
f772067
Update {{ cookiecutter.project_name }}.cpp
reinout91 Sep 23, 2020
d277b8b
Update test{{cookiecutter.repo_name}}_utils.cpp
reinout91 Sep 23, 2020
7160290
Update {{ cookiecutter.project_name }}.cpp
reinout91 Sep 23, 2020
b64bc4b
Update CMakeLists.txt
reinout91 Sep 23, 2020
17ab253
Update CMakeLists.txt
reinout91 Sep 23, 2020
9fb1906
Update CMakeLists.txt
reinout91 Sep 23, 2020
9b9f87d
Update README.md
reinout91 Sep 23, 2020
e3e8a75
Update README.md
reinout91 Sep 23, 2020
e596878
Update README.md
reinout91 Sep 23, 2020
c71cd4f
Update README.md
reinout91 Sep 23, 2020
9594604
Update CMakeLists.txt
reinout91 Sep 23, 2020
d2d3bdc
Update CMakeLists.txt
reinout91 Sep 23, 2020
29c9800
Update CMakeLists.txt
reinout91 Sep 23, 2020
b281b06
Update CMakeLists.txt
reinout91 Sep 24, 2020
ef826f1
Update CMakeLists.txt
reinout91 Sep 24, 2020
894a18a
Update CMakeLists.txt
reinout91 Sep 24, 2020
c43d354
Update CMakeLists.txt
reinout91 Sep 24, 2020
1e57c6b
Update CMakeLists.txt
reinout91 Sep 24, 2020
7d8b411
Update README.md
reinout91 Sep 24, 2020
0972ca2
Update post_gen_project.py
reinout91 Sep 25, 2020
6249b60
Update post_gen_project.py
reinout91 Sep 25, 2020
fa3f9dc
Update post_gen_project.py
reinout91 Sep 25, 2020
63b4560
Update post_gen_project.py
reinout91 Sep 25, 2020
d7848e0
Update CMakeLists.txt
reinout91 Sep 25, 2020
aa5a8fc
Update CMakeLists.txt
reinout91 Sep 26, 2020
3c6df47
Update CMakeLists.txt
reinout91 Sep 26, 2020
e15dded
Update CMakeLists.txt
reinout91 Sep 26, 2020
1361cba
Update CMakeLists.txt
reinout91 Sep 26, 2020
a1a223a
Update CMakeLists.txt
reinout91 Sep 26, 2020
630e445
Update CMakeLists.txt
reinout91 Sep 26, 2020
ef6b0d5
Update CMakeLists.txt
reinout91 Sep 26, 2020
b09e6ce
Update README.md
reinout91 Sep 26, 2020
6dd916d
Update README.md
reinout91 Sep 26, 2020
5f24b0b
Update CMakeLists.txt
reinout91 Sep 26, 2020
2ebca0d
try with linked armadillo
reinout91 Sep 26, 2020
e7940c6
Update CMakeLists.txt
reinout91 Sep 26, 2020
101af4b
Update CMakeLists.txt
reinout91 Sep 26, 2020
4705c1c
Update CMakeLists.txt
reinout91 Sep 26, 2020
73279b7
Update CMakeLists.txt
reinout91 Sep 26, 2020
1409f44
Update CMakeLists.txt
reinout91 Sep 26, 2020
21f0a1b
Update CMakeLists.txt
reinout91 Sep 26, 2020
05365bd
Update CMakeLists.txt
reinout91 Sep 26, 2020
f166e35
Update CMakeLists.txt
reinout91 Sep 26, 2020
6933997
Update CMakeLists.txt
reinout91 Oct 15, 2020
b60e47a
Update CMakeLists.txt
reinout91 Oct 15, 2020
68bc755
Update CMakeLists.txt
reinout91 Oct 15, 2020
8041f7d
Update {{ cookiecutter.project_name }}.cpp
reinout91 Oct 15, 2020
380c35f
Update CMakeLists.txt
reinout91 Oct 15, 2020
bcc23d4
Update CMakeLists.txt
reinout91 Oct 15, 2020
770c60f
Update CMakeLists.txt
reinout91 Oct 15, 2020
1c285d2
Update CMakeLists.txt
reinout91 Oct 15, 2020
d2f9655
Update CMakeLists.txt
reinout91 Oct 15, 2020
c98b255
Update {{ cookiecutter.project_name }}.cpp
reinout91 Oct 15, 2020
e1b32f2
Update {{ cookiecutter.project_name }}.cpp
reinout91 Oct 15, 2020
91d73c3
Update CMakeLists.txt
reinout91 Oct 15, 2020
03b38f3
Update CMakeLists.txt
reinout91 Oct 15, 2020
8d72a0a
Update CMakeLists.txt
reinout91 Oct 15, 2020
13f495e
Update CMakeLists.txt
reinout91 Oct 15, 2020
8daca9a
Update CMakeLists.txt
reinout91 Oct 15, 2020
8324595
Update {{ cookiecutter.project_name }}.cpp
reinout91 Oct 15, 2020
fa6f43b
Update CMakeLists.txt
reinout91 Oct 15, 2020
ad50f37
Update {{ cookiecutter.project_name }}.cpp
reinout91 Oct 15, 2020
38d6641
Update CMakeLists.txt
reinout91 Oct 15, 2020
0e05cda
Update {{ cookiecutter.project_name }}.cpp
reinout91 Oct 15, 2020
3dd81eb
Update {{ cookiecutter.project_name }}.cpp
reinout91 Oct 15, 2020
d7626ad
Update README.md
reinout91 Oct 15, 2020
150ecae
Update README.md
reinout91 Oct 15, 2020
74abe69
Update README.md
reinout91 Oct 15, 2020
a1b5d6c
Update README.md
reinout91 Oct 15, 2020
761057e
Update README.md
reinout91 Oct 15, 2020
465a68e
Update README.md
reinout91 Oct 15, 2020
a66adbf
Delete README.md
reinout91 Oct 15, 2020
c8fdb9b
Delete lib.txt
reinout91 Oct 15, 2020
10ffb60
Delete bin.txt
reinout91 Oct 15, 2020
7810419
Update README.md
reinout91 Oct 15, 2020
ef34438
Update README.md
reinout91 Oct 15, 2020
db30496
Update gtest.cmake
reinout91 Oct 15, 2020
98f0480
Update gtest.cmake
reinout91 Oct 15, 2020
ccbf50a
Update CMakeLists.txt
reinout91 Oct 15, 2020
42651ba
FIXED googletest issues due to update to new version
reinout91 Oct 15, 2020
491023b
Update README.md
reinout91 Oct 15, 2020
9198649
Update README.md
reinout91 Jan 3, 2021
1cdd529
Update README.md
reinout91 Jan 3, 2021
c6be71c
Update README.md
reinout91 Feb 18, 2021
4b35ff8
add lb
reinout91 Jun 10, 2026
36bc5ee
remove lb
reinout91 Jun 10, 2026
1d4f835
add two lbs
reinout91 Jun 10, 2026
b6a88ff
add lb again
reinout91 Jun 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 46 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,54 @@
cookiecutter-cpp
================

A test-driven C++ project template built on CMake and GoogleTest

[![Build Status]
(https://travis-ci.org/hbristow/cookiecutter-cpp.svg)]
(https://travis-ci.org/hbristow/cookiecutter-cpp)

Usage:

A test-driven C++ project template built on CMake and GoogleTest, that uses Armadillo as an example.

CMake is a fast and easy build tool.
Use of GoogleTest test ensures robust code.
Doxygen enables documentation.
pmm is a package manager manager. You can configure your project to use Conan or VCPKG. This may become more important for cross platform development.

This template was made by combining:
Original Cookicutter project: https://github.com/hbristow/cookiecutter-cpp
A lecture of Igor Bogoslavskyi: https://www.youtube.com/watch?v=q8xO2eJijy4&list=PLgnQpQtFTOGR50iIOtO36nK6aNPtVq98C&index=4
Boilerplate pmm project: https://github.com/ariveron/boilerplate-pmm-vcpkg-cmake
CMake Example: https://github.com/dev-cafe/cmake-cookbook/blob/master/chapter-10/recipe-01/cxx-example/CMakeLists.txt


Note: currently the Vcpkg version of Armadillo is not compiled using any wrappers. Therefore they must be explicitly disabled in the scripts that use them. Vcpkg versions of OpenBLAS and LAPACK are linked explicitly.

```cpp
#define ARMA_DONT_USE_WRAPPER
#define ARMA_DONT_USE_BLAS
#define ARMA_DONT_USE_LAPACK
//#define ARMA_USE_BLAS
#include <armadillo> //system wide installed package.
```

Linux:
------

$ pip install cookiecutter
$ cookiecutter gh:reinout91/cookiecutter-cpp
$ cd {project dir}/build
$ cmake ..
$ make
$ ctest -vv
$ ../bin/main
$ make install

Windows: (TESTS DON'T COMPILE YET!)
------
note: add C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin (or similar) to PATH (edit environment settings)

$ pip install cookiecutter
$ cookiecutter gh:hbristow/cookiecutter-cpp
$ python -m cookiecutter gh:reinout91/cookiecutter-cpp
$ cd {project dir}/build
$ cmake ..
$ MSBuild.exe {project name}.sln /property:Configuration=Debug

This template was tested on Windows (using msvc compiler) and Linux (using clang)

2 changes: 1 addition & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"check_style": true,
"pedantic": true,
"version": "0.0.1",
"year": 2015,
"year": 2020,
"author": "First Last",
"email": "{{ cookiecutter.author.split()|join('.')|lower }}@gmail.com",
"username": "{{ cookiecutter.author|first|lower }}{{ cookiecutter.author.split()|last|lower }}",
Expand Down
8 changes: 7 additions & 1 deletion hooks/post_gen_project.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Post-project generation hooks"""
import os
import shutil

if __name__ == '__main__':
"""Initialize a git repository based on the configured branch and repo"""
Expand All @@ -10,4 +12,8 @@
subprocess.call(('git', 'init'))
subprocess.call(('git', 'checkout', '-b', branch))
subprocess.call(('git', 'remote', 'add', remote, url))
subprocess.call(('mv', 'pre-commit', '.git/hooks/'))
if os.name == 'nt':
shutil.move('pre-commit', '.git\\hooks')
else:
subprocess.call(('mv', 'pre-commit', '.git/hooks/'))

125 changes: 111 additions & 14 deletions {{cookiecutter.repo_name}}/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,125 @@

# {{ cookiecutter.project_name }}
# {{ cookiecutter.description }}
# Copyright {{ cookiecutter.year }}, {{ cookiecutter.author }}
cmake_minimum_required(VERSION 3.1)
project({{ cookiecutter.project_name }} C CXX)
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)

# Can be useful for vim?
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Project
project({{cookiecutter.project_name}} C CXX)
project({{cookiecutter.repo_name}} VERSION {{ cookiecutter.version }} LANGUAGES CXX)
set(PROJECT_DESCRIPTION "{{ cookiecutter.description }}")
set(PROJECT_AUTHOR "{{ cookiecutter.author }}")
set(PROJECT_URL "https://github.com/{{ cookiecutter.username }}/{{ cookiecutter.repo_name }}")
set(PROJECT_VERSION_MAJOR "{{ cookiecutter.version.split('.')[0] }}")
set(PROJECT_VERSION_MINOR "{{ cookiecutter.version.split('.')[1] }}")
set(PROJECT_VERSION_PATCH "{{ cookiecutter.version.split('.')[2] }}")

# Build flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -march=native")
{% if cookiecutter.pedantic -%}
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -pedantic")
{%- endif %}
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()

set (CMAKE_CXX_STANDARD 14)

if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /utf-8")
else ()
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -march=native")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -pedantic")
endif ()

# Tell cmake to output binaries here:
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib) # Static link libraries
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin) # Executables
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib) # Dynamic link libraries

include(pmm.cmake)

# In the case of a Microsoft system, all packages should be installed by VCPKG, for UNIX systems, the user has to install the required packages using their system package manager.
# In Linux, when a broken VCPKG package is installed by VCPKG, it should be manually uninstalled. Otherwise build errors might occur.

set(BUILD_SHARED_LIBS=false)

if (MSVC)
set(PMM_PACKAGES fmt openblas lapack armadillo)
else ()
set(PMM_PACKAGES fmt openblas lapack armadillo)
#sudo apt-get install libarmadillo-dev (VCPKG version is broken)
endif ()
pmm(
# Use vcpkg
VCPKG
# Specify vcpkg branch, tag, or revision
REVISION master
# Space seperated list of required vcpkg packages
REQUIRES ${PMM_PACKAGES}
)

# Find required packages for project, these are the cmake targets reported by vcpkg.
find_package(fmt CONFIG REQUIRED)
find_package(LAPACK)
find_package(OpenBLAS CONFIG REQUIRED)
find_package(Armadillo REQUIRED)

#include_directories(${ARMADILLO_INCLUDE_DIRS})

# ---------------------------------------------------------
# Features
# ---------------------------------------------------------
add_subdirectory(external)
# Tell cmake where to look for *.h files.
include_directories(${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/src/{{cookiecutter.project_name}} )
# Outsource the actual processing to folders.
add_subdirectory(src)

enable_testing()
add_subdirectory(test)
# Must be in the top-most CMakeLists.txt file.
# testing
enable_testing ()
option ({{ cookiecutter.project_name|upper }}_BUILD_TESTS "Build test programs" ON)
if ({{ cookiecutter.project_name|upper }}_BUILD_TESTS)
add_subdirectory (test)
endif ()



add_subdirectory(doc)

# Prepare RPATH
if (NOT MSVC)
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local") #We don't want to install to the default /usr/local.
endif ()
file(RELATIVE_PATH _rel ${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR} ${CMAKE_INSTALL_PREFIX})
if(APPLE)
set(_rpath "@loader_path/${_rel}")
else()
set(_rpath "\$ORIGIN/${_rel}")
endif()
file(TO_NATIVE_PATH "${_rpath}/${INSTALL_LIBDIR}" message_RPATH)

set_target_properties({{cookiecutter.project_name}}
PROPERTIES
MACOSX_RPATH ON
SKIP_BUILD_RPATH OFF
BUILD_WITH_INSTALL_RPATH OFF
INSTALL_RPATH "${message_RPATH}"
INSTALL_RPATH_USE_LINK_PATH ON
)

# Here you can select the binaries and libraries that have to be installed to the system.
message(STATUS "Project will be installed to ${CMAKE_INSTALL_PREFIX}, admin rights may be required to make install")
install(
TARGETS
{{cookiecutter.repo_name}}Utils
{{cookiecutter.repo_name}}
ARCHIVE
DESTINATION ${INSTALL_LIBDIR}
COMPONENT ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
RUNTIME
DESTINATION ${INSTALL_BINDIR}
COMPONENT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
LIBRARY
DESTINATION ${INSTALL_LIBDIR}
COMPONENT ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
PUBLIC_HEADER
DESTINATION ${INSTALL_INCLUDEDIR}/tythUtils
COMPONENT dev
)
7 changes: 0 additions & 7 deletions {{cookiecutter.repo_name}}/README.md

This file was deleted.

12 changes: 6 additions & 6 deletions {{cookiecutter.repo_name}}/external/gtest.cmake
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# GoogleTest (gtest)
# A unit testing library for C/C++
# Creates a libgtest target packaged with the required include driectories
# Creates a libgtest target packaged with the required include directories
find_package(Threads REQUIRED)
include(ExternalProject)

# Fetch GoogleTest remotely
ExternalProject_Add(
gtest
URL https://googletest.googlecode.com/files/gtest-1.7.0.zip
URL_MD5 2d6ec8ccdf5c46b05ba54a9fd1d130d7
URL https://github.com/google/googletest/archive/release-1.10.0.zip
URL_MD5 82358affdd7ab94854c8ee73a180fc53
PREFIX ${CMAKE_CURRENT_BINARY_DIR}
# Disable INSTALL
INSTALL_COMMAND ""
Expand All @@ -18,9 +18,9 @@ add_dependencies(libgtest gtest)

# Setup the build tree and package the target
ExternalProject_Get_Property(gtest SOURCE_DIR BINARY_DIR)
file(MAKE_DIRECTORY ${SOURCE_DIR}/include)
file(MAKE_DIRECTORY ${SOURCE_DIR}/googletest/include)
set_target_properties(libgtest PROPERTIES
"IMPORTED_LOCATION" "${BINARY_DIR}/libgtest.a"
"IMPORTED_LOCATION" "${BINARY_DIR}/lib/libgtest.a"
"IMPORTED_LINK_INTERFACE_LIBRARIES" "${CMAKE_THREAD_LIBS_INIT}"
"INTERFACE_INCLUDE_DIRECTORIES" "${SOURCE_DIR}/include"
"INTERFACE_INCLUDE_DIRECTORIES" "${SOURCE_DIR}/googletest/include"
)
84 changes: 84 additions & 0 deletions {{cookiecutter.repo_name}}/pmm.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
## MIT License
##
## Copyright (c) 2019 vector-of-bool
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
## in the Software without restriction, including without limitation the rights
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
## copies of the Software, and to permit persons to whom the Software is
## furnished to do so, subject to the following conditions:
##
## The above copyright notice and this permission notice shall be included in all
## copies or substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
## AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
## SOFTWARE.

# Bump this version to change what PMM version is downloaded
set(PMM_VERSION_INIT 1.5.0)

# Helpful macro to set a variable if it isn't already set
macro(_pmm_set_if_undef varname)
if(NOT DEFINED "${varname}")
set("${varname}" "${ARGN}")
endif()
endmacro()

## Variables used by this script
# The version:
_pmm_set_if_undef(PMM_VERSION ${PMM_VERSION_INIT})
# The base URL we download PMM from:
_pmm_set_if_undef(PMM_URL_BASE "https://vector-of-bool.github.io/pmm")
# The real URL we download from (Based on the version)
_pmm_set_if_undef(PMM_URL "${PMM_URL_BASE}/${PMM_VERSION}")
# The directory where we store our downloaded files
_pmm_set_if_undef(PMM_DIR_BASE "${CMAKE_BINARY_DIR}/_pmm")
_pmm_set_if_undef(PMM_DIR "${PMM_DIR_BASE}/${PMM_VERSION}")
# The location of the current file
_pmm_set_if_undef(PMM_MODULE "${CMAKE_CURRENT_LIST_FILE}")

# The file that we first download
set(_PMM_ENTRY_FILE "${PMM_DIR}/entry.cmake")

# Guard against multiple processes trying to use the PMM dir simultaneously
file(LOCK "${PMM_DIR}/_init-pmm"
GUARD PROCESS
TIMEOUT 10
RESULT_VARIABLE _lock_res
)
if(NOT _lock_res STREQUAL "0")
message(WARNING "PMM entry didn't lock the directory ${PMM_DIR} successfully (${_lock_res}). We'll continue as best we can.")
set(_pmm_init_did_lock FALSE)
else()
set(_pmm_init_did_lock TRUE)
endif()

if(NOT EXISTS "${_PMM_ENTRY_FILE}" OR PMM_ALWAYS_DOWNLOAD)
file(
DOWNLOAD "${PMM_URL}/entry.cmake"
"${_PMM_ENTRY_FILE}.tmp"
STATUS pair
)
list(GET pair 0 rc)
list(GET pair 1 msg)
if (rc)
message(FATAL_ERROR "Failed to download PMM entry file: ${msg}")
endif ()
file(RENAME "${_PMM_ENTRY_FILE}.tmp" "${_PMM_ENTRY_FILE}")
endif()

# ^^^ DO NOT CHANGE THIS LINE vvv
set(_PMM_BOOTSTRAP_VERSION 3)
# ^^^ DO NOT CHANGE THIS LINE ^^^

include("${_PMM_ENTRY_FILE}")

if(_pmm_init_did_lock)
file(LOCK "${PMM_DIR}/_init-pmm" RELEASE)
endif()
11 changes: 1 addition & 10 deletions {{cookiecutter.repo_name}}/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
# Target: {{ cookiecutter.project_name }}_lib
# Type: Library
file(GLOB SOURCE *.cpp)
add_library({{ cookiecutter.project_name }}_lib SHARED ${SOURCE})
set_target_properties({{ cookiecutter.project_name }}_lib PROPERTIES
"OUTPUT_NAME" "{{ cookiecutter.project_name }}"
"INCLUDE_DIRECTORIES" "${CMAKE_CURRENT_SOURCE_DIR}/include"
)
install(TARGETS {{ cookiecutter.project_name }}_lib EXPORT {{ cookiecutter.project_name }} DESTINATION ${CMAKE_SOURCE_DIR}/lib)
export(TARGETS {{ cookiecutter.project_name }}_lib FILE ${CMAKE_BINARY_DIR}/{{ cookiecutter.project_name }}-config.cmake)
add_subdirectory({{cookiecutter.repo_name}})
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
add_library({{cookiecutter.repo_name}}Utils STATIC {{cookiecutter.repo_name}}Utils.cpp)
message(STATUS armalibs ${ARMADILLO_LIBRARIES})
add_executable({{cookiecutter.repo_name}} {{cookiecutter.repo_name}}.cpp)
set(DIRS fmt::fmt)
list(APPEND DIRS ${ARMADILLO_LIBRARIES})
#list(APPEND DIRS -LC:/external/armadillo-10.1.0/build/Debug/armadillo.lib)
list(APPEND DIRS {{cookiecutter.repo_name}}Utils)
list(APPEND DIRS LAPACK::LAPACK)
list(APPEND DIRS OpenBLAS::OpenBLAS)
target_link_libraries({{cookiecutter.repo_name}} ${DIRS})
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <iostream>
#include <{{ cookiecutter.project_name }}Utils.h>
#include <fmt/core.h> //packagemanager downloaded library.
#define ARMA_DONT_USE_WRAPPER
#define ARMA_DONT_USE_BLAS
#define ARMA_DONT_USE_LAPACK
//#define ARMA_USE_BLAS
#include <armadillo> //system wide installed package.

using namespace std;
using namespace arma;

int main()
{
auto message = fmt::format("The answer is {}", sum(1,2));
std::cout << message <<std::endl;
mat v = randu<mat>(3,3);
mat b = randu<mat>(3,3);
std::cout << v*b << std::endl;
return EXIT_SUCCESS;
}

Loading