From e452f8e0b702cd5c5ce12dc653d20edcb87af766 Mon Sep 17 00:00:00 2001 From: Samad Khan Date: Sun, 31 Dec 2023 02:06:29 -0500 Subject: [PATCH] Fixing udef sym on WSL -lld, using 'roc' libname, add download_gtest.cmake --- CMakeLists.txt | 30 ++++-------------------------- cmake/download_googletest.cmake | 21 +++++++++++++++++++++ cmake/download_roc.cmake | 2 +- 3 files changed, 26 insertions(+), 27 deletions(-) create mode 100644 cmake/download_googletest.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 469b456..55d2c4a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,21 +2,8 @@ cmake_minimum_required(VERSION 3.5) project(rt-tests) -include(ExternalProject) - -ExternalProject_Add(googletest - GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG release-1.12.1 - GIT_SHALLOW ON - SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src" - BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build" - INSTALL_COMMAND "" - TEST_COMMAND "" - LOG_DOWNLOAD ON - LOG_BUILD ON -) - include("cmake/define_option.cmake") +include("cmake/download_googletest.cmake") define_option(ROC_INCLUDE_DIR "" STRING "roc toolkit include directory") define_option(ROC_LIB_DIR "" STRING "roc toolkit library directory") @@ -42,16 +29,6 @@ else() link_libraries("roc") endif() -include_directories( - "${CMAKE_CURRENT_BINARY_DIR}/googletest-src/googletest/include" - #"${CMAKE_CURRENT_BINARY_DIR}/roc-toolkit-src/src/public_api/include" -) - -link_directories( - "${CMAKE_CURRENT_BINARY_DIR}/googletest-build/lib" - #"${CMAKE_CURRENT_BINARY_DIR}/roc-toolkit-src/bin/x86_64-pc-linux-gnu/" -) - set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_EXTENSIONS OFF) @@ -78,14 +55,15 @@ add_executable(rt-tests tests/test_service_quality.cpp ) -add_dependencies(rt-tests googletest roc) +add_dependencies(rt-tests googletest RocLibrary) find_package(Threads) target_link_libraries(rt-tests - -l:libroc.a + roc gtest gtest_main + ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}) add_custom_command(TARGET rt-tests POST_BUILD diff --git a/cmake/download_googletest.cmake b/cmake/download_googletest.cmake new file mode 100644 index 0000000..c3683f7 --- /dev/null +++ b/cmake/download_googletest.cmake @@ -0,0 +1,21 @@ +include(ExternalProject) + +ExternalProject_Add(googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG release-1.12.1 + GIT_SHALLOW ON + SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build" + INSTALL_COMMAND "" + TEST_COMMAND "" + LOG_DOWNLOAD ON + LOG_BUILD ON +) + +include_directories( + "${CMAKE_CURRENT_BINARY_DIR}/googletest-src/googletest/include" +) + +link_directories( + "${CMAKE_CURRENT_BINARY_DIR}/googletest-build/lib" +) \ No newline at end of file diff --git a/cmake/download_roc.cmake b/cmake/download_roc.cmake index 54ce644..c32cb28 100644 --- a/cmake/download_roc.cmake +++ b/cmake/download_roc.cmake @@ -29,7 +29,7 @@ set(SCONS_CMD define_option(ROC_TOOLKIT_BRANCH "master" STRING "roc-toolkit branch") -ExternalProject_Add(roc +ExternalProject_Add(RocLibrary GIT_REPOSITORY "https://github.com/roc-streaming/roc-toolkit.git" GIT_TAG origin/${ROC_TOOLKIT_BRANCH} SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/roc-src"