Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "c/cmake/common"]
path = c/cmake/common
url = https://github.com/swift-nav/cmake.git
19 changes: 15 additions & 4 deletions c/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
cmake_minimum_required(VERSION 3.9)
cmake_minimum_required(VERSION 3.2)
project(libsbp)

set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake" "${CMAKE_CURRENT_LIST_DIR}/cmake/common")

include(GNUInstallDirs)
include(CCache)
include(SwiftCmakeOptions)
swift_create_project_options(
HAS_TESTS
HAS_DOCS
TEST_PACKAGES "Check"
)

##########################################################
# Set some reasonable default compiler flags.
Expand All @@ -19,5 +26,9 @@ else()
endif()

add_subdirectory(src)
add_subdirectory(docs)
add_subdirectory(test)
if(libsbp_BUILD_DOCS)
add_subdirectory(docs)
endif()
if(libsbp_BUILD_TESTS)
add_subdirectory(test)
endif()
55 changes: 0 additions & 55 deletions c/cmake/FindCheck.cmake

This file was deleted.

1 change: 1 addition & 0 deletions c/cmake/common
Submodule common added at ed4494
64 changes: 26 additions & 38 deletions c/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,38 +1,26 @@
if (CMAKE_CROSSCOMPILING)
message(STATUS "Skipping unit tests, cross compiling")
else (CMAKE_CROSSCOMPILING)

find_package(Check)
if (NOT CHECK_FOUND)
message(STATUS "Skipping unit tests, Check library not found!")
else (NOT CHECK_FOUND)

set(TEST_LIBS ${TEST_LIBS} ${CHECK_LIBRARIES} pthread sbp m)

# Check needs to be linked against Librt on Linux
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(TEST_LIBS ${TEST_LIBS} rt)
endif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")

FILE(GLOB generated_c_sources auto*.c)
add_executable(test_libsbp check_main.c check_edc.c check_sbp.c ${generated_c_sources})

target_link_libraries(test_libsbp ${TEST_LIBS})
set_target_properties(test_libsbp PROPERTIES
C_STANDARD 99
C_STANDARD_REQUIRED ON)

if(MSVC)
target_include_directories(test_libsbp PRIVATE ${PROJECT_SOURCE_DIR}/include/libsbp/)
else()
target_include_directories(test_libsbp PRIVATE ${PROJECT_SOURCE_DIR}/include/libsbp/ /usr/local/include/)
endif()

add_custom_command(
TARGET test_libsbp POST_BUILD
COMMENT "Running unit tests"
COMMAND test_libsbp
)

endif (NOT CHECK_FOUND)
endif (CMAKE_CROSSCOMPILING)
set(TEST_LIBS ${TEST_LIBS} ${CHECK_LIBRARIES} pthread sbp m)

# Check needs to be linked against Librt on Linux
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(TEST_LIBS ${TEST_LIBS} rt)
endif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")

FILE(GLOB generated_c_sources auto*.c)
add_executable(test_libsbp check_main.c check_edc.c check_sbp.c ${generated_c_sources})

target_link_libraries(test_libsbp ${TEST_LIBS})
set_target_properties(test_libsbp PROPERTIES
C_STANDARD 99
C_STANDARD_REQUIRED ON)

if(MSVC)
target_include_directories(test_libsbp PRIVATE ${PROJECT_SOURCE_DIR}/include/libsbp/)
else()
target_include_directories(test_libsbp PRIVATE ${PROJECT_SOURCE_DIR}/include/libsbp/ /usr/local/include/)
endif()

add_custom_command(
TARGET test_libsbp POST_BUILD
COMMENT "Running unit tests"
COMMAND test_libsbp
)
2 changes: 1 addition & 1 deletion python/tests/sbp/client/test_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def tcp_server(handler):
server_thread = threading.Thread(target=server.serve_forever)
server_thread.daemon = True
server_thread.start()
time.sleep(0.1) # wait for server to start
time.sleep(1) # wait for server to start
return (ip, port)

def test_tcp_logger():
Expand Down