From 957ddbabe39f82630862ee0748606ca6c0645b6d Mon Sep 17 00:00:00 2001 From: Tad Nicol Date: Sun, 2 Mar 2025 16:40:50 -0800 Subject: [PATCH 1/3] Use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR to ensure compatibility with cmake package management --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5927210..af8a072 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,11 +7,11 @@ find_package(Threads REQUIRED) # 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() From 8807ed0c40c861018226bf764f3f61105344a719 Mon Sep 17 00:00:00 2001 From: Tad Nicol <34101867+tadmn@users.noreply.github.com> Date: Tue, 11 Mar 2025 15:31:53 -0700 Subject: [PATCH 2/3] Created a cmake INTERFACE library so that it is easier to use with cmake packaging tools --- .gitignore | 3 +++ CMakeLists.txt | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 .gitignore 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 af8a072..5d52475 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,9 @@ 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() @@ -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) From 3cf08080cef9e7c0347fdc144e81b02f5e27a8ca Mon Sep 17 00:00:00 2001 From: Tad Nicol <34101867+tadmn@users.noreply.github.com> Date: Tue, 15 Apr 2025 14:04:32 -0700 Subject: [PATCH 3/3] Add missing to fix build errors --- include/farbot/detail/RealtimeObject.tcc | 1 + 1 file changed, 1 insertion(+) 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