[fann] Support UNIX, re-fix installation (#17682)

* [fann] Support UNIX, re-fix installation

* [fann] fix uwp build

* update baseline

* update version record
This commit is contained in:
Jack·Boos·Yu 2021-05-08 05:21:09 +08:00 committed by GitHub
parent da0f1cc2bb
commit 89a8853159
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 143 additions and 40 deletions

View File

@ -1,3 +0,0 @@
Source: fann
Version: 2.2.0-1
Description: Fast Artificial Neural Network (FANN) Library is a free open source neural network library, which implements multilayer artificial neural networks in C with support for both fully connected and sparsely connected networks.

View File

@ -0,0 +1,70 @@
diff --git a/cmake/Modules/DefineInstallationPaths.cmake b/cmake/Modules/DefineInstallationPaths.cmake
index 644cf1b..81e7c74 100644
--- a/cmake/Modules/DefineInstallationPaths.cmake
+++ b/cmake/Modules/DefineInstallationPaths.cmake
@@ -3,7 +3,7 @@ if (UNIX)
MESSAGE(STATUS "${PROJECT_NAME} is used as APPLICATION_NAME")
SET(APPLICATION_NAME ${PROJECT_NAME})
ENDIF (NOT APPLICATION_NAME)
-
+if (0)
# Suffix for Linux
SET(LIB_SUFFIX
CACHE STRING "Define suffix of directory name (32/64)"
@@ -122,9 +122,10 @@ if (UNIX)
CACHE PATH "The ${APPLICATION_NAME} info install dir (default prefix/info)"
FORCE
)
+endif()
endif (UNIX)
-if (WIN32)
+if (0)
# Same same
SET(BIN_INSTALL_DIR .)
SET(SBIN_INSTALL_DIR .)
@@ -134,5 +135,5 @@ if (WIN32)
SET(ICON_INSTALL_DIR .)
SET(SOUND_INSTALL_DIR .)
SET(LOCALE_INSTALL_DIR lang)
-endif (WIN32)
+endif (0)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index fade00c..a4e6c3f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -14,7 +14,7 @@ floatfann.c
ADD_LIBRARY(floatfann SHARED ${floatfann_LIB_SRCS})
SET_TARGET_PROPERTIES(floatfann PROPERTIES VERSION ${VERSION} SOVERSION 2 )
-INSTALL(TARGETS floatfann DESTINATION ${LIB_INSTALL_DIR} )
+INSTALL(TARGETS floatfann RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib )
########### next target ###############
@@ -26,7 +26,7 @@ doublefann.c
ADD_LIBRARY(doublefann SHARED ${doublefann_LIB_SRCS})
SET_TARGET_PROPERTIES(doublefann PROPERTIES VERSION ${VERSION} SOVERSION 2 )
-INSTALL(TARGETS doublefann DESTINATION ${LIB_INSTALL_DIR} )
+INSTALL(TARGETS doublefann RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib )
########### next target ###############
@@ -38,7 +38,7 @@ fixedfann.c
ADD_LIBRARY(fixedfann SHARED ${fixedfann_LIB_SRCS})
SET_TARGET_PROPERTIES(fixedfann PROPERTIES VERSION ${VERSION} SOVERSION 2 )
-INSTALL(TARGETS fixedfann DESTINATION ${LIB_INSTALL_DIR} )
+INSTALL(TARGETS fixedfann RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib )
########### next target ###############
@@ -50,5 +50,5 @@ floatfann.c
ADD_LIBRARY(fann SHARED ${fann_LIB_SRCS})
SET_TARGET_PROPERTIES(fann PROPERTIES VERSION ${VERSION} SOVERSION 2 )
-INSTALL(TARGETS fann DESTINATION ${LIB_INSTALL_DIR} )
+INSTALL(TARGETS fann RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib )

View File

@ -0,0 +1,15 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b91f6fb..22c39d7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,6 +22,10 @@ SET(PKGCONFIG_INSTALL_DIR /lib/pkgconfig)
INSTALL_FILES( ${PKGCONFIG_INSTALL_DIR} FILES fann.pc )
+if (MSVC)
+ add_compile_options(/wd4996)
+endif()
+
ADD_SUBDIRECTORY( src )
################# cpack ################

View File

@ -1,3 +1,4 @@
# Official design
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
vcpkg_from_github(
@ -6,43 +7,55 @@ vcpkg_from_github(
REF 2.2.0
SHA512 b307539a39d93078a489710ac77aa8c6e324f3cf5ef80299ce257d10c043913764abef83aceac5278a5bd243b1ee245b4e8331a9e13c774aa63c9cb604f86bdd
HEAD_REF master
PATCHES
fix-installation.patch
fix-uwp-build.patch
)
set(INSTALL_BASE_DIR_DBG ${CURRENT_PACKAGES_DIR}/debug)
set(INSTALL_BASE_DIR_REL ${CURRENT_PACKAGES_DIR})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS_DEBUG
-DBIN_INSTALL_DIR=${INSTALL_BASE_DIR_DBG}/bin
-DSBIN_INSTALL_DIR=${INSTALL_BASE_DIR_DBG}/sbin
-DLIB_INSTALL_DIR=${INSTALL_BASE_DIR_DBG}/bin
-DEXEC_INSTALL_PREFIX=${INSTALL_BASE_DIR_DBG}/tools/${PORT}
-DXDG_APPS_DIR=${INSTALL_BASE_DIR_DBG}/tools/${PORT}
-DPLUGIN_INSTALL_DIR=${INSTALL_BASE_DIR_DBG}/tools/${PORT}
-DSHARE_INSTALL_PREFIX=${INSTALL_BASE_DIR_DBG}/share/${PORT}
-DDATA_INSTALL_PREFIX=${INSTALL_BASE_DIR_DBG}/share/${PORT}
-DHTML_INSTALL_DIR=${INSTALL_BASE_DIR_DBG}/share/${PORT}/doc
-DICON_INSTALL_DIR=${INSTALL_BASE_DIR_DBG}/share/${PORT}/data/icons
-DSOUND_INSTALL_DIR=${INSTALL_BASE_DIR_DBG}/share/${PORT}/sounds
-DLOCALE_INSTALL_DIR=${INSTALL_BASE_DIR_DBG}/share/${PORT}/locale
-DSYSCONF_INSTALL_DIR=${INSTALL_BASE_DIR_DBG}/share/${PORT}/etc
-DINFO_INSTALL_DIR=${INSTALL_BASE_DIR_DBG}/share/${PORT}/info
OPTIONS_RELEASE
-DBIN_INSTALL_DIR=${INSTALL_BASE_DIR_REL}/bin
-DSBIN_INSTALL_DIR=${INSTALL_BASE_DIR_REL}/sbin
-DLIB_INSTALL_DIR=${INSTALL_BASE_DIR_REL}/bin
-DEXEC_INSTALL_PREFIX=${INSTALL_BASE_DIR_REL}/tools/${PORT}
-DXDG_APPS_DIR=${INSTALL_BASE_DIR_REL}/tools/${PORT}
-DPLUGIN_INSTALL_DIR=${INSTALL_BASE_DIR_REL}/tools/${PORT}
-DSHARE_INSTALL_PREFIX=${INSTALL_BASE_DIR_REL}/share/${PORT}
-DDATA_INSTALL_PREFIX=${INSTALL_BASE_DIR_REL}/share/${PORT}
-DHTML_INSTALL_DIR=${INSTALL_BASE_DIR_REL}/share/${PORT}/doc
-DICON_INSTALL_DIR=${INSTALL_BASE_DIR_REL}/share/${PORT}/data/icons
-DSOUND_INSTALL_DIR=${INSTALL_BASE_DIR_REL}/share/${PORT}/sounds
-DLOCALE_INSTALL_DIR=${INSTALL_BASE_DIR_REL}/share/${PORT}/locale
-DSYSCONF_INSTALL_DIR=${INSTALL_BASE_DIR_REL}/share/${PORT}/etc
-DINFO_INSTALL_DIR=${INSTALL_BASE_DIR_REL}/share/${PORT}/info
)
vcpkg_install_cmake()
if(NOT VCPKG_CMAKE_SYSTEM_NAME)
# Finish Directories
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
file(RENAME ${CURRENT_PACKAGES_DIR}/fann.dll ${CURRENT_PACKAGES_DIR}/bin/fann.dll)
file(RENAME ${CURRENT_PACKAGES_DIR}/doublefann.dll ${CURRENT_PACKAGES_DIR}/bin/doublefann.dll)
file(RENAME ${CURRENT_PACKAGES_DIR}/fixedfann.dll ${CURRENT_PACKAGES_DIR}/bin/fixedfann.dll)
file(RENAME ${CURRENT_PACKAGES_DIR}/floatfann.dll ${CURRENT_PACKAGES_DIR}/bin/floatfann.dll)
file(RENAME ${CURRENT_PACKAGES_DIR}/fann.lib ${CURRENT_PACKAGES_DIR}/lib/fann.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/doublefann.lib ${CURRENT_PACKAGES_DIR}/lib/doublefann.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/fixedfann.lib ${CURRENT_PACKAGES_DIR}/lib/fixedfann.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/floatfann.lib ${CURRENT_PACKAGES_DIR}/lib/floatfann.lib)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/fann.dll ${CURRENT_PACKAGES_DIR}/debug/bin/fann.dll)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/doublefann.dll ${CURRENT_PACKAGES_DIR}/debug/bin/doublefann.dll)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/fixedfann.dll ${CURRENT_PACKAGES_DIR}/debug/bin/fixedfann.dll)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/floatfann.dll ${CURRENT_PACKAGES_DIR}/debug/bin/floatfann.dll)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/fann.lib ${CURRENT_PACKAGES_DIR}/debug/lib/fann.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/doublefann.lib ${CURRENT_PACKAGES_DIR}/debug/lib/doublefann.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/fixedfann.lib ${CURRENT_PACKAGES_DIR}/debug/lib/fixedfann.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/floatfann.lib ${CURRENT_PACKAGES_DIR}/debug/lib/floatfann.lib)
# Remove useless config file and include path
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/pkgconfig)
endif()
# Handle copyright
file(COPY ${SOURCE_PATH}/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/COPYING.txt ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright)
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(INSTALL ${SOURCE_PATH}/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)

