From edf31a1c69caaf8bbdf25af0e9431e08657bea37 Mon Sep 17 00:00:00 2001 From: Yang Kun <91833768+ikspress@users.noreply.github.com> Date: Sat, 1 Jun 2024 14:24:29 +0800 Subject: [PATCH 1/7] Install `libnfc.pc` on all platforms --- CMakeLists.txt | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a8605fa4..84b3f7c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,28 +126,26 @@ IF(MINGW) ENDIF (NOT DLLTOOL) ENDIF(MINGW) -IF(NOT WIN32) - # Set some pkg-config variables - SET(prefix ${CMAKE_INSTALL_PREFIX}) - SET(exec_prefix ${CMAKE_INSTALL_PREFIX}) - SET(PACKAGE "libnfc") - IF(LIBNFC_DRIVER_PN53X_USB) - SET(PKG_REQ ${PKG_REQ} "libusb") - ENDIF(LIBNFC_DRIVER_PN53X_USB) - IF(LIBNFC_DRIVER_ACR122_USB) - SET(PKG_REQ ${PKG_REQ} "libusb") - ENDIF(LIBNFC_DRIVER_ACR122_USB) - IF(LIBNFC_DRIVER_PCSC) - SET(PKG_REQ ${PKG_REQ} "libpcsclite") - ENDIF(LIBNFC_DRIVER_PCSC) - IF(LIBNFC_DRIVER_ACR122_PCSC) - SET(PKG_REQ ${PKG_REQ} "libpcsclite") - ENDIF(LIBNFC_DRIVER_ACR122_PCSC) - # CMake lists are separated by a semi colon, replace with colon - STRING(REPLACE ";" "," PKG_CONFIG_REQUIRES "${PKG_REQ}") - CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libnfc.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libnfc.pc @ONLY) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libnfc.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) -ENDIF(NOT WIN32) +# Set some pkg-config variables +SET(prefix ${CMAKE_INSTALL_PREFIX}) +SET(exec_prefix ${CMAKE_INSTALL_PREFIX}) +SET(PACKAGE "libnfc") +IF(LIBNFC_DRIVER_PN53X_USB) + SET(PKG_REQ ${PKG_REQ} "libusb") +ENDIF(LIBNFC_DRIVER_PN53X_USB) +IF(LIBNFC_DRIVER_ACR122_USB) + SET(PKG_REQ ${PKG_REQ} "libusb") +ENDIF(LIBNFC_DRIVER_ACR122_USB) +IF(LIBNFC_DRIVER_PCSC) + SET(PKG_REQ ${PKG_REQ} "libpcsclite") +ENDIF(LIBNFC_DRIVER_PCSC) +IF(LIBNFC_DRIVER_ACR122_PCSC) + SET(PKG_REQ ${PKG_REQ} "libpcsclite") +ENDIF(LIBNFC_DRIVER_ACR122_PCSC) +# CMake lists are separated by a semi colon, replace with colon +STRING(REPLACE ";" "," PKG_CONFIG_REQUIRES "${PKG_REQ}") +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libnfc.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libnfc.pc @ONLY) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libnfc.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) INCLUDE(LibnfcDrivers) From 68f744eae5a1967fdf8f61168665466c58f8d4e7 Mon Sep 17 00:00:00 2001 From: Yang Kun <91833768+ikspress@users.noreply.github.com> Date: Sat, 1 Jun 2024 14:26:22 +0800 Subject: [PATCH 2/7] Make fixup_bundle optional --- CMakeLists.txt | 3 +-- examples/CMakeLists.txt | 4 ++-- utils/CMakeLists.txt | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 84b3f7c4..d1895256 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,9 +66,8 @@ ENDIF(LIBNFC_CONFFILES_MODE) option (BUILD_EXAMPLES "build examples ON/OFF" ON) option (BUILD_UTILS "build utils ON/OFF" ON) - option (BUILD_DEBPKG "build debian package ON/OFF" OFF) - +option (FIXUP_BUNDLE "generate a standalone application" OFF) # Doxygen SET(builddir "${CMAKE_BINARY_DIR}") diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 01a93c9b..a6fcfdd1 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -42,11 +42,11 @@ FOREACH(source ${EXAMPLES-SOURCES}) ENDFOREACH(source) #install required libraries -IF(WIN32) +IF(FIXUP_BUNDLE) INCLUDE(InstallRequiredSystemLibraries) CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/FixBundle.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake @ONLY) INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake) -ENDIF(WIN32) +ENDIF(FIXUP_BUNDLE) IF(NOT WIN32) # Manuals for the examples diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index b9c723ea..bf77470a 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -56,11 +56,11 @@ FOREACH(source ${UTILS-SOURCES}) ENDFOREACH(source) #install required libraries -IF(WIN32) +IF(FIXUP_BUNDLE) INCLUDE(InstallRequiredSystemLibraries) CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/FixBundle.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake @ONLY) INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake) -ENDIF(WIN32) +ENDIF(FIXUP_BUNDLE) IF(NOT WIN32) # Manuals for the examples From e9f341829753ffc769afd3d891e38db04950e951 Mon Sep 17 00:00:00 2001 From: Yang Kun <91833768+ikspress@users.noreply.github.com> Date: Sat, 1 Jun 2024 14:27:42 +0800 Subject: [PATCH 3/7] Make install man-pages optional --- CMakeLists.txt | 1 + examples/CMakeLists.txt | 4 ++-- utils/CMakeLists.txt | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d1895256..8d28a245 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,6 +68,7 @@ option (BUILD_EXAMPLES "build examples ON/OFF" ON) option (BUILD_UTILS "build utils ON/OFF" ON) option (BUILD_DEBPKG "build debian package ON/OFF" OFF) option (FIXUP_BUNDLE "generate a standalone application" OFF) +option (LIBNFC_MAN "install man-pages" ON) # Doxygen SET(builddir "${CMAKE_BINARY_DIR}") diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index a6fcfdd1..1affdfd2 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -48,8 +48,8 @@ IF(FIXUP_BUNDLE) INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake) ENDIF(FIXUP_BUNDLE) -IF(NOT WIN32) +IF(LIBNFC_MAN) # Manuals for the examples FILE(GLOB manuals "${CMAKE_CURRENT_SOURCE_DIR}/*.1") INSTALL(FILES ${manuals} DESTINATION ${SHARE_INSTALL_PREFIX}/man/man1 COMPONENT manuals) -ENDIF(NOT WIN32) +ENDIF(LIBNFC_MAN) diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index bf77470a..311d1aab 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -62,8 +62,8 @@ IF(FIXUP_BUNDLE) INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake) ENDIF(FIXUP_BUNDLE) -IF(NOT WIN32) +IF(LIBNFC_MAN) # Manuals for the examples FILE(GLOB manuals "${CMAKE_CURRENT_SOURCE_DIR}/*.1") INSTALL(FILES ${manuals} DESTINATION ${SHARE_INSTALL_PREFIX}/man/man1 COMPONENT manuals) -ENDIF(NOT WIN32) +ENDIF(LIBNFC_MAN) From 2e5ce83ffc3454a446876e1bd4c3077a3b51422d Mon Sep 17 00:00:00 2001 From: Yang Kun <91833768+ikspress@users.noreply.github.com> Date: Wed, 12 Jun 2024 07:31:23 +0800 Subject: [PATCH 4/7] Remove FixBundle.cmake --- CMakeLists.txt | 1 - cmake/FixBundle.cmake.in | 11 ----------- examples/CMakeLists.txt | 7 ------- utils/CMakeLists.txt | 7 ------- 4 files changed, 26 deletions(-) delete mode 100644 cmake/FixBundle.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d28a245..9f301f1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,6 @@ ENDIF(LIBNFC_CONFFILES_MODE) option (BUILD_EXAMPLES "build examples ON/OFF" ON) option (BUILD_UTILS "build utils ON/OFF" ON) option (BUILD_DEBPKG "build debian package ON/OFF" OFF) -option (FIXUP_BUNDLE "generate a standalone application" OFF) option (LIBNFC_MAN "install man-pages" ON) # Doxygen diff --git a/cmake/FixBundle.cmake.in b/cmake/FixBundle.cmake.in deleted file mode 100644 index 6e8f843d..00000000 --- a/cmake/FixBundle.cmake.in +++ /dev/null @@ -1,11 +0,0 @@ -INCLUDE(BundleUtilities) - -# set bundle to the full path of the executable already existing in the install tree -SET(bundle "${CMAKE_INSTALL_PREFIX}/bin/nfc-list@CMAKE_EXECUTABLE_SUFFIX@") - -# set other_libs to a list of additional libs that cannot be reached by dependency analysis -SET(other_libs "") - -SET(dirs "@LIBUSB_LIBRARY_DIR@") - -fixup_bundle("${bundle}" "${other_libs}" "${dirs}") diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 1affdfd2..72be9244 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -41,13 +41,6 @@ FOREACH(source ${EXAMPLES-SOURCES}) INSTALL(TARGETS ${source} RUNTIME DESTINATION bin COMPONENT examples) ENDFOREACH(source) -#install required libraries -IF(FIXUP_BUNDLE) - INCLUDE(InstallRequiredSystemLibraries) - CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/FixBundle.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake @ONLY) - INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake) -ENDIF(FIXUP_BUNDLE) - IF(LIBNFC_MAN) # Manuals for the examples FILE(GLOB manuals "${CMAKE_CURRENT_SOURCE_DIR}/*.1") diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 311d1aab..375ff749 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -55,13 +55,6 @@ FOREACH(source ${UTILS-SOURCES}) INSTALL(TARGETS ${source} RUNTIME DESTINATION bin COMPONENT utils) ENDFOREACH(source) -#install required libraries -IF(FIXUP_BUNDLE) - INCLUDE(InstallRequiredSystemLibraries) - CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/FixBundle.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake @ONLY) - INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake) -ENDIF(FIXUP_BUNDLE) - IF(LIBNFC_MAN) # Manuals for the examples FILE(GLOB manuals "${CMAKE_CURRENT_SOURCE_DIR}/*.1") From 15631cfa05e0380bd2bb88248b7ee44f83743ca3 Mon Sep 17 00:00:00 2001 From: Yang Kun <91833768+ikspress@users.noreply.github.com> Date: Sun, 16 Jun 2024 15:42:44 +0800 Subject: [PATCH 5/7] Remove libusb in LibNFCConfig.cmake --- CMakeLists.txt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f301f1b..de51103f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -207,20 +207,15 @@ if (NOT MSVC) set ( LIBNFC_INCLUDE_DIR ${includedir} ) set ( LIBNFC_INCLUDE_DIRS ${LIBNFC_INCLUDE_DIR} ) - list ( APPEND LIBNFC_INCLUDE_DIRS ${LIBUSB_INCLUDE_DIRS} ) set ( LIBNFC_LIBRARY nfc ) set ( LIBNFC_LIBRARIES ${LIBNFC_LIBRARY} ) - list ( APPEND LIBNFC_LIBRARIES ${LIBUSB_LIBRARIES} ) set ( LIBNFC_LIBRARY_DIRS ${libdir} ) set ( LIBNFC_ROOT_DIR ${prefix} ) set ( LIBNFC_VERSION_STRING ${VERSION} ) set ( LIBNFC_VERSION_MAJOR ${VERSION_MAJOR} ) set ( LIBNFC_VERSION_MINOR ${VERSION_MINOR} ) set ( LIBNFC_VERSION_PATCH ${VERSION_PATCH} ) - set ( LIBNFC_USE_FILE ${CMAKE_INSTALL_PREFIX}/${LIBNFC_CMAKE_CONFIG_DIR}/UseLibNFC.cmake ) - - if(CMAKE_VERSION VERSION_LESS 2.8.8) configure_file ( cmake/LibNFCConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LibNFCConfig.cmake @ONLY ) From a9b8535e5c6878c5d01d3befce2b2a3465e79f09 Mon Sep 17 00:00:00 2001 From: Yang Kun <91833768+ikspress@users.noreply.github.com> Date: Tue, 18 Jun 2024 20:42:32 +0800 Subject: [PATCH 6/7] Remove libpcsclite on Windows --- CMakeLists.txt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index de51103f..bc6f7ece 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,12 +135,16 @@ ENDIF(LIBNFC_DRIVER_PN53X_USB) IF(LIBNFC_DRIVER_ACR122_USB) SET(PKG_REQ ${PKG_REQ} "libusb") ENDIF(LIBNFC_DRIVER_ACR122_USB) -IF(LIBNFC_DRIVER_PCSC) - SET(PKG_REQ ${PKG_REQ} "libpcsclite") -ENDIF(LIBNFC_DRIVER_PCSC) -IF(LIBNFC_DRIVER_ACR122_PCSC) - SET(PKG_REQ ${PKG_REQ} "libpcsclite") -ENDIF(LIBNFC_DRIVER_ACR122_PCSC) +IF(NOT WIN32) + IF(LIBNFC_DRIVER_PCSC) + SET(PKG_REQ ${PKG_REQ} "libpcsclite") + ENDIF(LIBNFC_DRIVER_PCSC) + IF(LIBNFC_DRIVER_ACR122_PCSC) + SET(PKG_REQ ${PKG_REQ} "libpcsclite") + ENDIF(LIBNFC_DRIVER_ACR122_PCSC) +ENDIF(NOT WIN32) +LIST(REMOVE_DUPLICATES PKG_REQ) +LIST(SORT PKG_REQ) # CMake lists are separated by a semi colon, replace with colon STRING(REPLACE ";" "," PKG_CONFIG_REQUIRES "${PKG_REQ}") CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libnfc.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libnfc.pc @ONLY) From 27313a57259cec1b53638c1641e6f9d2de681a76 Mon Sep 17 00:00:00 2001 From: Yang Kun <91833768+ikspress@users.noreply.github.com> Date: Fri, 21 Jun 2024 10:18:21 +0800 Subject: [PATCH 7/7] Remove libusb on Windows --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bc6f7ece..999d20d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,13 +129,13 @@ ENDIF(MINGW) SET(prefix ${CMAKE_INSTALL_PREFIX}) SET(exec_prefix ${CMAKE_INSTALL_PREFIX}) SET(PACKAGE "libnfc") +IF(NOT WIN32) IF(LIBNFC_DRIVER_PN53X_USB) SET(PKG_REQ ${PKG_REQ} "libusb") ENDIF(LIBNFC_DRIVER_PN53X_USB) IF(LIBNFC_DRIVER_ACR122_USB) SET(PKG_REQ ${PKG_REQ} "libusb") ENDIF(LIBNFC_DRIVER_ACR122_USB) -IF(NOT WIN32) IF(LIBNFC_DRIVER_PCSC) SET(PKG_REQ ${PKG_REQ} "libpcsclite") ENDIF(LIBNFC_DRIVER_PCSC)