### Install command for development component Source: https://github.com/usnistgov/nfiq2/blob/master/CMakeLists.txt Installs the library directory for the development component. ```cmake install(DIRECTORY "${INSTALL_STAGING_DIR}/${INSTALL_STAGING_LIBDIR}/" DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT development) ``` -------------------------------- ### Install command for nfiq2_cli component Source: https://github.com/usnistgov/nfiq2/blob/master/CMakeLists.txt Installs the binary directory for the nfiq2_cli component. ```cmake install(DIRECTORY "${INSTALL_STAGING_DIR}/${INSTALL_STAGING_BINDIR}/" DESTINATION ${CMAKE_INSTALL_BINDIR} FILE_PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE COMPONENT nfiq2_cli) ``` -------------------------------- ### Example API Usage Command Source: https://github.com/usnistgov/nfiq2/blob/master/examples/README.md This command demonstrates how to use the example_api with a model info file and a fingerprint image. ```bash example_api [-h] _modelInfoFile_ _fingerPrintImage_ ``` -------------------------------- ### FingerJet Library Installation Source: https://github.com/usnistgov/nfiq2/blob/master/NFIQ2/NFIQ2Algorithm/CMakeLists.txt Installs the FingerJetFXOSE library files (static and shared), noting that FingerJet itself does not have a dedicated install target. ```cmake install(FILES ${CMAKE_BINARY_DIR}/../../../fingerjetfxose/FingerJetFXOSE/libFRFXLL/src/$<$:$<$:Debug/>$<$:Release/>>${CMAKE_STATIC_LIBRARY_PREFIX}FRFXLL_static${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_BINARY_DIR}/../../../fingerjetfxose/FingerJetFXOSE/libFRFXLL/src/$<$:$<$:Debug/>$<$:Release/>>${CMAKE_SHARED_LIBRARY_PREFIX}FRFXLL${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT install_staging) ``` -------------------------------- ### Install command for development component (headers) Source: https://github.com/usnistgov/nfiq2/blob/master/CMakeLists.txt Installs the include directory for the development component. ```cmake install(DIRECTORY "${INSTALL_STAGING_DIR}/${INSTALL_STAGING_INCLUDEDIR}/" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT development) ``` -------------------------------- ### NFIQ2 Example CMake Configuration Source: https://github.com/usnistgov/nfiq2/blob/master/examples/CMakeLists.txt This CMakeLists.txt file sets up the build environment for NFIQ2 example applications, including options for static or shared library linking and handling dependencies like OpenCV. ```cmake cmake_minimum_required(VERSION 3.11) project(examples) option(LINK_AGAINST_STATIC_LIBNFIQ2 "Link against static (vs shared) libnfiq2" YES) option(NFIQ2_EMBEDDED_MODEL "Link against library with embedded model (no NFIQ2::ModelInfo)" NO) # TODO: Add find_package for NFIQ2 set(NFIQ2_INSTALL_DIR /usr/local/nfiq2 CACHE STRING "Location of NFIQ 2 installation") include_directories(${NFIQ2_INSTALL_DIR}/include) ################################################################################ set(REQUIRED_LIBS "") if (LINK_AGAINST_STATIC_LIBNFIQ2) find_library(LIBNFIQ2_STATIC ${CMAKE_STATIC_LIBRARY_PREFIX}nfiq2${CMAKE_STATIC_LIBRARY_SUFFIX} PATHS ${NFIQ2_INSTALL_DIR}/lib REQUIRED) find_library(LIBFRFXLL_STATIC ${CMAKE_STATIC_LIBRARY_PREFIX}FRFXLL_static${CMAKE_STATIC_LIBRARY_SUFFIX} PATHS ${NFIQ2_INSTALL_DIR}/lib REQUIRED) set(OpenCV_STATIC ON) find_package(OpenCV REQUIRED HINTS ${NFIQ2_INSTALL_DIR}/lib/cmake/opencv4 ${NFIQ2_INSTALL_DIR}) list(APPEND REQUIRED_LIBS ${LIBNFIQ2_STATIC} ${LIBFRFXLL_STATIC} ${OpenCV_LIBS}) # Static Windows runtime if (MSVC) foreach(flag_var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE) if(${flag_var} MATCHES "/MD") string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") endif() if(${flag_var} MATCHES "/MDd") string(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}") endif() endforeach(flag_var) endif() else() find_library(LIBNFIQ2_SHARED nfiq2 PATHS ${NFIQ2_INSTALL_DIR}/lib ${NFIQ2_INSTALL_DIR}/nfiq2/lib REQUIRED) list(APPEND REQUIRED_LIBS ${LIBNFIQ2_SHARED}) endif() set(ALL_TARGETS "") ################################################################################ # # Tool that prints the names of all NFIQ 2 native quality measures. # add_executable(print_native_quality_measure_names print_native_quality_measure_names.cpp) target_link_libraries(print_native_quality_measure_names ${REQUIRED_LIBS}) set_target_properties(print_native_quality_measure_names PROPERTIES MACOSX_RPATH YES CXX_STANDARD 11 CXX_STANDARD_REQUIRED YES CXX_EXTENSIONS NO) list(APPEND ALL_TARGETS print_native_quality_measure_names) # # Tool that computes quality scores # add_executable(example_api example_api.cpp) target_link_libraries(example_api ${REQUIRED_LIBS}) target_include_directories(example_api PRIVATE ${OpenCV_INCLUDE_DIRS}) set_target_properties(example_api PROPERTIES MACOSX_RPATH YES CXX_STANDARD 11 CXX_STANDARD_REQUIRED YES CXX_EXTENSIONS NO) list(APPEND ALL_TARGETS example_api) if (NFIQ2_EMBEDDED_MODEL) target_compile_definitions(example_api PUBLIC NFIQ2_EMBEDDED_MODEL) endif() ################################################################################ # Enable warnings for all targets if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU") set(WARNING_FLAGS -Wall -Wextra -Wconversion -Wsign-conversion -pedantic) elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set(WARNING_FLAGS /W4) endif() if (WARNING_FLAGS) set_target_properties(${ALL_TARGETS} PROPERTIES COMPILE_OPTIONS "${WARNING_FLAGS}") endif() ################################################################################ ``` -------------------------------- ### Windows CMake Build Example with vcpkg Source: https://github.com/usnistgov/nfiq2/blob/master/README.md Example of how to build NFIQ 2 on Windows using vcpkg for dependency management, targeting a 64-bit Release-only build. ```bash cmake .. -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_CONFIGURATION_TYPES=Release -A x64 cmake --build . --config Release ``` -------------------------------- ### Windows WiX Installer Configuration Source: https://github.com/usnistgov/nfiq2/blob/master/CMakeLists.txt Configures the WiX installer for Windows, including GUID generation and versioning. ```cmake elseif (CMAKE_SYSTEM_NAME MATCHES "Windows") # Install WiX from https://wixtoolset.org/releases/ list(APPEND CPACK_GENERATOR "WIX") set(CPACK_PACKAGE_INSTALL_DIRECTORY "NFIQ 2") if (CMAKE_SIZEOF_VOID_P MATCHES "8") # 64-bit GUID set(CPACK_WIX_UPGRADE_GUID "492101f0-5052-11eb-bb05-1b5668cc0087") set(CPACK_PACKAGE_NAME "${NFIQ2_PRODUCT_NAME} (x64)") else() #32-bit GUID set(CPACK_WIX_UPGRADE_GUID "226c3d8e-a622-fe6a-7c2d-3d3dc93eaacb") set(CPACK_PACKAGE_NAME "${NFIQ2_PRODUCT_NAME} (x86)") endif(CMAKE_SIZEOF_VOID_P MATCHES "8") # Required for building on NIST machines set(CPACK_WIX_CANDLE_EXTRA_FLAGS "-fips") # WiX doesn't allow non-integer versions if (NOT "${NFIQ2_VERSION_STATUS}" STREQUAL "") set(WIX_MAJOR ${NFIQ2_VERSION_MAJOR}) set(WIX_MINOR ${NFIQ2_VERSION_MINOR}) set(WIX_PATCH ${NFIQ2_VERSION_PATCH}) set(WIX_STATUS "901") # Major version pre-release (3.0.0 -> 2.999.999.900) if (${WIX_MINOR} STREQUAL "0" AND ${WIX_PATCH} STREQUAL "0") math(EXPR WIX_MAJOR "${WIX_MAJOR} - 1") set(WIX_MINOR 999) set(WIX_PATCH 999) # Minor version pre-release (2.1.0 -> 2.0.999.900) elseif (${WIX_PATCH} STREQUAL "0" AND NOT ${WIX_MINOR} STREQUAL "0") math(EXPR WIX_MINOR "${WIX_MINOR} - 1") set(WIX_PATCH 999) # Patch version pre-release (2.1.2 -> 2.1.1.900) elseif (NOT ${WIX_PATCH} STREQUAL "0" AND NOT ${WIX_MINOR} STREQUAL "0") math(EXPR WIX_PATCH "${WIX_PATCH} - 1") endif() set(CPACK_PACKAGE_VERSION "${WIX_MAJOR}.${WIX_MINOR}.${WIX_PATCH}.${WIX_STATUS}") set(CPACK_PACKAGE_VERSION_MAJOR "${WIX_MAJOR}") set(CPACK_PACKAGE_VERSION_MINOR "${WIX_MINOR}") set(CPACK_PACKAGE_VERSION_PATCH "${WIX_PATCH}") endif() if (CMAKE_SIZEOF_VOID_P EQUAL 8) set(CPACK_SYSTEM_NAME "win64") else() set(CPACK_SYSTEM_NAME "win32") endif() set(CPACK_PACKAGE_FILE_NAME "nfiq2-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}") ``` -------------------------------- ### Static Library Installation Source: https://github.com/usnistgov/nfiq2/blob/master/NFIQ2/NFIQ2Algorithm/CMakeLists.txt Installs the NFIQ2 static library, including its archive, library, and public header files. ```cmake install(TARGETS ${NFIQ2_STATIC_LIBRARY_TARGET} ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" COMPONENT install_staging) ``` -------------------------------- ### Unix Installation Source: https://github.com/usnistgov/nfiq2/blob/master/CMakeLists.txt Configures installation for Unix systems, including setting the install prefix and creating a symbolic link for the nfiq2 executable. ```cmake if (UNIX) set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local") # Make a link (/usr/local/bin/nfiq2 -> /usr/local/nfiq2/bin/nfiq2) using # ln instead of cmake -E create_symlink because it does not have to be an absolute path and the destination does not have to exist when created. install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${INSTALL_STAGING_DIR}/../bin)" COMPONENT nfiq2_cli) install(CODE "execute_process(COMMAND ln -s -f \"../nfiq2/bin/nfiq2\" \"nfiq2\" WORKING_DIRECTORY \"${INSTALL_STAGING_DIR}/../bin\")" COMPONENT nfiq2_cli) install(FILES "${INSTALL_STAGING_DIR}/../bin/nfiq2" DESTINATION "${ORIGINAL_CMAKE_INSTALL_BINDIR}" COMPONENT nfiq2_cli) endif (UNIX) ``` -------------------------------- ### Installation Rules Source: https://github.com/usnistgov/nfiq2/blob/master/NFIQ2/NFIQ2Api/CMakeLists.txt This snippet defines the installation rules for the NFIQ2Api library, specifying the destinations for runtime files, libraries, archives, and public headers. ```cmake install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT install_staging) ``` -------------------------------- ### macOS Code Signing and Notarization Example Source: https://github.com/usnistgov/nfiq2/wiki/Code-Signing Example commands to set up notarytool credentials, retrieve developer ID certificate names, and configure CMake for code signing and notarization on macOS. ```bash # One time: Create a notarytool credentials profile notarytool_profile="notarytool-profile" xcrun notarytool store-credentials ${notarytool_profile} # Grab Developer ID certificate names from Keychain if [ "$(security -q find-identity -v | grep -c \"Developer ID Application\")" -ne \"1\" ] && [ "$(security -q find-identity -v | grep -c \"Developer ID Installer\")" -ne \"1\" ]; then echo "Could not isolate Developer ID identities in Keychain" exit fi app_devid=$(security -q find-identity -v | grep -c \"Developer ID Application\" | sed 's/.*\"\(.*\)\".*/\1/') installer_devid=$(security -q find-identity -v | grep -c \"Developer ID Installer\" | sed 's/.*\"\(.*\)\".*/\1/') cmake .. -DMACOS_CODESIGN=ON -DMACOS_APPLICATION_SIGNING_IDENTITY="${app_devid}" -DMACOS_INSTALLER_SIGNING_IDENTITY="${installer_devid}" -DMACOS_NOTARYTOOL_PROFILE="${notarytool_profile}" make cpack make notarize make staple ``` -------------------------------- ### Testing API Output Consistency Source: https://github.com/usnistgov/nfiq2/blob/master/examples/README.md This command performs a diff between the expected output file and the generated output file to ensure score consistency. ```bash diff SFinGe_Test_0X_output.txt Your_SFinGe_Test_0X_output.txt ``` -------------------------------- ### Example Git Hook Script for clang-format Source: https://github.com/usnistgov/nfiq2/blob/master/CONTRIBUTING.md A sample git hook script to automatically format code using clang-format before committing. It includes instructions on placement, execution, and configuration. ```sh #!/bin/sh # 1. Place this file at .git/hooks/prepare-commit-msg # 2. Make that hook file executable # chmod u+x .git/hooks/prepare-commit-msg # 3: Configure your path to clang-format # git config --bool hooks.formatter.run true # git config --path hooks.formatter.path /usr/local/bin/clang-format run_formatter=$(git config --bool hooks.formatter.run) formatter_exe=$(git config --path hooks.formatter.path) if [ "${run_formatter}" = "true" ]; then # Look for clang-format binary echo "Formatting code with clang-format..." if ! [ -x "${formatter_exe}" ]; then echo "hooks.formatter.path is not the path to clang-format." exit 1 fi # Determine which files changed changed_sources="$(git diff --cached --name-only --diff-filter=d | \ grep -e '.cpp$' -e '.h$' -e '.hpp$' | \ paste -s -d ';' -)" if [ "${changed_sources}" = "" ]; then # No files to style exit 0 fi old_ifs="${IFS}" IFS=';' export IFS for file in ${changed_sources}; do # Style with clang-format "${formatter_exe}" -i "${file}" # Add style change git add "${file}" done # Sometimes, clang-format gets really confused for file in ${changed_sources}; do if ! "${formatter_exe}" --Werror --dry-run "${file}"; then echo "You confused clang-format. Please fix the above error." exit 1 fi done IFS="${old_ifs}" export IFS else echo "Formatting pass skipped." fi ``` -------------------------------- ### Calculate NFIQ 2 value for a single image Source: https://github.com/usnistgov/nfiq2/wiki/Frequently-Asked-Questions Command-line examples for calculating the NFIQ 2 value for WSQ and BMP image formats. ```bash # WSQ images ./NFIQ2 SINGLE finger.wsq WSQ false false # BMP images ./NFIQ2 SINGLE finger.bmp BMP false false ``` -------------------------------- ### RPM Package Settings Source: https://github.com/usnistgov/nfiq2/blob/master/CMakeLists.txt Settings for creating RPM packages, including generator, component installation, package names, autoreq settings, and file naming conventions. ```cmake elseif (EXISTS "/etc/redhat-release") set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/local;/usr/local/bin") list(APPEND CPACK_GENERATOR "RPM") set(CPACK_RPM_COMPONENT_INSTALL ON) set(CPACK_RPM_MAIN_COMPONENT nfiq2_cli) set(CPACK_RPM_PACKAGE_NAME "nfiq2") # FIXME: Won't work, because we're installing "files" set(CPACK_RPM_PACKAGE_AUTOREQ YES) set(CPACK_RPM_NFIQ2_CLI_PACKAGE_AUTOREQ 1) set(CPACK_RPM_DEVELOPMENT_PACKAGE_AUTOREQ 1) set(CPACK_RPM_NFIQ2_CLI_PACKAGE_REQUIRES "openssl,openjpeg2,libjpeg-turbo,libpng,libtiff,zlib,libdb-cxx,sqlite,xz-lzma-compat") # We're customizing the package name, so we need to define these ourselves set(CPACK_RPM_PACKAGE_RELEASE 1) execute_process(COMMAND uname -m OUTPUT_VARIABLE CPACK_RPM_PACKAGE_ARCHITECTURE) string(STRIP ${CPACK_RPM_PACKAGE_ARCHITECTURE} CPACK_RPM_PACKAGE_ARCHITECTURE) # Get "Enterprise Linux" revision execute_process(COMMAND cat /etc/redhat-release OUTPUT_VARIABLE EL_REV) string(REGEX REPLACE "[^0-9]" "" EL_REV "${EL_REV}") string(SUBSTRING "${EL_REV}" 0 1 EL_REV) string(PREPEND EL_REV "el") # Spaces allowed, but look weird set(CPACK_RPM_DEVELOPMENT_PACKAGE_NAME "nfiq2-devel") set(CPACK_RPM_NFIQ2_CLI_PACKAGE_NAME "nfiq2") set(CPACK_RPM_NFIQ2_CLI_FILE_NAME "nfiq2-${CPACK_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}.${EL_REV}.${CPACK_RPM_PACKAGE_ARCHITECTURE}.rpm") set(CPACK_RPM_DEVELOPMENT_FILE_NAME "nfiq2-devel-${CPACK_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}.${EL_REV}.${CPACK_RPM_PACKAGE_ARCHITECTURE}.rpm") endif() include(CPack) ``` -------------------------------- ### NFIQ 2 Quick Build (Library + CLI) Source: https://github.com/usnistgov/nfiq2/blob/master/README.md Instructions to clone the repository, create a build directory, configure with CMake (defaulting to include CLI), and build the library and CLI. ```bash git clone --recursive https://github.com/usnistgov/NFIQ2.git cd NFIQ2 mkdir build cd build cmake .. cmake --build . ``` -------------------------------- ### Basic CMake Configuration Source: https://github.com/usnistgov/nfiq2/blob/master/CMakeLists.txt Sets the minimum CMake version, project name, and handles OSX architectures. ```cmake cmake_minimum_required (VERSION 3.3) project( NFIQ2_SUPERBUILD ) string(REPLACE ";" "$" EXTERNALPROJECT_SAFE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}") ``` -------------------------------- ### Path and Standard Settings Source: https://github.com/usnistgov/nfiq2/blob/master/CMakeLists.txt Defines project paths and the C++ standard. ```cmake set( NO_SEARCH TRUE ) set( ROOT_PATH ${PROJECT_SOURCE_DIR} ) set( BUILD_PATH ${CMAKE_CURRENT_BINARY_DIR} ) # ExternalProjects have their own install() that we can't control, and the # `install' target is executed at superbuild build time. To counteract this, we # will set CMAKE_INSTALL_PREFIX to ${INSTALL_STAGING_DIR} for all # ExternalProjects. The superbuild's install and packaging with CPack will copy # this staging directory. set(NFIQ2_CONTAINER_DIR "nfiq2") set(INSTALL_STAGING_DIR "${CMAKE_CURRENT_BINARY_DIR}/install_staging/${NFIQ2_CONTAINER_DIR}") set(CMAKE_CXX_STANDARD 11) ``` -------------------------------- ### NFIQ 2 Build (Library Only) Source: https://github.com/usnistgov/nfiq2/blob/master/README.md Instructions to clone the repository, create a build directory, configure with CMake (disabling CLI), and build the library. ```bash git clone --recursive https://github.com/usnistgov/NFIQ2.git cd NFIQ2 mkdir build cd build cmake .. -DBUILD_NFIQ2_CLI=OFF cmake --build . ``` -------------------------------- ### Version and Library Linking Source: https://github.com/usnistgov/nfiq2/blob/master/NFIQ2/NFIQ2Api/CMakeLists.txt This snippet demonstrates how to include version information from a CMake file and set up library linking directories and targets, including conditional logic for different platforms and build configurations. ```cmake # set and increment version include( "${SUPERBUILD_ROOT_PATH}/NFIQ2/version.cmake" ) include(GNUInstallDirs) link_directories( "${CMAKE_BINARY_DIR}/../../../nfiq2-prefix/src/nfiq2-build" ) link_directories( "${CMAKE_BINARY_DIR}/../../../fingerjetfxose/FingerJetFXOSE/libFRFXLL/src" ) # add targets if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") add_library( ${PROJECT_NAME} SHARED "nfiq2api.def" ${SOURCE_FILES} ${VERSION_FILES} ) else() add_library( ${PROJECT_NAME} SHARED ${SOURCE_FILES} ${VERSION_FILES} ) endif() set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/nfiq2api.h" ) target_compile_definitions("${PROJECT_NAME}" PRIVATE I_UNDERSTAND_THIS_NFIQ2_API_WILL_BE_REMOVED) string( REPLACE "." "" OPENCV_VERSION2 "${OPENCV_VERSION}") if("${TARGET_PLATFORM}" MATCHES "win*") # remove the lib prefix for Windows set_target_properties( ${PROJECT_NAME} PROPERTIES PREFIX "" ) endif() # add required link libraries set( PROJECT_LIBS nfiq2 FRFXLL_static ) if( USE_SANITIZER ) target_link_libraries( ${PROJECT_NAME} "asan" ) endif() if (EMBED_RANDOM_FOREST_PARAMETERS) target_compile_definitions(${PROJECT_NAME} PUBLIC "NFIQ2_EMBED_RANDOM_FOREST_PARAMETERS") target_compile_definitions(${PROJECT_NAME} PUBLIC "NFIQ2_EMBEDDED_RANDOM_FOREST_PARAMETERS_FCT=${EMBEDDED_RANDOM_FOREST_PARAMETER_FCT}") endif() if("${TARGET_PLATFORM}" MATCHES "win*") if( "${OPENCV_VERSION}" MATCHES "^3.*" ) set( PROJECT_LIBS ${PROJECT_LIBS} ws2_32 ) else() set( PROJECT_LIBS ${PROJECT_LIBS} ws2_32 ) endif() elseif("${TARGET_PLATFORM}" MATCHES "android*") find_package(Threads REQUIRED) set( PROJECT_LIBS ${PROJECT_LIBS} ${CMAKE_THREAD_LIBS_INIT} android log ) else() find_package(Threads REQUIRED) set( PROJECT_LIBS ${PROJECT_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS} ) endif() target_link_libraries( "${PROJECT_NAME}" ${PROJECT_LIBS} ${OpenCV_LIBS} ) ``` -------------------------------- ### Project Configuration Source: https://github.com/usnistgov/nfiq2/blob/master/NFIQ2/NFIQ2Algorithm/CMakeLists.txt Sets the minimum CMake version, project name, and C++ standard. ```cmake cmake_minimum_required (VERSION 3.3) project( nfiq2 ) set (CMAKE_CXX_STANDARD 11) ``` -------------------------------- ### NFIQ2 CLI Build Configuration Source: https://github.com/usnistgov/nfiq2/blob/master/NFIQ2/NFIQ2Algorithm/CMakeLists.txt This snippet defines the build process for the NFIQ2 command-line interface application, including adding source files, linking libraries, and setting target properties. ```cmake if (BUILD_NFIQ2_CLI) set( NFIQ2_TEST_APP "nfiq2-bin" ) add_executable(${NFIQ2_TEST_APP} "${CMAKE_CURRENT_SOURCE_DIR}/src/tool/nfiq2_ui_refresh.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/src/tool/nfiq2_ui_log.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/src/tool/nfiq2_ui_utils.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/src/tool/nfiq2_ui_exception.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/src/tool/nfiq2_ui_threadedlog.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/src/tool/nfiq2_ui_image.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/src/tool/nfiq2_ui_types.cpp" ) if( USE_SANITIZER ) target_link_libraries( ${NFIQ2_TEST_APP} "asan" ) endif() # set the required libraries add_dependencies(${NFIQ2_TEST_APP} ${NFIQ2_STATIC_LIBRARY_TARGET}) set( PROJECT_LIBS ${NFIQ2_STATIC_LIBRARY_TARGET} ) if("${TARGET_PLATFORM}" MATCHES "win*") add_definitions("-DNOMINMAX") set( PROJECT_LIBS ${PROJECT_LIBS} ws2_32 ) elseif("${TARGET_PLATFORM}" MATCHES "android*") find_package(Threads REQUIRED) set( PROJECT_LIBS ${PROJECT_LIBS} ${CMAKE_THREAD_LIBS_INIT} log ${CMAKE_DL_LIBS} ) else() find_package(Threads REQUIRED) set( PROJECT_LIBS ${PROJECT_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS} ) endif() target_link_libraries( ${NFIQ2_TEST_APP} ${PROJECT_LIBS} ) # Windows builds require crypt32 supplemental library for OpenSSL if(MSVC) target_link_libraries(${NFIQ2_TEST_APP} "crypt32") endif() if(MSVC) target_link_libraries(${NFIQ2_TEST_APP} ${CMAKE_BINARY_DIR}/../../../nfir-prefix/src/nfir-build/$<:$<$:Debug/>$<$:Release/>>${CMAKE_STATIC_LIBRARY_PREFIX}nfir${CMAKE_STATIC_LIBRARY_SUFFIX}) else() target_link_libraries(${NFIQ2_TEST_APP} ${CMAKE_BINARY_DIR}/../../../nfir-prefix/src/nfir-build/${CMAKE_STATIC_LIBRARY_PREFIX}nfir${CMAKE_STATIC_LIBRARY_SUFFIX}) endif() find_package(biomeval REQUIRED PATHS ${CMAKE_BINARY_DIR}/../../../libbiomeval-prefix/src/libbiomeval-build) target_link_libraries(${NFIQ2_TEST_APP} biomeval::biomeval) # Getopt for Windows if(MSVC) if(CMAKE_SIZEOF_VOID_P EQUAL 4) list(APPEND CMAKE_PREFIX_PATH ${_VCPKG_INSTALLED_DIR}/x86-windows/) elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) list(APPEND CMAKE_PREFIX_PATH ${_VCPKG_INSTALLED_DIR}/x64-windows/) endif() find_library(GETOPT_LIB getopt REQUIRED) find_file(GETOPT_HEADER getopt.h REQUIRED) get_filename_component(GETOPT_HEADER_DIR "${GETOPT_HEADER}" DIRECTORY) target_include_directories(${NFIQ2_TEST_APP} PRIVATE "${GETOPT_HEADER_DIR}") target_link_libraries(${NFIQ2_TEST_APP} "${GETOPT_LIB}") endif() set_target_properties(${NFIQ2_TEST_APP} PROPERTIES RUNTIME_OUTPUT_NAME nfiq2) install(TARGETS ${NFIQ2_TEST_APP} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT install_staging) if (UNIX) install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../nist_plain_tir-ink.txt" "${CMAKE_CURRENT_SOURCE_DIR}/../nist_plain_tir-ink.yaml" DESTINATION ${CMAKE_INSTALL_DATADIR} COMPONENT install_staging) else() install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../nist_plain_tir-ink.txt" "${CMAKE_CURRENT_SOURCE_DIR}/../nist_plain_tir-ink.yaml" DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT install_staging) endif() # Install Man Page for Unix Systems if(UNIX) INSTALL(FILES doc/nfiq2_tool.1 DESTINATION "${CMAKE_INSTALL_MANDIR}/man1" RENAME nfiq2.1 COMPONENT install_staging) endif() # Copies getopt dll for Windows builds if(MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 4) install(FILES ${_VCPKG_INSTALLED_DIR}/x86-windows/bin/getopt.dll DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT install_staging) endif() if(MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 8) install(FILES ${_VCPKG_INSTALLED_DIR}/x64-windows/bin/getopt.dll DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT install_staging) endif() endif(BUILD_NFIQ2_CLI) ``` -------------------------------- ### Add Subdirectory Source: https://github.com/usnistgov/nfiq2/blob/master/CMakeLists.txt Adds the FingerJetFXOSE library source as a subdirectory. ```cmake add_subdirectory("${ROOT_PATH}/fingerjetfxose/FingerJetFXOSE/libFRFXLL/src/" "${BUILD_PATH}/fingerjetfxose/FingerJetFXOSE/libFRFXLL/src/") ``` -------------------------------- ### Include CMake Modules Source: https://github.com/usnistgov/nfiq2/blob/master/CMakeLists.txt Includes various CMake modules for configuration. ```cmake # set colors for cmake comand line include( "${ROOT_PATH}/cmake/colors.cmake" ) # detect target platform include( "${ROOT_PATH}/cmake/target.cmake" ) # setup compiler include( "${ROOT_PATH}/cmake/compiler.cmake" ) # include special settings for fingerjetfxose include( "${ROOT_PATH}/cmake/fingerjetfxose.cmake" ) ``` -------------------------------- ### Include Directories Source: https://github.com/usnistgov/nfiq2/blob/master/NFIQ2/NFIQ2Algorithm/CMakeLists.txt Adds various include directories for the project and its dependencies. ```cmake include_directories("${CMAKE_BINARY_DIR}") include_directories("${CMAKE_CURRENT_SOURCE_DIR}") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include") # add libbiomeval include directories include_directories("${SUPERBUILD_ROOT_PATH}/libbiomeval/src/include") include_directories("${SUPERBUILD_ROOT_PATH}/fingerjetfxose/FingerJetFXOSE/libFRFXLL/include") include_directories("${SUPERBUILD_ROOT_PATH}/digestpp") include_directories("${SUPERBUILD_ROOT_PATH}/NFIR/include") ``` -------------------------------- ### Version Header Configuration Source: https://github.com/usnistgov/nfiq2/blob/master/NFIQ2/NFIQ2Algorithm/CMakeLists.txt Configures the version header file for the project. ```cmake # Configure version header include("${SUPERBUILD_ROOT_PATH}/NFIQ2/version.cmake") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/nfiq2/version.cpp.in" "${CMAKE_CURRENT_SOURCE_DIR}/src/nfiq2/version.cpp") ``` -------------------------------- ### macOS Code Signing Options Source: https://github.com/usnistgov/nfiq2/blob/master/CMakeLists.txt Configuration options for macOS code signing and static library dependencies. ```cmake # macOS Code Signing option(MACOS_CODESIGN "Sign the macOS binaries and package installers" OFF) set(MACOS_APPLICATION_SIGNING_IDENTITY "" CACHE STRING "Apple Developer ID for applications") set(MACOS_INSTALLER_SIGNING_IDENTITY "" CACHE STRING "Apple Developer ID for installers") set(MACOS_NOTARYTOOL_PROFILE "" CACHE STRING "Name of notarytool credential profile stored in Keychain (insert these with `xcrun notarytool store-credentials')") option(MACOS_FORCE_STATIC "Force static library dependencies only" OFF) ``` -------------------------------- ### Synopsis - Batch files Source: https://github.com/usnistgov/nfiq2/blob/master/NFIQ2/NFIQ2Algorithm/doc/nfiq2_tool.1.md Command-line syntax for processing multiple image files listed in batch files. ```bash nfiq2 [OPTION...] -f _batchfile_ [-f _batchfile_ ...] ``` -------------------------------- ### Build Options Source: https://github.com/usnistgov/nfiq2/blob/master/CMakeLists.txt Defines build options for the NFIQ2 CLI and embedding random forest parameters. ```cmake option(BUILD_NFIQ2_CLI "Build the Command-line Interface for NFIQ2" ON) # Options for embedding random forest parameters option(EMBED_RANDOM_FOREST_PARAMETERS "Embed random forest parameters in library" OFF) set(EMBEDDED_RANDOM_FOREST_PARAMETER_FCT "0" CACHE STRING "ANSI/NIST-ITL 1-2011: Update 2015 friction ridge capture technology (FRCT) code for parameters to embed") set(EMBEDDING_CMAKE_ARGS -DEMBEDDED_RANDOM_FOREST_PARAMETER_FCT=${EMBEDDED_RANDOM_FOREST_PARAMETER_FCT}) if(EMBED_RANDOM_FOREST_PARAMETERS) message(STATUS "Embedding random forest parameters") list(APPEND EMBEDDING_CMAKE_ARGS -DEMBED_RANDOM_FOREST_PARAMETERS=${EMBED_RANDOM_FOREST_PARAMETERS}) endif() ``` -------------------------------- ### CPACK Components Source: https://github.com/usnistgov/nfiq2/blob/master/CMakeLists.txt Sets the CPACK components based on the BUILD_NFIQ2_CLI option and defines display names for components. ```cmake if (BUILD_NFIQ2_CLI) set(CPACK_COMPONENTS_ALL nfiq2_cli development) else() set(CPACK_COMPONENTS_ALL development) endif() set(CPACK_COMPONENT_NFIQ2_CLI_DISPLAY_NAME "${NFIQ2_PRODUCT_NAME} Command Line Interface") set(CPACK_COMPONENT_DEVELOPMENT_DISPLAY_NAME "${NFIQ2_PRODUCT_NAME} Development Files") ``` -------------------------------- ### CPack package variables Source: https://github.com/usnistgov/nfiq2/blob/master/CMakeLists.txt Sets CPack variables for package naming, versioning, and descriptions. ```cmake set(CPACK_PACKAGE_NAME "${NFIQ2_PRODUCT_NAME}") set(CPACK_PACKAGE_VENDOR "${NFIQ2_PRODUCT_VENDOR}") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${NFIQ2_PRODUCT_DESCRIPTION_SHORT}") set(CPACK_COMPONENT_NFIQ2_CLI_DESCRIPTION_SUMMARY "${NFIQ2_PRODUCT_DESCRIPTION_SHORT} command-line interface") set(CPACK_COMPONENT_DEVELOPMENT_DESCRIPTION_SUMMARY "${NFIQ2_PRODUCT_DESCRIPTION_SHORT} developer files") set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/usnistgov/nfiq2") set(CPACK_PACKAGE_CONTACT "${NFIQ2_EMAIL}") set(CPACK_PACKAGE_VERSION "${NFIQ2_VERSION}") set(CPACK_PACKAGE_VERSION_MAJOR "${NFIQ2_VERSION_MAJOR}") set(CPACK_PACKAGE_VERSION_MINOR "${NFIQ2_VERSION_MINOR}") set(CPACK_PACKAGE_VERSION_PATCH "${NFIQ2_VERSION_PATCH}") ``` -------------------------------- ### Apple (macOS) Packaging Source: https://github.com/usnistgov/nfiq2/blob/master/CMakeLists.txt Configures packaging for macOS, setting the generator to 'productbuild' and defining the package file name based on version and architecture. ```cmake if (APPLE) list(APPEND CPACK_GENERATOR "productbuild") execute_process(COMMAND sw_vers -productVersion OUTPUT_VARIABLE OSX_VERS) string(STRIP "${OSX_VERS}" OSX_VERS) execute_process(COMMAND uname -m OUTPUT_VARIABLE MAC_ARCH) string(STRIP "${MAC_ARCH}" MAC_ARCH) set(CPACK_PACKAGE_FILE_NAME "nfiq2-${CPACK_PACKAGE_VERSION}-macos-${OSX_VERS}-${MAC_ARCH}") set(CPACK_PRODUCTBUILD_IDENTIFIER "gov.nist.nfiq2") # set(CPACK_PRODUCTBUILD_RESOURCES_DIR "productbuild_resources") # file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${CPACK_PRODUCTBUILD_RESOURCES_DIR}") # file(COPY "${ROOT_PATH}/cmake/nist_itl_two_color.svg" DESTINATION "${CPACK_PRODUCTBUILD_RESOURCES_DIR}") # # https://developer.apple.com/library/archive/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html # set(CPACK_PRODUCTBUILD_BACKGROUND "nist_itl_two_color.svg") # set(CPACK_PRODUCTBUILD_BACKGROUND_MIME_TYPE "image/svg") # set(CPACK_PRODUCTBUILD_BACKGROUND_ALIGNMENT "bottomleft") ``` -------------------------------- ### Documentation Processing Source: https://github.com/usnistgov/nfiq2/blob/master/CMakeLists.txt This snippet processes README and LICENSE files for packaging, converting them to RTF format using pandoc if available, otherwise copying them as text files. ```cmake find_program(PANDOC pandoc) if (PANDOC) set(DOC_FORMAT "rtf") # Strip remote SVGs from README execute_process(COMMAND grep -v ^\[! "${ROOT_PATH}/README.md" OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/README.md") execute_process(COMMAND sed -i.bak -e s||| "${CMAKE_CURRENT_BINARY_DIR}/README.md") execute_process(COMMAND ${PANDOC} -f markdown_mmd -s --columns 1 -o "${CMAKE_CURRENT_BINARY_DIR}/README.${DOC_FORMAT}" "${CMAKE_CURRENT_BINARY_DIR}/README.md") set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_BINARY_DIR}/README.${DOC_FORMAT}") execute_process(COMMAND ${PANDOC} -f markdown_mmd -s --columns 1 -o "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.${DOC_FORMAT}" "${ROOT_PATH}/LICENSE.md") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.${DOC_FORMAT}") else() file(COPY "${ROOT_PATH}/LICENSE.md" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") file(RENAME "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.md" "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt") file(COPY "${ROOT_PATH}/README.md" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") file(RENAME "${CMAKE_CURRENT_BINARY_DIR}/README.md" "${CMAKE_CURRENT_BINARY_DIR}/README.txt") set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_BINARY_DIR}/README.txt") endif() ``` -------------------------------- ### NFIQ2Api CMake Configuration Source: https://github.com/usnistgov/nfiq2/blob/master/NFIQ2/NFIQ2Api/CMakeLists.txt This snippet shows the main CMake configuration for the NFIQ2Api project, including setting the minimum CMake version, project name, C++ standard, source and header files, include directories, and dependency finding for OpenCV. ```cmake cmake_minimum_required (VERSION 3.3) project( Nfiq2Api ) set(CMAKE_CXX_STANDARD 11) # add files from folder set(SOURCE_FILES "nfiq2api.cpp") set(HEADER_FILES "nfiq2api.h") include( "${SUPERBUILD_ROOT_PATH}/cmake/colors.cmake" ) include( "${SUPERBUILD_ROOT_PATH}/cmake/target.cmake" ) include( "${SUPERBUILD_ROOT_PATH}/cmake/compiler.cmake" ) # add include directories include_directories("${CMAKE_BINARY_DIR}") include_directories("${SUPERBUILD_ROOT_PATH}/NFIQ2/NFIQ2Algorithm") include_directories("${SUPERBUILD_ROOT_PATH}/NFIQ2/NFIQ2Algorithm/include") include_directories("${SUPERBUILD_ROOT_PATH}/fingerjetfxose/download/FingerJetFXOSE-master/src/libFRFXLL/include") set( OpenCV_DIR ${CMAKE_BINARY_DIR}/../../../OpenCV-prefix/src/OpenCV-build) find_package(OpenCV REQUIRED NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH HINTS ${OpenCV_DIR}) set(OpenCV_SHARED ON) include_directories(${OpenCV_INCLUDE}) ``` -------------------------------- ### Forwarding Compiler Flags Source: https://github.com/usnistgov/nfiq2/blob/master/CMakeLists.txt Forwards 32/64-bit compiler flags to build configurations. ```cmake # forwarding 32/64 compiler flags foreach(flag_var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) if (32BITS) set(${flag_var} "${${flag_var}}" -m32) elseif(64BITS) set(${flag_var} "${${flag_var}}" -m64) endif() endforeach(flag_var) ``` -------------------------------- ### Debian Package Settings Source: https://github.com/usnistgov/nfiq2/blob/master/CMakeLists.txt Settings for creating Debian packages, including component descriptions and strict permission settings. ```cmake set(CPACK_PRODUCTBUILD_BACKGROUND_SCALING "none") set(CPACK_DEBIAN_DEVELOPMENT_PACKAGE_NAME "nfiq2-dev") set(CPACK_DEBIAN_NFIQ2_CLI_PACKAGE_NAME "nfiq2") set(CPACK_DEBIAN_NFIQ2_CLI_COMPONENT_DESCRIPTION "${CPACK_COMPONENT_NFIQ2_CLI_DESCRIPTION_SUMMARY}") set(CPACK_DEBIAN_DEVELOPMENT_COMPONENT_DESCRIPTION "${CPACK_COMPONENT_DEVELOPMENT_DESCRIPTION_SUMMARY}") set(CPACK_DEBIAN_NFIQ2_CLI_PACKAGE_CONTROL_STRICT_PERMISSION YES) set(CPACK_DEBIAN_DEVELOPMENT_PACKAGE_CONTROL_STRICT_PERMISSION YES) ``` -------------------------------- ### Synopsis - One or more images, records, directories, or RecordStores Source: https://github.com/usnistgov/nfiq2/blob/master/NFIQ2/NFIQ2Algorithm/doc/nfiq2_tool.1.md Command-line syntax for processing individual image files or directories. ```bash nfiq2 [OPTION...] _path_ [_path_ ...] ``` -------------------------------- ### Multiple Files and Formats Source: https://github.com/usnistgov/nfiq2/blob/master/NFIQ2/NFIQ2Algorithm/doc/nfiq2_tool.1.md Outputs a CSV of unified quality scores for multiple image files and a NIST-ITL record. ```bash nfiq2 print1.wsq print2.png print3.an2 ``` -------------------------------- ### Complex Command with Multiple Arguments Source: https://github.com/usnistgov/nfiq2/blob/master/NFIQ2/NFIQ2Algorithm/doc/nfiq2_tool.1.md Processes specified image files, recursively traverses a directory for more images, and saves all output to a CSV file. ```bash nfiq2 -r -i print1.tif -i fingerprintDir -o output.csv print2.jpg print3.bmp ``` -------------------------------- ### VCPKG CMake arguments Source: https://github.com/usnistgov/nfiq2/blob/master/CMakeLists.txt Sets VCPKG-specific CMake arguments, including verbosity and target triplet, when building with MSVC. ```cmake set(VCPKG_CMAKE_ARGS) if (MSVC) list(APPEND VCPKG_CMAKE_ARGS -DVCPKG_VERBOSE=${VCPKG_VERBOSE} -DVCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET} ) endif() ``` -------------------------------- ### macOS Code Signing Configuration Source: https://github.com/usnistgov/nfiq2/blob/master/CMakeLists.txt Configures code signing and notarization for macOS builds. ```cmake if (MACOS_CODESIGN) if ("${MACOS_APPLICATION_SIGNING_IDENTITY}" STREQUAL "") message(FATAL_ERROR "You must set MACOS_APPLICATION_SIGNING_IDENTITY to your developer identity in order to code sign") endif() if ("${MACOS_INSTALLER_SIGNING_IDENTITY}" STREQUAL "") message(FATAL_ERROR "You must set MACOS_INSTALLER_SIGNING_IDENTITY to your developer identity in order to code sign") endif() set(CPACK_PRODUCTBUILD_IDENTITY_NAME "${MACOS_INSTALLER_SIGNING_IDENTITY}") set(CPACK_PKGBUILD_IDENTITY_NAME "${MACOS_INSTALLER_SIGNING_IDENTITY}") ExternalProject_Add_Step(nfiq2api codesign DEPENDEES install COMMAND codesign --prefix "${CPACK_PRODUCTBUILD_IDENTIFIER}." -f --options runtime --sign "${MACOS_APPLICATION_SIGNING_IDENTITY}" ${INSTALL_STAGING_DIR}/${INSTALL_STAGING_BINDIR}/nfiq2 ${INSTALL_STAGING_DIR}/${INSTALL_STAGING_LIBDIR}/libFRFXLL.dylib ${INSTALL_STAGING_DIR}/${INSTALL_STAGING_LIBDIR}/libNfiq2Api.dylib COMMENT "Codesigning all binaries and dylibs...") # Notarize the installer # XXX: Use CPACK_POST_BUILD_SCRIPTS instead, since this can't depend on packaging if ("${MACOS_NOTARYTOOL_PROFILE}" STREQUAL "") message(FATAL_ERROR "You must set MACOS_NOTARYTOOL_PROFILE to the name of the notarytool credentials stored in your Keychain. Insert these with `xcrun notarytool store-credentials`.") endif() add_custom_target(notarize COMMENT "Notarizing installer package..." COMMAND xcrun notarytool submit "${CMAKE_CURRENT_BINARY_DIR}/${CPACK_PACKAGE_FILE_NAME}.pkg" --keychain-profile "${MACOS_NOTARYTOOL_PROFILE}" --wait VERBATIM) add_custom_target(staple DEPENDS notarize COMMENT "Stapling notarization ticket to installer package..." COMMAND xcrun stapler staple "${CMAKE_CURRENT_BINARY_DIR}/${CPACK_PACKAGE_FILE_NAME}.pkg" VERBATIM) endif() ``` -------------------------------- ### Multi-config Generator Check Source: https://github.com/usnistgov/nfiq2/blob/master/NFIQ2/NFIQ2Algorithm/CMakeLists.txt Determines if the CMake generator supports multi-configuration builds. ```cmake if (${CMAKE_VERSION} VERSION_GREATER "3.8.99999") get_cmake_property(IS_MULTI_CONFIG GENERATOR_IS_MULTI_CONFIG) elseif (MSVC OR Xcode) set(IS_MULTI_CONFIG "ON") else() set(IS_MULTI_CONFIG "OFF") endif() ``` -------------------------------- ### Basic Usage Source: https://github.com/usnistgov/nfiq2/blob/master/NFIQ2/NFIQ2Algorithm/doc/nfiq2_tool.1.md Outputs the unified quality score of a single image file. ```bash nfiq2 print1.wsq ``` -------------------------------- ### Format Conversion and Resampling Source: https://github.com/usnistgov/nfiq2/blob/master/NFIQ2/NFIQ2Algorithm/doc/nfiq2_tool.1.md Processes a directory of mixed fingerprint images, automatically applying quantizing and resampling before outputting native quality scores. ```bash nfiq2 -F mixedFingerprintDir ``` -------------------------------- ### Target Link Libraries Source: https://github.com/usnistgov/nfiq2/blob/master/NFIQ2/NFIQ2Algorithm/CMakeLists.txt Links the NFIQ2 static library against FRFXLL_static and OpenCV libraries. ```cmake target_link_libraries(${NFIQ2_STATIC_LIBRARY_TARGET} PUBLIC FRFXLL_static ${OpenCV_LIBS}) ``` -------------------------------- ### Target Properties Source: https://github.com/usnistgov/nfiq2/blob/master/NFIQ2/NFIQ2Algorithm/CMakeLists.txt Sets target properties for the NFIQ2 static library, including public headers and output name. ```cmake set_target_properties(${NFIQ2_STATIC_LIBRARY_TARGET} PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}" OUTPUT_NAME "nfiq2") ``` -------------------------------- ### ExternalProject_Add for nfiq2 Source: https://github.com/usnistgov/nfiq2/blob/master/CMakeLists.txt Defines the external project 'nfiq2' with specific CMake arguments for building. ```cmake ExternalProject_Add(nfiq2 SOURCE_DIR ${ROOT_PATH}/NFIQ2/NFIQ2Algorithm CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DBUILD_NFIQ2_CLI=${BUILD_NFIQ2_CLI} -DSUPERBUILD_ROOT_PATH=${ROOT_PATH} -DTARGET_PLATFORM=${TARGET_PLATFORM} ${COMPILER_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${INSTALL_STAGING_DIR} ${ANDROID_CMAKE_ARGS} ${IOS_CMAKE_ARGS} ${VCPKG_CMAKE_ARGS} ${MULTI_CONFIG_ARGS} ${EMBEDDING_CMAKE_ARGS} -DCMAKE_OSX_ARCHITECTURES=${EXTERNALPROJECT_SAFE_OSX_ARCHITECTURES} BUILD_ALWAYS YES ) ```