diff --git a/CMakeLists.txt b/CMakeLists.txt index 75985b96..5b93a36b 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,17 +54,15 @@ include( "${ROOT_PATH}/cmake/fingerjetfxose.cmake" ) add_subdirectory("${ROOT_PATH}/fingerjetfxose/FingerJetFXOSE/libFRFXLL/src/" "${BUILD_PATH}/fingerjetfxose/FingerJetFXOSE/libFRFXLL/src/") # forwarding 32/64 compiler flags -if( 32BITS) - set( COMPILER_CMAKE_ARGS - -DCMAKE_C_FLAGS="-m32" - -DCMAKE_CXX_FLAGS="-m32" - ) -elseif( 64BITS) - set( COMPILER_CMAKE_ARGS - -DCMAKE_C_FLAGS="-m64" - -DCMAKE_CXX_FLAGS="-m64" - ) -endif() +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) # forwarding android build flags if( NOT "${ANDROID_ABI}" STREQUAL "") @@ -92,17 +90,47 @@ endif() include(ExternalProject) +set(default_build_type "Release") +if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build/configuration to ${default_build_type}") + if (${CMAKE_VERSION} VERSION_GREATER "3.8.99999") + get_cmake_property(IS_MULTI_CONFIG GENERATOR_IS_MULTI_CONFIG) + if (${IS_MULTI_CONFIG}) + set(CMAKE_CONFIGURATION_TYPES "${default_build_type}" CACHE STRING "Build configurations") + set_property(CACHE CMAKE_CONFIGURATION_TYPES PROPERTY STRINGS "Debug" "Release") + else() + set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Build configuration") + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") + endif() + elseif (MSVC OR Xcode) + set(CMAKE_CONFIGURATION_TYPES "${default_build_type}" CACHE STRING "Build configurations") + set_property(CACHE CMAKE_CONFIGURATION_TYPES PROPERTY STRINGS "Debug" "Release") + else() + set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Build configuration") + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") + endif() +endif () + set(MULTI_CONFIG_ARGS) if (${CMAKE_VERSION} VERSION_GREATER "3.8.99999") - if (${GENERATOR_IS_MULTI_CONFIG}) + get_cmake_property(IS_MULTI_CONFIG GENERATOR_IS_MULTI_CONFIG) + if (${IS_MULTI_CONFIG}) list(APPEND MULTI_CONFIG_ARGS -DCMAKE_CONFIGURATION_TYPES=${CMAKE_CONFIGURATION_TYPES} ) + else() + list(APPEND MULTI_CONFIG_ARGS + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + ) endif() elseif (MSVC OR Xcode) list(APPEND MULTI_CONFIG_ARGS -DCMAKE_CONFIGURATION_TYPES=${CMAKE_CONFIGURATION_TYPES} ) +else() + list(APPEND MULTI_CONFIG_ARGS + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + ) endif() set(OPENCV_CMAKE_ARGS @@ -255,6 +283,7 @@ ExternalProject_Add(nfiq2api CMAKE_ARGS -DSUPERBUILD_ROOT_PATH=${ROOT_PATH} ${COMPILER_CMAKE_ARGS} + ${MULTI_CONFIG_ARGS} -DCMAKE_INSTALL_PREFIX=${INSTALL_STAGING_DIR} ${ANDROID_CMAKE_ARGS} ${IOS_CMAKE_ARGS} diff --git a/NFIQ2/NFIQ2Algorithm/CMakeLists.txt b/NFIQ2/NFIQ2Algorithm/CMakeLists.txt index 1a62de08..2e5a595f 100755 --- a/NFIQ2/NFIQ2Algorithm/CMakeLists.txt +++ b/NFIQ2/NFIQ2Algorithm/CMakeLists.txt @@ -13,6 +13,15 @@ endif() include(GNUInstallDirs) + +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() + include( "${SUPERBUILD_ROOT_PATH}/cmake/colors.cmake" ) include( "${SUPERBUILD_ROOT_PATH}/cmake/target.cmake" ) include( "${SUPERBUILD_ROOT_PATH}/cmake/compiler.cmake" ) @@ -107,7 +116,7 @@ endif() # FIXME: Change to "${CMAKE_INSTALL_PREFIX}/lib" once FJFX builds # FIXME: are updated. link_directories("${CMAKE_BINARY_DIR}/../../../fingerjetfxose/FingerJetFXOSE/libFRFXLL/src") -link_directories("${CMAKE_BINARY_DIR}/../../../fingerjetfxose/FingerJetFXOSE/libFRFXLL/src/$<$:Debug>$<$:Release>") +link_directories("${CMAKE_BINARY_DIR}/../../../fingerjetfxose/FingerJetFXOSE/libFRFXLL/src/$<$:$<$:Debug>$<$:Release>>") target_link_libraries(${NFIQ2_STATIC_LIBRARY_TARGET} PUBLIC FRFXLL_static ${OpenCV_LIBS} @@ -239,7 +248,7 @@ install(TARGETS ${NFIQ2_STATIC_LIBRARY_TARGET} # FIXME: FingerJet doesn't have an install target 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} + ${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) diff --git a/NFIQ2/NFIQ2Algorithm/src/features/LCSFeature.cpp b/NFIQ2/NFIQ2Algorithm/src/features/LCSFeature.cpp index bfd7f12a..d0019519 100644 --- a/NFIQ2/NFIQ2Algorithm/src/features/LCSFeature.cpp +++ b/NFIQ2/NFIQ2Algorithm/src/features/LCSFeature.cpp @@ -418,10 +418,10 @@ loclar(cv::Mat &block, const double orientation, const int v1sz_x, cv::Scalar muNWr {}, muNWv {}; if (!NWr.empty()) { - muNWr = mean(NWr, cv::noArray()); + muNWr = cv::mean(NWr, cv::noArray()); } if (!NWv.empty()) { - muNWv = mean(NWv, cv::noArray()); + muNWv = cv::mean(NWv, cv::noArray()); } if ((muNWr.val[0] >= NWrmin) && (muNWr.val[0] <= NWrmax) && diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index 555ef73f..88bce0c5 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -59,19 +59,10 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") set( LINK_3RD_PREFIX "${BUILD_PATH}/opencv-${OPENCV_VERSION}/3rdparty/lib/Release/") # Static-link MS CRT - 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 (DEBUG) -# set(${flag_var} "${${flag_var}} /MDd /nologo") -# else() - set(${flag_var} "${${flag_var}} /MD /nologo") -# endif() - endforeach(flag_var) # if (STATIC_LINK) 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) + 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(${flag_var} MATCHES "/MD") string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") endif() @@ -83,22 +74,22 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") # Disable some "unsafe" warnings 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) - set(${flag_var} "${${flag_var}} /D_CRT_SECURE_NO_WARNINGS /nologo") + 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) + set(${flag_var} "${${flag_var}} /D_CRT_SECURE_NO_WARNINGS") endforeach(flag_var) # Don't show copyright 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) + 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) set(${flag_var} "${${flag_var}} /nologo") endforeach(flag_var) # Show most warnings 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) + 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) set(${flag_var} "${${flag_var}} /W3") endforeach(flag_var)