Skip to content

Commit 771277a

Browse files
authored
Merge pull request #1 from rigtorp/dev
Update to modern cmake layout
2 parents 48914e5 + de190c9 commit 771277a

File tree

6 files changed

+112
-30
lines changed

6 files changed

+112
-30
lines changed

.travis.yml

Lines changed: 91 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,101 @@ language: cpp
22

33
sudo: false
44

5-
addons:
6-
apt:
7-
sources:
8-
- ubuntu-toolchain-r-test
9-
- llvm-toolchain-precise-3.7
10-
- george-edison55-precise-backports
11-
packages:
12-
- gcc-5
13-
- g++-5
14-
- clang-3.7
15-
- cmake
16-
- cmake-data
17-
- libsparsehash-dev
18-
195
matrix:
206
include:
21-
- os: linux
22-
compiler: gcc
23-
env: CCC=gcc-5 CCXX=g++-5
24-
- os: linux
7+
8+
# clang-4
9+
- env: COMPILER=clang++-4.0
10+
compiler: clang
11+
os: linux
12+
addons:
13+
apt:
14+
packages:
15+
- clang-4.0
16+
- libstdc++-6-dev
17+
- libsparsehash-dev
18+
sources:
19+
- ubuntu-toolchain-r-test
20+
- llvm-toolchain-trusty-4.0
21+
22+
# clang-5
23+
- env: COMPILER=clang++-5.0
24+
compiler: clang
25+
os: linux
26+
addons:
27+
apt:
28+
packages:
29+
- clang-5.0
30+
- libstdc++-7-dev
31+
- libsparsehash-dev
32+
sources:
33+
- ubuntu-toolchain-r-test
34+
- llvm-toolchain-trusty-5.0
35+
36+
# clang-6
37+
- env: COMPILER=clang++-6.0
2538
compiler: clang
26-
env: CCC=clang-3.7 CCXX=clang++-3.7
27-
39+
os: linux
40+
addons:
41+
apt:
42+
packages:
43+
- clang-6.0
44+
- libstdc++-7-dev
45+
- libsparsehash-dev
46+
sources:
47+
- ubuntu-toolchain-r-test
48+
- llvm-toolchain-trusty-6.0
49+
50+
# gcc-5
51+
- env: COMPILER=g++-5
52+
compiler: gcc
53+
os: linux
54+
addons:
55+
apt:
56+
packages:
57+
- g++-5
58+
- libsparsehash-dev
59+
sources:
60+
- ubuntu-toolchain-r-test
61+
62+
# gcc-6
63+
- env: COMPILER=g++-6
64+
compiler: gcc
65+
os: linux
66+
addons:
67+
apt:
68+
packages:
69+
- g++-6
70+
- libsparsehash-dev
71+
sources:
72+
- ubuntu-toolchain-r-test
73+
74+
# gcc-7
75+
- env: COMPILER=g++-7
76+
compiler: gcc
77+
os: linux
78+
addons:
79+
apt:
80+
packages:
81+
- g++-7
82+
- libsparsehash-dev
83+
sources:
84+
- ubuntu-toolchain-r-test
85+
86+
# gcc-8
87+
- env: COMPILER=g++-8
88+
compiler: gcc
89+
os: linux
90+
addons:
91+
apt:
92+
packages:
93+
- g++-8
94+
- libsparsehash-dev
95+
sources:
96+
- ubuntu-toolchain-r-test
97+
2898
before_script:
29-
- export CC=$CCC CXX=$CCXX
99+
- export CXX=$COMPILER
30100
- mkdir build
31101
- cd build
32102
- cmake --version

CMakeLists.txt

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
cmake_minimum_required(VERSION 3.2)
2-
project(HashMap)
2+
project(HashMap CXX)
33

44
set(CMAKE_EXPORT_COMPILE_COMMANDS "true")
5-
set(CMAKE_CXX_FLAGS "-std=c++14 -Wall -Wextra -pedantic -g")
5+
set(CMAKE_CXX_STANDARD 14)
66

7-
add_executable(HashMapBenchmark HashMapBenchmark.cpp)
8-
add_executable(HashMapExample HashMapExample.cpp)
9-
add_executable(HashMapTest HashMapTest.cpp)
7+
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
8+
9+
add_library(HashMap INTERFACE)
10+
target_include_directories(HashMap INTERFACE
11+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
12+
$<INSTALL_INTERFACE:include>)
13+
14+
add_executable(HashMapBenchmark src/HashMapBenchmark.cpp)
15+
target_link_libraries(HashMapBenchmark HashMap)
16+
17+
add_executable(HashMapExample src/HashMapExample.cpp)
18+
target_link_libraries(HashMapExample HashMap)
19+
20+
add_executable(HashMapTest src/HashMapTest.cpp)
21+
target_link_libraries(HashMapTest HashMap)
1022

1123
enable_testing()
1224
add_test(HashMapTest HashMapTest)
File renamed without changes.

HashMapBenchmark.cpp renamed to src/HashMapBenchmark.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2020
SOFTWARE.
2121
*/
2222

23-
#include "HashMap.h"
2423
#include <chrono>
2524
#include <google/dense_hash_map>
2625
#include <iostream>
2726
#include <random>
27+
#include <rigtorp/HashMap.h>
2828
#include <unordered_map>
2929

3030
using namespace rigtorp;
@@ -36,7 +36,7 @@ int main(int argc, char *argv[]) {
3636
constexpr size_t count = 1000;
3737
constexpr size_t iters = 100000000;
3838

39-
auto b = [count, iters](const char *n, auto &m) {
39+
auto b = [](const char *n, auto &m) {
4040
std::mt19937 mt;
4141
std::uniform_int_distribution<int> ud(2, count);
4242

HashMapExample.cpp renamed to src/HashMapExample.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#include "HashMap.h"
21
#include <iostream>
2+
#include <rigtorp/HashMap.h>
33

44
int main(int argc, char *argv[]) {
55
(void)argc, (void)argv;

HashMapTest.cpp renamed to src/HashMapTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2020
SOFTWARE.
2121
*/
2222

23-
#include "HashMap.h"
2423
#include <algorithm>
2524
#include <array>
25+
#include <rigtorp/HashMap.h>
2626

2727
using namespace rigtorp;
2828

0 commit comments

Comments
 (0)