Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix creation of C++ sample and add library config for makefiles #2693

Merged
merged 1 commit into from
Nov 22, 2024

Conversation

sam-herman
Copy link
Contributor

Thank you for your great work! Sending this humble PR to help

What Issues Is This Fixing?

  • FaceTrackVideoSample in C++ is not built
  • Add auto generated library config so the project can be consumed via C++ make file

Describe The New Behavior

  • FaceTrackVideoSample target is now created successfully in C++ targets and can be successfully run:
./FaceTrackVideoSample test_res/pack/Pikachu $VIDEO_FILE
  • The project can be included from other C++ projects relatively easily in the following way:
#    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})

Tests

Sample Fix Test

Build:

bash command/build.sh

Under the build directory now the FaceTrackVideoSample is showing:

$ ls -lah build/inspireface-macos/sample/FaceTrackVideoSample 
-rwxr-xr-x  1 samuelherman  staff   106K Nov 21 16:31 build/inspireface-macos/sample/FaceTrackVideoSample

Running it is producing the output:

./FaceTrackVideoSample test_res/pack/Pikachu $VIDEO_FILE
...
...
...
use time:0.0194099秒
Num of face: 1
Left eye status: 0.0505535
Righ eye status: 0.000933088
use time:0.0210403秒
Num of face: 1

Package Inclusion Test

Created simple makefile with presets that scan the previous build directory

find_package(InspireFace REQUIRED)
include_directories(${InspireFace_INCLUDE_DIRS}) # Not needed for CMake >= 2.8.11
target_link_libraries(MY_TARGET_NAME ${InspireFace_LIBS})

add_executable(example-app-detect-landmarks)
target_sources(example-app-detect-landmarks PRIVATE example-app-detect-landmarks.cpp)
target_link_libraries(example-app-detect-landmarks "${InspireFace_LIBS}")
set_property(TARGET example-app-detect-landmarks PROPERTY CXX_STANDARD 23)

The file example-app-detect-landmarks.cpp is a copy of FaceTrackVideoSample.cpp.

mkdir build; cd build
cmake -DCMAKE_PREFIX_PATH="<FULL_BUILD_PATH>" ..
cmake --build . --config Release

add library config

Signed-off-by: Samuel Herman <sherman8915@gmail.com>
@nttstar nttstar merged commit 2e29b41 into deepinsight:master Nov 22, 2024
@sam-herman sam-herman deleted the add-lib-config branch November 22, 2024 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants