-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cfb754a
commit 5b9bf70
Showing
10 changed files
with
518 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
sources: | ||
"0.2.0": | ||
url: "https://codeload.github.com/tomas-krupa/NFIR/zip/refs/tags/0.2.0" | ||
sha256: "836ad87ae6a25c9a7f361a854d30c25560e7af833a5daeb906e4867f93b16276" | ||
patches: | ||
"0.2.0": | ||
- patch_file: "patches/0001-find-OpenCV-provided-by-conan_toolchain.cmake.patch" | ||
- patch_file: "patches/0002-enable-choose-between-shared-and-static-library.patch" | ||
- patch_file: "patches/0003-add-NFIR-resample-overload.patch" | ||
- patch_file: "patches/0004-set-NFIR-executable-name-to-NFIR_bin-tool.patch" | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from conan import ConanFile | ||
from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain | ||
from conan.tools.files import copy, get, collect_libs | ||
from conan.tools.files import apply_conandata_patches | ||
from os import path | ||
|
||
class NFIRConan(ConanFile): | ||
name = "nfir" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://github.com/usnistgov/NFIR" | ||
topics = ("NIST, NFIR") | ||
license = "NIST" | ||
description = "The NIST Fingerprint Image Resampler NFIR is a library capable of upsampling or downsampling fingerprint images." | ||
settings = "os", "compiler", "build_type", "arch" | ||
options = { "shared": [True, False] } | ||
default_options = { "shared": False } | ||
generators = "CMakeDeps" | ||
package_type = "library" | ||
exports_sources = "CMakeLists.txt", "patches/*" | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def source(self): | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
def requirements(self): | ||
self.requires("opencv/4.10.0") | ||
|
||
def generate(self): | ||
tc = CMakeToolchain(self) | ||
tc.variables["BUILD_SHARED"] = self.options.shared | ||
tc.variables["USE_NFIMM"] = False | ||
tc.variables["_WIN32_64"] = self.settings.os == "Windows" | ||
tc.generate() | ||
|
||
def build(self): | ||
apply_conandata_patches(self) | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def package(self): | ||
copy(self, "*.h", src=path.join(self.source_folder, "src", "include"), dst=path.join(self.package_folder, "include", "NFIR"), keep_path=False) | ||
copy(self, "*.lib", src=self.build_folder, dst=path.join(self.package_folder, "lib"), keep_path=False) | ||
copy(self, "NFIR*", src=path.join(self.build_folder, "bin"), dst=path.join(self.package_folder, "bin"), keep_path=False) | ||
copy(self, "libNFIR*", src=path.join(self.build_folder, "lib"), dst=path.join(self.package_folder, "lib"), keep_path=False) | ||
|
||
def package_info(self): | ||
self.cpp_info.libs = ["NFIR_ITL"] | ||
self.cpp_info.set_property("cmake_file_name", "NFIR") | ||
self.cpp_info.set_property("cmake_target_name", f"NFIR::NFIR") | ||
bindir = path.join(self.package_folder, "bin") | ||
self.runenv_info.append_path("PATH", bindir) | ||
self.buildenv_info.append_path("PATH", bindir) | ||
self.env_info.PATH.append(bindir) |
65 changes: 65 additions & 0 deletions
65
recipes/nfir/all/patches/0001-find-OpenCV-provided-by-conan_toolchain.cmake.patch
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
From 6a33009da09e903eb55a22b96de169d43c39fe38 Mon Sep 17 00:00:00 2001 | ||
From: Tomas Krupa <[email protected]> | ||
Date: Mon, 24 Feb 2025 11:22:41 +0100 | ||
Subject: [PATCH] find OpenCV provided by conan_toolchain.cmake | ||
|
||
--- | ||
src/lib/CMakeLists.txt | 22 ++++++++++++---------- | ||
1 file changed, 12 insertions(+), 10 deletions(-) | ||
|
||
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt | ||
index 12b3047..e8f87c6 100644 | ||
--- a/src/lib/CMakeLists.txt | ||
+++ b/src/lib/CMakeLists.txt | ||
@@ -14,24 +14,26 @@ add_library( ${PROJECT_NAME} ${sources} ) | ||
# resample_up.cpp | ||
# ) | ||
|
||
+find_package(OpenCV REQUIRED CONFIG) | ||
+target_link_libraries(${PROJECT_NAME} PRIVATE opencv::opencv) | ||
|
||
if(_WIN32_64) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") | ||
message(STATUS "LIB: CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") | ||
|
||
# To access OpenCV, use either these two lines below: | ||
- include(D:/OpenCV/opencv-4.5.0/build/x64/vc15/lib/OpenCVConfig.cmake) | ||
- target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS}) | ||
+ # include(D:/OpenCV/opencv-4.5.0/build/x64/vc15/lib/OpenCVConfig.cmake) | ||
+ # target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS}) | ||
|
||
# Or to access OpenCV, use these two lines below: | ||
# set(OpenCV_DIR "D:/OpenCV/opencv-4.5.0/build/x64/vc15/lib/") | ||
# find_package(OpenCV REQUIRED) | ||
|
||
- message(STATUS "OpenCV_INCLUDE_DIRS found as: '${OpenCV_INCLUDE_DIRS}'") | ||
- message(STATUS "OpenCV_LIBS found as: '${OpenCV_LIBS}'") | ||
+ # message(STATUS "OpenCV_INCLUDE_DIRS found as: '${OpenCV_INCLUDE_DIRS}'") | ||
+ # message(STATUS "OpenCV_LIBS found as: '${OpenCV_LIBS}'") | ||
|
||
# line below ALWAYS required | ||
- target_include_directories(${PROJECT_NAME} PRIVATE ${OpenCV_INCLUDE_DIRS} ) | ||
+ # target_include_directories(${PROJECT_NAME} PRIVATE ${OpenCV_INCLUDE_DIRS} ) | ||
|
||
if(USE_NFIMM) | ||
target_compile_definitions(${PROJECT_NAME} PUBLIC USE_NFIMM) | ||
@@ -42,11 +44,11 @@ if(_WIN32_64) | ||
|
||
else() | ||
message(STATUS "LIB: CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") | ||
- find_package(PkgConfig REQUIRED) | ||
- pkg_check_modules(OPENCV REQUIRED opencv4) | ||
- target_link_libraries(${PROJECT_NAME} ${OPENCV_LINK_LIBRARIES}) | ||
- target_include_directories(${PROJECT_NAME} PUBLIC ${OPENCV_INCLUDE_DIRS}) | ||
- target_compile_options(${PROJECT_NAME} PUBLIC ${OPENCV_CFLAGS_OTHER}) | ||
+ # find_package(PkgConfig REQUIRED) | ||
+ # pkg_check_modules(OPENCV REQUIRED opencv4) | ||
+ # target_link_libraries(${PROJECT_NAME} ${OPENCV_LINK_LIBRARIES}) | ||
+ # target_include_directories(${PROJECT_NAME} PUBLIC ${OPENCV_INCLUDE_DIRS}) | ||
+ # target_compile_options(${PROJECT_NAME} PUBLIC ${OPENCV_CFLAGS_OTHER}) | ||
|
||
if(USE_NFIMM) | ||
target_compile_definitions(${PROJECT_NAME} PUBLIC USE_NFIMM) | ||
-- | ||
2.34.1 | ||
|
50 changes: 50 additions & 0 deletions
50
recipes/nfir/all/patches/0002-enable-choose-between-shared-and-static-library.patch
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
From c41a24630cefbb2c43a324522b6c6fe4ca994679 Mon Sep 17 00:00:00 2001 | ||
From: Tomas Krupa <[email protected]> | ||
Date: Mon, 24 Feb 2025 12:03:38 +0100 | ||
Subject: [PATCH] enable choose between shared and static library | ||
|
||
--- | ||
CMakeLists.txt | 2 +- | ||
src/lib/CMakeLists.txt | 13 ++++++++++++- | ||
2 files changed, 13 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 2fb3e93..5580958 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -14,7 +14,7 @@ cmake_minimum_required(VERSION 3.10) | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
-project(NFIR_ITL) | ||
+project(NFIR_ITL VERSION 0.2.0) | ||
|
||
# if(USE_OPENCV) | ||
# project(NFIR_ITL VERSION 0.2.1) | ||
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt | ||
index e8f87c6..14f0953 100644 | ||
--- a/src/lib/CMakeLists.txt | ||
+++ b/src/lib/CMakeLists.txt | ||
@@ -4,7 +4,18 @@ project(${PROJECT_NAME}) | ||
option(USE_NFIMM "Enable NFIMM" ON) | ||
|
||
FILE(GLOB sources ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) | ||
-add_library( ${PROJECT_NAME} ${sources} ) | ||
+if(BUILD_SHARED) | ||
+ add_library( ${PROJECT_NAME} SHARED ${sources} ) | ||
+else() | ||
+ add_library( ${PROJECT_NAME} STATIC ${sources} ) | ||
+endif() | ||
+ | ||
+set_target_properties(${PROJECT_NAME} | ||
+ PROPERTIES | ||
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" | ||
+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" | ||
+ ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" | ||
+ PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") | ||
# filter_mask.cpp | ||
# filter_mask_gaussian.cpp | ||
# filter_mask_ideal.cpp | ||
-- | ||
2.34.1 | ||
|
Oops, something went wrong.