From 758a0e69b9c2d5cee0fa4a95dbd20444868e9df8 Mon Sep 17 00:00:00 2001 From: Samuel Herman Date: Thu, 21 Nov 2024 09:00:11 -0800 Subject: [PATCH] fix creation of C++ sample add library config Signed-off-by: Samuel Herman --- cpp-package/inspireface/CMakeLists.txt | 3 +++ .../templates/InspireFaceConfig.cmake.in | 25 +++++++++++++++++++ .../inspireface/cpp/sample/CMakeLists.txt | 16 ++++++------ 3 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 cpp-package/inspireface/cpp/inspireface/cmake/templates/InspireFaceConfig.cmake.in diff --git a/cpp-package/inspireface/CMakeLists.txt b/cpp-package/inspireface/CMakeLists.txt index 1acdf8d15..2b03527c0 100644 --- a/cpp-package/inspireface/CMakeLists.txt +++ b/cpp-package/inspireface/CMakeLists.txt @@ -19,6 +19,9 @@ string(CONCAT INSPIRE_FACE_VERSION_PATCH_STR ${INSPIRE_FACE_VERSION_PATCH}) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cpp/inspireface/information.h.in ${CMAKE_CURRENT_SOURCE_DIR}/cpp/inspireface/information.h) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cpp/inspireface/version.txt.in ${CMAKE_CURRENT_SOURCE_DIR}/cpp/inspireface/version.txt) +# Creates a package config file +configure_file("${InspireFace_SOURCE_DIR}/cpp/inspireface/cmake/templates/InspireFaceConfig.cmake.in" "${CMAKE_BINARY_DIR}/install/InspireFaceConfig.cmake" @ONLY) + # Set the ISF_THIRD_PARTY_DIR variable to allow it to be set externally from the command line, or use the default path if it is not set set(ISF_THIRD_PARTY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty" CACHE PATH "Path to the third-party libraries directory") diff --git a/cpp-package/inspireface/cpp/inspireface/cmake/templates/InspireFaceConfig.cmake.in b/cpp-package/inspireface/cpp/inspireface/cmake/templates/InspireFaceConfig.cmake.in new file mode 100644 index 000000000..cf4880698 --- /dev/null +++ b/cpp-package/inspireface/cpp/inspireface/cmake/templates/InspireFaceConfig.cmake.in @@ -0,0 +1,25 @@ +# =================================================================================== +# The InspireFace CMake configuration file +# +# ** File generated automatically, do not modify ** +# Usage from an external project: +# In your CMakeLists.txt, add these lines: +# +# find_package(InspireFace REQUIRED) +# include_directories(${InspireFace_INCLUDE_DIRS}) # Not needed for CMake >= 2.8.11 +# target_link_libraries(MY_TARGET_NAME ${InspireFace_LIBS}) +# +# +# +# This file will define the following variables: +# - InspireFace_LIBS : The list of all imported targets for InspireFace modules. +# - InspireFace_INCLUDE_DIRS : The InspireFace include directories. +# +# +@PACKAGE_INIT@ + +set(InspireFace_LIBS "") +file(GLOB LIBS "@CMAKE_BINARY_DIR@/InspireFace/lib/*.*") + +list(APPEND InspireFace_LIBS ${LIBS}) +set(InspireFace_INCLUDE_DIRS "@CMAKE_BINARY_DIR@/InspireFace/include") diff --git a/cpp-package/inspireface/cpp/sample/CMakeLists.txt b/cpp-package/inspireface/cpp/sample/CMakeLists.txt index 66d4d1c34..f5ccbeda0 100644 --- a/cpp-package/inspireface/cpp/sample/CMakeLists.txt +++ b/cpp-package/inspireface/cpp/sample/CMakeLists.txt @@ -39,13 +39,13 @@ set_target_properties(MTFaceTrackSample PROPERTIES ) if(NOT DISABLE_GUI) - # Examples of face detection and tracking - add_executable(FaceTrackVideoSample cpp/sample_face_track_video.cpp) - target_link_libraries(FaceTrackVideoSample InspireFace ${ext}) - set_target_properties(FaceTrackVideoSample PROPERTIES - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/sample/" - ) -endif() + # Examples of face detection and tracking + add_executable(FaceTrackVideoSample cpp/sample_face_track_video.cpp) + target_link_libraries(FaceTrackVideoSample InspireFace ${ext}) + set_target_properties(FaceTrackVideoSample PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/sample/" + ) +endif () @@ -265,4 +265,4 @@ install(TARGETS MTFaceTrackSample RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/sa install(TARGETS FaceRecognitionSample RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/sample) install(TARGETS FaceSearchSample RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/sample) install(TARGETS FaceComparisonSample RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/sample) - +install(TARGETS FaceTrackVideoSample RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/sample)