Skip to content

Commit 8fb559e

Browse files
committed
Adds libsweep examples to Travis builds, resolves #30
1 parent bbbf132 commit 8fb559e

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

.travis.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,28 @@ matrix:
1111
addons:
1212
apt:
1313
sources: ['ubuntu-toolchain-r-test']
14-
packages: ['g++-6', 'cmake', 'python3', 'nodejs', 'npm']
14+
packages: ['g++-6', 'cmake', 'python3', 'nodejs', 'npm', 'libsfml-dev']
1515
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6'
1616

1717
- os: linux
1818
addons:
1919
apt:
2020
sources: ['ubuntu-toolchain-r-test']
21-
packages: ['g++-6', 'cmake', 'python3', 'nodejs', 'npm']
21+
packages: ['g++-6', 'cmake', 'python3', 'nodejs', 'npm', 'libsfml-dev']
2222
env: CCOMPILER='g++-6' CXXCOMPILER='g++-6'
2323

2424
- os: linux
2525
addons:
2626
apt:
2727
sources: ['ubuntu-toolchain-r-test']
28-
packages: ['g++-5', 'cmake', 'python3', 'nodejs', 'npm']
28+
packages: ['g++-5', 'cmake', 'python3', 'nodejs', 'npm', 'libsfml-dev']
2929
env: CCOMPILER='gcc-5' CXXCOMPILER='g++-5'
3030

3131
- os: linux
3232
addons:
3333
apt:
3434
sources: ['llvm-toolchain-precise-3.8']
35-
packages: ['clang-3.8', 'cmake', 'python3', 'nodejs', 'npm']
35+
packages: ['clang-3.8', 'cmake', 'python3', 'nodejs', 'npm', 'libsfml-dev']
3636
env: CCOMPILER='clang-3.8' CXXCOMPILER='clang++-3.8'
3737

3838
# Waiting on Travis whitelisting 3.9, see https://github.com/travis-ci/apt-source-whitelist/issues/300
@@ -60,6 +60,15 @@ install:
6060
- popd
6161

6262
script:
63+
# Test libsweep examples against the dummy library
64+
- pushd libsweep/examples
65+
- mkdir build
66+
- cd build
67+
- cmake ..
68+
- cmake --build .
69+
- ./example-c
70+
- ./example-c++
71+
- popd
6372
# Test SweepPy bindings against the dummy library
6473
- pushd sweeppy
6574
- python3 sweeppy.py

libsweep/examples/CMakeLists.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ target_link_libraries(example-c PRIVATE ${LIBSWEEP_LIBRARY} ${CMAKE_THREAD_LIBS_
1717
target_include_directories(example-c SYSTEM PRIVATE ${LIBSWEEP_INCLUDE_DIR})
1818

1919

20-
# TOOD: make SFML based viewer optional
20+
# Optional SFML2 based viewer
2121
include(FindPkgConfig)
22-
pkg_check_modules(LIBSFML REQUIRED sfml-all)
22+
pkg_check_modules(LIBSFML sfml-all)
2323

24-
add_executable(example-viewer viewer.cc)
25-
target_link_libraries(example-viewer PRIVATE ${LIBSWEEP_LIBRARY} ${LIBSFML_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
26-
target_include_directories(example-viewer SYSTEM PRIVATE ${LIBSWEEP_INCLUDE_DIR} ${LIBSFML_INCLUDE_DIRS})
24+
if (LIBSFML_FOUND)
25+
add_executable(example-viewer viewer.cc)
26+
target_link_libraries(example-viewer PRIVATE ${LIBSWEEP_LIBRARY} ${LIBSFML_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
27+
target_include_directories(example-viewer SYSTEM PRIVATE ${LIBSWEEP_INCLUDE_DIR} ${LIBSFML_INCLUDE_DIRS})
28+
else()
29+
message(STATUS "SFML2 required for real-time viewer (libsfml-dev)")
30+
endif()

0 commit comments

Comments
 (0)