Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Travis file for CI #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
sudo: false
dist: trusty

language: cpp

cache:
apt: true

addons:
apt:
packages:
- g++
compiler:
- g++

script: mkdir build && cd build && cmake .. && make && ctest --verbose && cd ..

3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -- Project Setup ------------------------------------------------------------

project(libbf CXX)
project(libbf CXX C)

include(CTest)

Expand Down Expand Up @@ -47,6 +47,7 @@ set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
set(CMAKE_EXE_LINKER_FLAGS "-pthread")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try whether this more portable fix works as well?

# Exists already.
find_package(Threads)
if (NOT Threads_FOUND)
  message(FATAL_ERROR "Could not find system threading libraries")
endif ()

# Add this line.
target_link_libraries(libbf ${CMAKE_THREAD_LIBS_INIT})

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMake Error at CMakeLists.txt:44 (target_link_libraries):
  Cannot specify link libraries for target "libbf" which is not built by this
  project.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot: this line needs go below after add_library. (line 85)


if (ENABLE_DEBUG)
set(CMAKE_BUILD_TYPE Debug)
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ add_subdirectory(bf)
enable_testing()
add_executable(bf-test tests.cpp)
target_link_libraries(bf-test libbf ${CMAKE_THREAD_LIBS_INIT})
add_test(unit ${CMAKE_CURRENT_BINARY_DIR}/bf-test)
add_test(NAME unit COMMAND bf-test)