From c01ee5da56d2e26071036dcaad06bbeb2e150c02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Salva=20Carri=C3=B3n?= Date: Mon, 21 Sep 2020 12:21:09 +0200 Subject: [PATCH] Add threads for GTest (Unix) --- docs/markdown/development.md | 3 +++ scripts/compile_dummy.sh | 13 +++++++++++++ tests/CMakeLists.txt | 3 ++- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 scripts/compile_dummy.sh diff --git a/docs/markdown/development.md b/docs/markdown/development.md index 7f271eaea..9eb3e5131 100644 --- a/docs/markdown/development.md +++ b/docs/markdown/development.md @@ -26,6 +26,9 @@ https://cmake.org/cmake/help/latest/manual/cmake-env-variables.7.html Short tutorial: (Series: 1,2,3) https://medium.com/heuristics/c-application-development-part-1-project-structure-454b00f9eddc + +Shared libraries/rpaths/... +https://www.cprogramming.com/tutorial/shared-libraries-linux-gcc.html ``` ## Requirements diff --git a/scripts/compile_dummy.sh b/scripts/compile_dummy.sh new file mode 100644 index 000000000..35415d9e4 --- /dev/null +++ b/scripts/compile_dummy.sh @@ -0,0 +1,13 @@ +# Set working path +WORKPATH=/home/salvacarrion/Downloads/eddl_compiled/cpu_x86_64_shared__proto_openmp + +# Compiling (include headers: eigen3/Eigen/ and eddl/) +g++ -c -Wall -Werror main.cpp -o main.o \ +-I$WORKPATH/include \ +-I$WORKPATH/include/eigen3 \ + +# Linking +g++ main.o -o main \ +-L$WORKPATH/lib \ +-Wl,-rpath=$WORKPATH/lib \ +-leddl \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e62cfe945..d444663ef 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -37,7 +37,8 @@ if(MSVC) optimized ${GTEST_BOTH_LIBRARIES} debug ${GTEST_BOTH_LIBRARIES_D}) else() - target_link_libraries(unit_tests PUBLIC eddl ${GTEST_BOTH_LIBRARIES}) + find_package(Threads) + target_link_libraries(unit_tests PUBLIC eddl ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) endif()