Skip to content
Draft
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
27 changes: 24 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,29 @@ endif()

############ Setup dependencies

include(FetchContent)

# Include fmtlib
if(ENABLE_AVDECC_USE_FMTLIB)
# Override fmt options
set(FMT_INSTALL (${INSTALL_AVDECC_LIB_SHARED_CXX} OR ${INSTALL_AVDECC_LIB_STATIC}) CACHE BOOL "Force install." FORCE)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/externals/3rdparty/fmtlib EXCLUDE_FROM_ALL)
FetchContent_Declare(
fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
GIT_TAG 0c9fce2ffefecfdce794e1859584e25877b7b592 # release-11.0.2
FIND_PACKAGE_ARGS NAMES fmt
)
FetchContent_MakeAvailable(fmt)
endif()

# Include json
if(ENABLE_AVDECC_FEATURE_JSON)
set(JSON_BuildTests OFF CACHE INTERNAL "Disable JSON unit tests")
set(JSON_Install (${INSTALL_AVDECC_LIB_SHARED_CXX} OR ${INSTALL_AVDECC_LIB_STATIC} OR ${INSTALL_AVDECC_HEADERS}) CACHE INTERNAL "Install JSON library")
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/externals/3rdparty/json EXCLUDE_FROM_ALL)
FetchContent_Declare(nlohmann_json URL https://github.com/nlohmann/json/releases/download/v3.12.0/json.tar.xz
FIND_PACKAGE_ARGS NAMES nlohmann_json
)
FetchContent_MakeAvailable(nlohmann_json)
endif()

# Override nih options
Expand Down Expand Up @@ -224,6 +235,10 @@ if(BUILD_AVDECC_INTERFACE_PCAP)
link_directories(${LA_WINPCAP_LIB_DIR})
endif()
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
find_package(PkgConfig REQUIRED)
pkg_check_modules(PCAP REQUIRED IMPORTED_TARGET GLOBAL libpcap)
endif()
endif()

############ Add projects
Expand Down Expand Up @@ -263,7 +278,13 @@ if(BUILD_AVDECC_TESTS AND NOT VS_USE_CLANG)
set(BUILD_GMOCK ON CACHE BOOL "Build the googlemock subproject" FORCE)
set(INSTALL_GTEST OFF CACHE BOOL "Disable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" FORCE)
# Include gtest framework
add_subdirectory(externals/3rdparty/gtest)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG 703bd9caab50b139428cea1aaff9974ebee5742e # release-1.10.0
FIND_PACKAGE_ARGS NAMES GTest
)
FetchContent_MakeAvailable(googletest)
# Include our unit tests
add_subdirectory(tests)
endif()
Expand Down
2 changes: 1 addition & 1 deletion gen_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Useful script to generate project files using cmake

# Override default cmake options
cmake_opt="-DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE -DBUILD_AVDECC_EXAMPLES=TRUE -DBUILD_AVDECC_TESTS=TRUE -DBUILD_AVDECC_LIB_SHARED_CXX=TRUE -DBUILD_AVDECC_LIB_STATIC_RT_SHARED=TRUE -DBUILD_AVDECC_DOC=TRUE -DBUILD_AVDECC_CONTROLLER=TRUE -DINSTALL_AVDECC_EXAMPLES=TRUE -DINSTALL_AVDECC_TESTS=TRUE -DINSTALL_AVDECC_LIB_SHARED_CXX=TRUE -DINSTALL_AVDECC_LIB_STATIC=TRUE -DINSTALL_AVDECC_HEADERS=TRUE -DINSTALL_AVDECC_DOC=TRUE -DENABLE_CODE_SIGNING=FALSE"
cmake_opt="-DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE -DBUILD_AVDECC_EXAMPLES=TRUE -DBUILD_AVDECC_TESTS=TRUE -DBUILD_AVDECC_LIB_SHARED_CXX=TRUE -DBUILD_AVDECC_LIB_STATIC_RT_SHARED=TRUE -DBUILD_AVDECC_DOC=TRUE -DBUILD_AVDECC_CONTROLLER=TRUE -DINSTALL_AVDECC_EXAMPLES=TRUE -DINSTALL_AVDECC_TESTS=TRUE -DINSTALL_AVDECC_LIB_SHARED_CXX=TRUE -DINSTALL_AVDECC_LIB_STATIC=TRUE -DINSTALL_AVDECC_HEADERS=TRUE -DINSTALL_AVDECC_DOC=TRUE -DENABLE_CODE_SIGNING=FALSE -DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=NEVER"

# Get absolute folder for this script
selfFolderPath="`cd "${BASH_SOURCE[0]%/*}"; pwd -P`/" # Command to get the absolute path
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ if(BUILD_AVDECC_LIB_SHARED_CXX)
# Setup libfmt
if(ENABLE_AVDECC_USE_FMTLIB)
target_compile_options(${PROJECT_NAME}_cxx PRIVATE -DHAVE_FMT)
target_link_libraries(${PROJECT_NAME}_cxx PRIVATE fmt-header-only)
target_link_libraries(${PROJECT_NAME}_cxx PRIVATE fmt::fmt-header-only)
endif()

# Setup json
Expand Down
2 changes: 1 addition & 1 deletion src/controller/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ if(BUILD_AVDECC_LIB_SHARED_CXX)
# Setup libfmt
if(ENABLE_AVDECC_USE_FMTLIB)
target_compile_options(${PROJECT_NAME}_cxx PRIVATE -DHAVE_FMT)
target_link_libraries(${PROJECT_NAME}_cxx PRIVATE fmt-header-only)
target_link_libraries(${PROJECT_NAME}_cxx PRIVATE fmt::fmt-header-only)
endif()

# Setup json
Expand Down