Skip to content

Commit

Permalink
add cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
jpihl committed Nov 14, 2019
1 parent 69595db commit 3bb9a45
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required (VERSION 3.10)
project(bitter)

add_library(bitter INTERFACE)
add_library(steinwurf::bitter ALIAS bitter)

target_include_directories(bitter INTERFACE src/)
2 changes: 1 addition & 1 deletion NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ detailed list of every change, see the Git log.

Latest
------
* tbd
* Minor: Added cmake build file.

5.0.0
-----
Expand Down
14 changes: 13 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Bitter

.. image:: https://travis-ci.org/steinwurf/bitter.svg?branch=master
:target: https://travis-ci.org/steinwurf/bitter

Is a lightweight header only C++ API, for reading and writing single bit
fields.

Expand Down Expand Up @@ -282,6 +282,18 @@ To do that you can use our ``endian`` library available here:
https://github.com/steinwurf/endian


Use as Dependency in CMake
--------------------------

To depend on this project when using the CMake build system, add the following
in your CMake build script::

add_subdirectory("/path/to/bitter" bitter)
target_link_libraries(<my_target> steinwurf::bitter)

Where ``<my_target>`` is replaced by your target.


License
=======

Expand Down
16 changes: 16 additions & 0 deletions buildbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,20 @@ def install(properties):
run_command(command)


def cmake(properties):
build_path = 'build'
if os.path.exists(build_path):
print("Path '{}' already exists - removing".format(build_path))
shutil.rmtree(build_path)
os.mkdir(build_path)

old_cwd = os.getcwd()
os.chdir(build_path)
run_command(['cmake', '../'], env_ext={'VERBOSE': '1'})
run_command(['cmake', '--build', '.'], env_ext={'VERBOSE': '1'})
os.chdir(old_cwd)


def coverage_settings(options):
options['required_line_coverage'] = 61.7

Expand All @@ -108,6 +122,8 @@ def main():
run_tests(properties)
elif cmd == 'install':
install(properties)
elif cmd == 'cmake':
cmake(properties)
else:
print("Unknown command: {}".format(cmd))

Expand Down

0 comments on commit 3bb9a45

Please sign in to comment.