You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ph...@apache.org on 2019/06/13 01:37:04 UTC

[nifi-minifi-cpp] 02/03: MINIFICPP-917 Update TensorFlow extension to the latest minifi-cpp CMake best practices

This is an automated email from the ASF dual-hosted git repository.

phrocker pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git

commit 848408dee4cb32ced5402a5a57ec319c7f29c9f1
Author: Andrew I. Christianson <an...@andyic.org>
AuthorDate: Wed Jun 12 15:02:53 2019 -0400

    MINIFICPP-917 Update TensorFlow extension to the latest minifi-cpp CMake best practices
    
    This closes #591.
    
    Signed-off-by: Marc Parisi <ph...@apache.org>
---
 .gitignore                                     |  2 ++
 cmake/FindTensorFlow.cmake                     |  1 +
 extensions/tensorflow/CMakeLists.txt           | 27 ++------------------------
 libminifi/test/tensorflow-tests/CMakeLists.txt |  3 ++-
 4 files changed, 7 insertions(+), 26 deletions(-)

diff --git a/.gitignore b/.gitignore
index 32230e7..b135a55 100644
--- a/.gitignore
+++ b/.gitignore
@@ -73,3 +73,5 @@ docker/fedora/minificppsource
 /cmake-build-*
 .vs/VSWorkspaceState.json
 .vs/slnx.sqlite
+/.ccls-cache
+/.vscode
\ No newline at end of file
diff --git a/cmake/FindTensorFlow.cmake b/cmake/FindTensorFlow.cmake
index be1023f..732e3ae 100644
--- a/cmake/FindTensorFlow.cmake
+++ b/cmake/FindTensorFlow.cmake
@@ -29,6 +29,7 @@ find_path(TENSORFLOW_INCLUDE_DIR
           third_party
           HINTS
           ${TENSORFLOW_PATH}
+          /usr/include/tensorflow
           /usr/local/include/google/tensorflow
           /usr/local/include/tensorflow
           /usr/include/google/tensorflow)
diff --git a/extensions/tensorflow/CMakeLists.txt b/extensions/tensorflow/CMakeLists.txt
index 970f6cc..a641a18 100644
--- a/extensions/tensorflow/CMakeLists.txt
+++ b/extensions/tensorflow/CMakeLists.txt
@@ -17,6 +17,8 @@
 # under the License.
 #
 
+include(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt)
+
 set(CMAKE_CXX_STANDARD 14)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 
@@ -24,8 +26,6 @@ find_package(TensorFlow REQUIRED)
 
 message("-- Found TensorFlow: ${TENSORFLOW_INCLUDE_DIRS}")
 
-include_directories(../../libminifi/include  ../../libminifi/include/core  ../../thirdparty/spdlog-20170710/include ../../thirdparty/concurrentqueue ../../thirdparty/yaml-cpp-yaml-cpp-0.5.3/include ${CIVET_THIRDPARTY_ROOT}/include ../../thirdparty/) 
-
 include_directories(${TENSORFLOW_INCLUDE_DIRS})
 
 file(GLOB SOURCES  "*.cpp")
@@ -39,30 +39,7 @@ if(CMAKE_THREAD_LIBS_INIT)
   target_link_libraries(minifi-tensorflow-extensions "${CMAKE_THREAD_LIBS_INIT}")
 endif()
 
-find_package(UUID REQUIRED)
-target_link_libraries(minifi-tensorflow-extensions ${LIBMINIFI} ${UUID_LIBRARIES})
-find_package(OpenSSL REQUIRED)
-include_directories(${OPENSSL_INCLUDE_DIR})
-target_link_libraries(minifi-tensorflow-extensions ${CMAKE_DL_LIBS})
 target_link_libraries(minifi-tensorflow-extensions ${TENSORFLOW_LIBRARIES})
-find_package(ZLIB REQUIRED)
-include_directories(${ZLIB_INCLUDE_DIRS})
-target_link_libraries (minifi-tensorflow-extensions ${ZLIB_LIBRARIES})
-
-if (WIN32)
-    set_target_properties(minifi-tensorflow-extensions PROPERTIES
-        LINK_FLAGS "/WHOLEARCHIVE"
-    )
-elseif (APPLE)
-    set_target_properties(minifi-tensorflow-extensions PROPERTIES
-        LINK_FLAGS "-Wl,-all_load"
-    )
-else ()
-    set_target_properties(minifi-tensorflow-extensions PROPERTIES
-        LINK_FLAGS "-Wl,--whole-archive"
-    )
-endif ()
-
 
 SET (TENSORFLOW-EXTENSIONS minifi-tensorflow-extensions PARENT_SCOPE)
 
diff --git a/libminifi/test/tensorflow-tests/CMakeLists.txt b/libminifi/test/tensorflow-tests/CMakeLists.txt
index e0b3ffa..906b325 100644
--- a/libminifi/test/tensorflow-tests/CMakeLists.txt
+++ b/libminifi/test/tensorflow-tests/CMakeLists.txt
@@ -26,12 +26,13 @@ FOREACH(testfile ${TENSORFLOW_INTEGRATION_TESTS})
 	get_filename_component(testfilename "${testfile}" NAME_WE)
 	add_executable("${testfilename}" "${testfile}" ${SPD_SOURCES} "${TEST_DIR}/TestBase.cpp")
 	target_include_directories(${testfilename} PRIVATE BEFORE "${CMAKE_SOURCE_DIR}/extensions/tensorflow")
+	target_include_directories(${testfilename} PRIVATE BEFORE "${CMAKE_SOURCE_DIR}/extensions/standard-processors")
 	target_include_directories(${testfilename} PRIVATE BEFORE ${TENSORFLOW_INCLUDE_DIRS})
 	createTests("${testfilename}")
 	if (APPLE)
 		target_link_libraries (${testfilename} -Wl,-all_load minifi-tensorflow-extensions)
 	else ()
-	    target_link_libraries (${testfilename} -Wl,--whole-archive minifi-tensorflow-extensions -Wl,--no-whole-archive)
+	    target_link_libraries (${testfilename} -Wl,--whole-archive minifi-tensorflow-extensions minifi-standard-processors -Wl,--no-whole-archive)
 	endif ()
 	MATH(EXPR EXTENSIONS_TEST_COUNT "${EXTENSIONS_TEST_COUNT}+1")
 	add_test(NAME "${testfilename}" COMMAND "${testfilename}" WORKING_DIRECTORY ${TEST_DIR})