Skip to content

Commit

Permalink
Changing twine build and include step
Browse files Browse the repository at this point in the history
  • Loading branch information
noizebox committed Mar 27, 2023
1 parent 3d514ff commit d457879
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
url = https://github.com/gabime/spdlog.git
[submodule "twine"]
path = twine
url = http://github.com/elk-audio/twine.git
url = ../twine.git
15 changes: 12 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,26 @@ set(ELKLOG_RT_QUEUE_SIZE 1024 CACHE STRING "Size of realtime log queue")

set(TWINE_WITH_TESTS OFF CACHE BOOL "" FORCE)

if (ELKLOG_USE_INCLUDED_TWINE)
if (${ELKLOG_USE_INCLUDED_TWINE})
set(TWINE_WITH_TESTS OFF CACHE BOOL "")
add_subdirectory(twine)
set(TWINE_LIB twine)
else()
find_path(TWINE_PATH NAMES "twine/twine.h")
find_library(TWINE_LIB
NAMES twine
PATHS /usr/lib /usr/local/lib
)
endif()

add_subdirectory(third-party)

###################
# Create target #
###################

add_library(elklog STATIC src/elklog.cpp)
target_include_directories(elklog PUBLIC include)
target_include_directories(elklog PUBLIC include ${TWINE_PATH})
set_target_properties(elklog spdlog PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_compile_features(elklog PUBLIC cxx_std_17)
target_compile_definitions(elklog PUBLIC -DELKLOG_FILE_SIZE=${ELKLOG_FILE_SIZE}
Expand All @@ -56,7 +65,7 @@ if(ELKLOG_MULTI_THREADED_RT_LOGGING)
target_compile_definitions(elklog PUBLIC -DELKLOG_MULTI_THREADED_RT_LOGGING=1)
endif()

target_link_libraries(elklog fifo spdlog twine::twine)
target_link_libraries(elklog fifo spdlog ${TWINE_LIB})

###########
# Tests #
Expand Down

0 comments on commit d457879

Please sign in to comment.