Skip to content

Commit b67c46c

Browse files
committed
Released to the world
0 parents  commit b67c46c

34 files changed

+4560
-0
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*build*
2+
.idea/
3+
.vscode/
4+
site/

.gitlab-ci.yml

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
2+
stages:
3+
- build
4+
- check
5+
- deploy
6+
7+
build-16.04:
8+
stage: build
9+
image: ubuntu:16.04
10+
before_script:
11+
- apt update && apt install -y cmake build-essential git
12+
- git submodule update --init --recursive
13+
14+
script:
15+
- mkdir build && cd build
16+
- cmake ..
17+
- make
18+
- ./example
19+
artifacts:
20+
paths:
21+
- build
22+
reports:
23+
performance:
24+
- performance.json
25+
expire_in:
26+
1 week
27+
28+
29+
build-18.04:
30+
stage: build
31+
image: ubuntu:18.04
32+
before_script:
33+
- apt update && apt install -y cmake build-essential git
34+
- git submodule update --init --recursive
35+
script:
36+
- mkdir build && cd build
37+
- cmake ..
38+
- make
39+
- ./example
40+
artifacts:
41+
paths:
42+
- build
43+
expire_in:
44+
1 week
45+
46+
test-16.04:
47+
stage: check
48+
dependencies:
49+
- build-16.04
50+
image: ubuntu:16.04
51+
before_script:
52+
- apt update && apt install -y valgrind
53+
script:
54+
- valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all build/example
55+
56+
test-18.04:
57+
stage: check
58+
dependencies:
59+
- build-18.04
60+
image: ubuntu:18.04
61+
before_script:
62+
- apt update && apt install -y valgrind
63+
script:
64+
- valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all build/example
65+
66+
67+
pages:
68+
stage: deploy
69+
image: python:alpine
70+
before_script:
71+
- pip install mkdocs
72+
script:
73+
- mkdocs build
74+
- mv site public
75+
artifacts:
76+
paths:
77+
- public
78+
only:
79+
- master
80+

.gitmodules

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "external/json"]
2+
path = external/json
3+
url = https://github.com/nlohmann/json.git
4+
[submodule "external/flatbuffers"]
5+
path = external/flatbuffers
6+
url = https://github.com/google/flatbuffers.git

