This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: 2.1 | |
| jobs: | |
| build: | |
| docker: | |
| - image: cyrusbehr/sdk_design | |
| steps: | |
| - checkout | |
| - restore_cache: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import mysdk | |
| sdk = mysdk.MY_SDK() | |
| error_code, face_detected, face_box_and_landmarks = sdk.get_face_box_and_landmarks('../tests/images/face.jpg') | |
| if error_code != mysdk.ERRORCODE.NO_ERROR: | |
| print("There was an error!") | |
| quit() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "my_sdk.h" | |
| #include "pybind11/pybind11.h" | |
| #include "pybind11/stl.h" | |
| namespace py = pybind11; | |
| using namespace sdk; | |
| PYBIND11_MODULE(mysdk, m) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| OUTPUT_DIRECTORY = @CMAKE_CURRENT_BINARY_DIR@/doxygen_documentation/ | |
| INPUT = @CMAKE_CURRENT_SOURCE_DIR@/../include/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct FaceBoxAndLandmarks { | |
| /** The top left corner of the bounding box */ | |
| Point topLeft; | |
| /** The bottom right corner of the bounding box */ | |
| Point bottomRight; | |
| /** The facial landmark points: left eye, right eye, nose, left mouth corner, right mouth corner */ | |
| std::array<Point, 5> landmarks; | |
| }; | |
| /** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Unit test | |
| add_executable(run_tests tests/test.cpp) | |
| target_link_libraries(run_tests ${CMAKE_CURRENT_BINARY_DIR}/libmy_sdk.a) | |
| target_include_directories(run_tests PRIVATE ${CMAKE_CURRENT_LIST_DIR}/include) | |
| target_include_directories(run_tests PRIVATE ${CMAKE_CURRENT_LIST_DIR}/3rdparty/catch2) | |
| add_dependencies(run_tests my_sdk) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define CATCH_CONFIG_MAIN | |
| #include <iostream> | |
| #include "my_sdk.h" | |
| #include "catch.hpp" | |
| TEST_CASE("Core functionality", "[core]") | |
| { | |
| sdk::MySDK mySdk; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_custom_target(my_sdk | |
| COMMAND | |
| /bin/echo -e 'create libmy_sdk.a\\naddlib libmy_sdk_static.a\\naddlib ${LIBCNN}\\naddlib ${LIBOPENCV_CORE}\\naddlib ${LIBOPENCV_IMGCODECS}\\naddlib ${LIBOPENCV_IMGPROC}\\naddlib ${LIBOPENCV_ZLIB}\\naddlib ${LIBOPENCV_PNG}\\naddlib ${LIBOPENCV_TIFF}\\naddlib ${LIBOPENCV_JPG}\\nsave\\nend' | ar -M | |
| DEPENDS | |
| my_sdk_static | |
| COMMENT | |
| "Merging dependency libraries into my_sdk_static to create libmy_sdk.a" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Build options for cross compiling | |
| option(BUILD_ARM32 "Cross compile the SDK for arm32" OFF) | |
| option(BUILD_ARM64 "Cross compile the SDK for arm64" OFF) | |
| # Choose the appropriate toolchain file | |
| if (BUILD_ARM32) | |
| SET (CMAKE_TOOLCHAIN_FILE tools/toolchain-arm32.cmake) | |
| elseif(BUILD_ARM64) | |
| SET (CMAKE_TOOLCHAIN_FILE tools/toolchain-aarch64.cmake) | |
| endif() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set(CMAKE_SYSTEM_NAME Linux) | |
| set(CMAKE_SYSTEM_PROCESSOR aarch64) | |
| SET(CMAKE_C_COMPILER aarch64-linux-gnu-gcc) | |
| SET(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++) |