7
ports/fann/vcpkg.json Normal file
View File

@ -0,0 +1,7 @@
{
"name": "fann",
"version": "2.2.0",
"port-version": 2,
"description": "Fast Artificial Neural Network (FANN) Library is a free open source neural network library, which implements multilayer artificial neural networks in C with support for both fully connected and sparsely connected networks.",
"homepage": "https://github.com/libfann/fann"
}

View File

@ -275,10 +275,6 @@ epsilon:x64-uwp=fail
epsilon:x64-windows-static=fail
faad2:x64-linux=fail
faad2:x64-osx=fail
fann:arm-uwp=fail
fann:x64-linux=fail
fann:x64-osx=fail
fann:x64-uwp=fail
fann:x64-windows-static=fail
farmhash:arm64-windows=fail
farmhash:arm-uwp=fail

View File

@ -1897,8 +1897,8 @@
"port-version": 0
},
"fann": {
"baseline": "2.2.0-1",
"port-version": 0
"baseline": "2.2.0",
"port-version": 2
},
"farmhash": {
"baseline": "1.1",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "9bff6da1b7043e1ab6e344c549a285b7101763e2",
"version": "2.2.0",
"port-version": 2
},
{
"git-tree": "7efe8090234f2f2bd71fc7d90eee0248af8741b0",
"version-string": "2.2.0-1",