ABOUT

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
libsigmf: https://www.deepsig.io/libsigmf
2+
3+
libsigmf is a free & opensource library for working with SigMF recordings.
4+
(https://sigmf.org)
5+
6+
It was designed to enable the use of SigMF through static types in C++, thus
7+
enabling things like compile-time errors and code inspection.
8+
9+
It was created and first authored by DeepSig Inc., and then released to
10+
the community as an Apache 2.0-licensed FOSS project at FOSDEM 2019.
11+
12+
Contributors:
13+
14+
Nathan West
15+
Tim O'Shea
16+
Ben Hilburn
17+
18+

CMakeLists.txt

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
2+
cmake_minimum_required(VERSION 3.0)
3+
project(libsigmf CXX)
4+
5+
# c++14 used for auto return type for functions without having to do the -> declaration
6+
set(CMAKE_CXX_STANDARD 14)
7+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
8+
9+
list(APPEND CMAKE_MODULE_PATH cmake)
10+
11+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/flatbuffers
12+
${CMAKE_CURRENT_BINARY_DIR}/flatbuffers-build
13+
EXCLUDE_FROM_ALL)
14+
15+
function(generate_sigmf_header generate_sigmf_target FBS_FILE OUTPUT_LOCATION)
16+
add_custom_target(generate_sigmf_target_${generate_sigmf_target}
17+
COMMAND flatc -c --reflect-types --reflect-names --gen-object-api -o "${OUTPUT_LOCATION}/" "${FBS_FILE}"
18+
COMMENT "Building C++ header for flatbuffers definition ${FBS_FILE}"
19+
WORKING_DIRECTORY .)
20+
add_library(${generate_sigmf_target} INTERFACE)
21+
add_dependencies(${generate_sigmf_target} generate_sigmf_target_${generate_sigmf_target} flatc)
22+
target_include_directories(${generate_sigmf_target} INTERFACE "${OUTPUT_LOCATION}/")
23+
endfunction(generate_sigmf_header)
24+
25+
26+
# TODO: check that these directories exist and submodule init them if not
27+
set(JSON_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/json/single_include")
28+
set(FLATBUFFERS_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/flatbuffers/include")
29+
30+
# Create targets for generating the namespace definitions that we ship by default (using this requiers building flatc)
31+
generate_sigmf_header(generated_core_ns "${CMAKE_SOURCE_DIR}/sigmf_protocols/sigmf_core.fbs" "${CMAKE_CURRENT_BINARY_DIR}/include")
32+
generate_sigmf_header(generated_antenna_ns "${CMAKE_SOURCE_DIR}/sigmf_protocols/sigmf_antenna.fbs" "${CMAKE_CURRENT_BINARY_DIR}/include")
33+
generate_sigmf_header(generated_testing_ns "${CMAKE_SOURCE_DIR}/sigmf_protocols/testing_protocols.fbs" "${CMAKE_CURRENT_BINARY_DIR}/include")
34+
# We also carry around pre-generated headers so downstream doesn't need to build flatc
35+
set(SIGMF_GEN_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/sigmf_protocols")
36+
37+
# Our interface target that downstream should ideally use target_link_libraries( ) with to get access to our include dirs
38+
add_library(libsigmf INTERFACE)
39+
target_include_directories(libsigmf INTERFACE ${JSON_INCLUDE_DIR} ${FLATBUFFERS_INCLUDE_DIR} ${SIGMF_GEN_HEADERS} ${CMAKE_CURRENT_SOURCE_DIR}/src)
40+
41+
# Ensure that our protocol headers are generated before libsigmf dependency is satisfied (i.e. so examples have them)
42+
add_dependencies(libsigmf libsigmf_genheaders)
43+
add_custom_target(libsigmf_genheaders DEPENDS
44+
generate_sigmf_target_generated_core_ns
45+
generate_sigmf_target_generated_antenna_ns
46+
generate_sigmf_target_generated_testing_ns
47+
)
48+
49+
add_subdirectory(examples)
50+
51+
add_custom_target(makedocs
52+
COMMAND mkdocs build
53+
COMMENT "Building documentation website"
54+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
55+
56+
configure_file(
57+
${CMAKE_SOURCE_DIR}/cmake/SigmfConfig.cmake.in
58+
${CMAKE_BINARY_DIR}/cmake/SigmfConfig.cmake
59+
@ONLY
60+
)
61+
62+
# TODO: can we install flatc with a different binary name? sigmf-flatc?
63+
install(TARGETS flatc DESTINATION bin)
64+
INSTALL( # install original headers
65+
DIRECTORY ${CMAKE_SOURCE_DIR}/src/
66+
DESTINATION include/sigmf
67+
FILES_MATCHING PATTERN "*.h*")
68+
INSTALL( # install flatbuffers headers
69+
DIRECTORY ${CMAKE_SOURCE_DIR}/external/flatbuffers/include/flatbuffers/
70+
DESTINATION include/sigmf/external/flatbuffers/
71+
FILES_MATCHING PATTERN "*.h*")
72+
INSTALL( # install nlohmann headers
73+
DIRECTORY ${CMAKE_SOURCE_DIR}/external/json/include/nlohmann/
74+
DESTINATION include/sigmf/external/nlohmann/
75+
FILES_MATCHING PATTERN "*.hpp*")
76+
INSTALL( # install flatbuf proto defs
77+
DIRECTORY ${CMAKE_SOURCE_DIR}/sigmf_protocols/
78+
DESTINATION include/sigmf/fbs
79+
FILES_MATCHING PATTERN "*.fbs*")
80+
INSTALL( # install generated headers
81+
DIRECTORY ${CMAKE_BINARY_DIR}/include/
82+
DESTINATION include/sigmf/
83+
FILES_MATCHING PATTERN "*.h*")
84+
INSTALL(
85+
FILES ${CMAKE_BINARY_DIR}/cmake/SigmfConfig.cmake
86+
DESTINATION cmake/sigmf
87+
)

CONTRIBUTING.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
All contributions following the `inbound=outbound` licensing model, as
2+
described
3+
[here](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license),
4+
and are copyright of their respective author(s).
5+
6+
When contributing code, please mimic the code style of the project.
7+
Contributions should be made in the form of Pull Requests on [libsigmf's GitHub
8+
project](https://github.com/deepsig/libsigmf).
9+
10+

0 commit comments

Comments
 (0)