File tree 15 files changed +136
-4
lines changed
15 files changed +136
-4
lines changed Original file line number Diff line number Diff line change
1
+ name : bazel
2
+
3
+ on :
4
+ push :
5
+
6
+ jobs :
7
+ bazel :
8
+ runs-on : ubuntu-22.04
9
+
10
+ steps :
11
+ - uses : actions/checkout@v3
12
+ - uses : bazelbuild/setup-bazelisk@v2
13
+ - name : Mount bazel cache
14
+ uses : actions/cache@v3
15
+ with :
16
+ path : " ~/.cache/bazel"
17
+ key : bazel
18
+
19
+ - run : bazel test poly_map_test --test_output=all
Original file line number Diff line number Diff line change 1
1
.idea
2
- cmake-build- *
2
+ * build *
3
+ * bazel *
Original file line number Diff line number Diff line change
1
+ {
2
+ "files.insertFinalNewline" : true ,
3
+ "files.trimFinalNewlines" : true ,
4
+ }
Original file line number Diff line number Diff line change
1
+ cc_library (
2
+ name = "poly_map" ,
3
+ hdrs = ["include/msd/poly_map.hpp" ],
4
+ includes = ["include" ],
5
+ visibility = ["//visibility:public" ],
6
+ )
7
+
8
+ cc_test (
9
+ name = "poly_map_test" ,
10
+ size = "small" ,
11
+ srcs = ["tests/poly_map_test.cpp" ],
12
+ copts = ["--std=c++17 -Wall -Wextra -Wpedantic -Werror" ],
13
+ deps = [
14
+ ":poly_map" ,
15
+ "@gtest//:gtest_main" ,
16
+ ],
17
+ )
Original file line number Diff line number Diff line change 1
1
cmake_minimum_required (VERSION 3.17)
2
2
project (poly_map)
3
- set (PROJECT_VERSION 0.2 .0)
3
+ set (PROJECT_VERSION 0.3 .0)
4
4
5
5
set (CMAKE_CXX_STANDARD 17)
6
6
set (CMAKE_CXX_STANDARD_REQUIRED YES )
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ A recursive map that can have any shape and can hold multiple types for keys and
15
15
## Requirements
16
16
17
17
* C++17
18
- * CMake 3.17+
18
+ * CMake 3.17+ or Bazel
19
19
20
20
## Usage
21
21
Original file line number Diff line number Diff line change
1
+ load ("@bazel_tools//tools/build_defs/repo:http.bzl" , "http_archive" )
2
+
3
+ http_archive (
4
+ name = "gtest" ,
5
+ url = "https://github.com/google/googletest/archive/release-1.10.0.zip" ,
6
+ sha256 = "94c634d499558a76fa649edb13721dce6e98fb1e7018dfaeba3cd7a083945e91" ,
7
+ build_file = "@//:gtest.BUILD" ,
8
+ strip_prefix = "googletest-release-1.10.0" ,
9
+ )
Original file line number Diff line number Diff line change
1
+ BasedOnStyle : Google
2
+ IndentWidth : 4
3
+ Language : Cpp
4
+ PointerAlignment : Right
5
+ BreakBeforeBraces : Stroustrup
6
+ ColumnLimit : 120
Original file line number Diff line number Diff line change
1
+ .idea
2
+ * build *
3
+ * bazel *
Original file line number Diff line number Diff line change
1
+ cc_binary (
2
+ name = "bazel-project" ,
3
+ srcs = ["src/main.cpp" ],
4
+ deps = [
5
+ "@poly_map//:poly_map" ,
6
+ ],
7
+ copts = ["--std=c++17" ],
8
+ )
Original file line number Diff line number Diff line change
1
+ # Bazel project
2
+
3
+ Example of using Poly map in a project with Bazel.
4
+
5
+ ## Requirements
6
+
7
+ * C++17 compiler
8
+ * Bazel
Original file line number Diff line number Diff line change
1
+ load ("@bazel_tools//tools/build_defs/repo:http.bzl" , "http_archive" )
2
+
3
+ http_archive (
4
+ name = "poly_map" ,
5
+ url = "https://github.com/andreiavrammsd/polymap/archive/refs/tags/v0.3.0.zip" ,
6
+ strip_prefix = "polymap-0.3.0" ,
7
+ )
Original file line number Diff line number Diff line change
1
+ #include < cassert>
2
+
3
+ #include " msd/poly_map.hpp"
4
+
5
+ int main ()
6
+ {
7
+ msd::poly_map<int > map;
8
+
9
+ map[0 ][0 ] = 1 ;
10
+ map[0 ][1 ] = 2 ;
11
+ map[0 ][2 ] = 3 ;
12
+
13
+ map[1 ][1 ] = 5 ;
14
+ map[1 ][2 ] = 6 ;
15
+
16
+ map[2 ][0 ] = 7 ;
17
+ map[2 ][1 ] = 8 ;
18
+ map[2 ][2 ] = 9 ;
19
+
20
+ assert (!map.contains (1 , 0 ));
21
+ assert (map.at (2 , 2 ).get <int >() == 9 );
22
+ }
Original file line number Diff line number Diff line change 1
1
.idea
2
- cmake- build- *
2
+ * build *
Original file line number Diff line number Diff line change
1
+ cc_library(
2
+ name = "gtest",
3
+ srcs = [
4
+ "googletest/src/gtest-all.cc",
5
+ "googlemock/src/gmock-all.cc",
6
+ ],
7
+ hdrs = glob([
8
+ "**/*.h",
9
+ "googletest/src/*.cc",
10
+ "googlemock/src/*.cc",
11
+ ]),
12
+ includes = [
13
+ "googlemock",
14
+ "googletest",
15
+ "googletest/include",
16
+ "googlemock/include",
17
+ ],
18
+ linkopts = ["-pthread"],
19
+ visibility = ["//visibility:public"],
20
+ )
21
+
22
+ cc_library(
23
+ name = "gtest_main",
24
+ srcs = ["googlemock/src/gmock_main.cc"],
25
+ linkopts = ["-pthread"],
26
+ visibility = ["//visibility:public"],
27
+ deps = [":gtest"],
28
+ )
You can’t perform that action at this time.
0 commit comments