diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..82aa793 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.idea +cmake-build-debug +cmake-build-release diff --git a/CMakeLists.txt b/CMakeLists.txt index 5927210..5d52475 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,14 +4,17 @@ project(farbot) set(CMAKE_CXX_STANDARD 17) find_package(Threads REQUIRED) +add_library(${PROJECT_NAME} INTERFACE) +target_include_directories(${PROJECT_NAME} INTERFACE include) + # Enable testing include(GoogleTest) enable_testing() -set(GTEST_DIR "${CMAKE_SOURCE_DIR}/googletest/googletest") +set(GTEST_DIR "${PROJECT_SOURCE_DIR}/googletest/googletest") # Set a default build type if none was specified set(default_build_type "Release") -if(EXISTS "${CMAKE_SOURCE_DIR}/.git") +if(EXISTS "${PROJECT_SOURCE_DIR}/.git") set(default_build_type "Debug") endif() @@ -57,10 +60,10 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic") endif() -add_executable(gtestrunner test/test.cpp include/farbot/AsyncCaller.hpp include/farbot/RealtimeTraits.hpp include/farbot/RealtimeObject.hpp include/farbot/detail/RealtimeObject.tcc include/farbot/fifo.hpp include/farbot/detail/fifo.tcc ${GTEST_DIR}/src/gtest_main.cc ${GTEST_DIR}/src/gtest-all.cc) +add_executable(gtestrunner test/test.cpp ${GTEST_DIR}/src/gtest_main.cc ${GTEST_DIR}/src/gtest-all.cc) target_include_directories(gtestrunner PRIVATE include ${GTEST_DIR} ${GTEST_DIR}/include) -target_link_libraries(gtestrunner Threads::Threads) +target_link_libraries(gtestrunner ${PROJECT_NAME} Threads::Threads) gtest_add_tests(TARGET gtestrunner SOURCES test/test.cpp) -install(DIRECTORY include/farbot DESTINATION ${CMAKE_INSTALL_PREFIX}/include) +install(DIRECTORY include/${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/include) diff --git a/include/farbot/detail/RealtimeObject.tcc b/include/farbot/detail/RealtimeObject.tcc index 7ff7495..8914394 100644 --- a/include/farbot/detail/RealtimeObject.tcc +++ b/include/farbot/detail/RealtimeObject.tcc @@ -1,5 +1,6 @@ #pragma once +#include #include namespace farbot