Browse Source

Merge pull request #15755 from GordonSmith/HPCC-27162-USE_LIBARCHIVE

HPCC-27162 Add USE_LIBARCHIVE support to vcpkg

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 3 years ago
parent
commit
0db4c9df44

+ 0 - 56
cmake_modules/FindBZip2.cmake

@@ -1,56 +0,0 @@
-################################################################################
-#    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
-#
-#    Licensed under the Apache License, Version 2.0 (the "License");
-#    you may not use this file except in compliance with the License.
-#    You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS,
-#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#    See the License for the specific language governing permissions and
-#    limitations under the License.
-################################################################################
-
-
-# - Try to find the BZIP2 compression library
-# Once done this will define
-#
-#  BZIP2_FOUND - system has the BZIP2 library
-#  BZIP2_INCLUDE_DIR - the BZIP include directory
-#  BZIP2_LIBRARIES - The libraries needed to use BZIP2
-
-IF (NOT BZIP2_FOUND)
-  IF (NOT "${EXTERNALS_DIRECTORY}" STREQUAL "")
-    IF(WIN32)
-      IF (${ARCH64BIT} EQUAL 1)
-        SET (osdir "win64")
-      ELSE()
-        SET (osdir "win32")
-      ENDIF()
-      SET (bzip2ver "1.0.6")
-      SET (bzip2_lib "libbz2")
-    ENDIF()
-    IF (NOT ("${osdir}" STREQUAL "unknown"))
-      FIND_PATH (BZIP2_INCLUDE_DIR NAMES bzlib.h PATHS "${EXTERNALS_DIRECTORY}/bzip2/${bzip2ver}/include"
-NO_DEFAULT_PATH)
-      FIND_LIBRARY (BZIP2_LIBRARIES NAMES ${bzip2_lib} PATHS "${EXTERNALS_DIRECTORY}/bzip2/${bzip2ver}/lib/${osdir}" NO_DEFAULT_PATH)
-    ENDIF()
-  ENDIF()
-
-  IF (USE_NATIVE_LIBRARIES)
-    # if we didn't find in externals, look in system include path
-    FIND_PATH (BZIP2_INCLUDE_DIR NAMES bzlib.h)
-    FIND_LIBRARY (BZIP2_LIBRARIES NAMES ${bzip2_lib})
-  ENDIF()
-
-  include(FindPackageHandleStandardArgs)
-  find_package_handle_standard_args(BZip2 DEFAULT_MSG
-    BZIP2_LIBRARIES
-    BZIP2_INCLUDE_DIR
-  )
-
-  MARK_AS_ADVANCED(BZIP2_INCLUDE_DIR BZIP2_LIBRARIES)
-ENDIF()

+ 0 - 59
cmake_modules/FindLIBARCHIVE.cmake

@@ -1,59 +0,0 @@
-################################################################################
-#    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
-#
-#    Licensed under the Apache License, Version 2.0 (the "License");
-#    you may not use this file except in compliance with the License.
-#    You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS,
-#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#    See the License for the specific language governing permissions and
-#    limitations under the License.
-################################################################################
-
-# - Try to find the libarchive archive decompression library
-# Once done this will define
-#
-#  LIBARCHIVE_FOUND - system has the libarchive library
-#  LIBARCHIVE_INCLUDE_DIR - the libarchive include directory
-#  LIBARCHIVE_LIBRARIES - The libraries needed to use libarchive
-
-IF (NOT LIBARCHIVE_FOUND)
-  IF (WIN32)
-    SET (libarchive_ver "3.1.2")
-    SET (libarchive_lib "archive_static")
-    IF (${ARCH64BIT} EQUAL 1)
-        SET (osdir "Win64")
-    ELSE ()
-        SET (osdir "Win32")
-    ENDIF ()
-    IF (MSVC_VERSION GREATER 1800)
-        SET (osdir "${osdir}_VS2015")
-    ENDIF ()
-
-    FIND_PATH (LIBARCHIVE_INCLUDE_DIR NAMES archive.h PATHS "${EXTERNALS_DIRECTORY}/libarchive/${libarchive_ver}/include" NO_DEFAULT_PATH)
-    FIND_LIBRARY (LIBARCHIVE_LIBRARIES NAMES ${libarchive_lib} PATHS "${EXTERNALS_DIRECTORY}/libarchive/${libarchive_ver}/lib/${osdir}" NO_DEFAULT_PATH)
-  ELSEIF(APPLE)
-    # We want to ignore any libraries provided by the OS
-    SET (libarchive_lib "archive")
-    FIND_PATH(LIBARCHIVE_INCLUDE_DIR NAMES archive.h /opt/local/include /usr/local/include /usr/local/Cellar)
-    FIND_LIBRARY(LIBARCHIVE_LIBRARIES NAMES ${libarchive_lib} PATHS /opt/local/lib /usr/local/lib /usr/local/Cellar NO_DEFAULT_PATH)
-  ELSE()
-    SET (libarchive_lib "archive")
-    FIND_PATH (LIBARCHIVE_INCLUDE_DIR NAMES archive.h)
-    FIND_LIBRARY (LIBARCHIVE_LIBRARIES NAMES ${libarchive_lib})
-  ENDIF()
-
-
-
-  include(FindPackageHandleStandardArgs)
-  find_package_handle_standard_args(libarchive DEFAULT_MSG
-    LIBARCHIVE_LIBRARIES
-    LIBARCHIVE_INCLUDE_DIR
-  )
-
-  MARK_AS_ADVANCED(LIBARCHIVE_INCLUDE_DIR LIBARCHIVE_LIBRARIES)
-ENDIF()

+ 2 - 2
cmake_modules/commonSetup.cmake

@@ -938,8 +938,8 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
             message(FATAL_ERROR "LIBARCHIVE requires BZIP2 but package not found")
           endif()
         endif (WIN32)
-        find_package(LIBARCHIVE)
-        if (LIBARCHIVE_FOUND)
+        find_package(LibArchive)
+        if (LibArchive_FOUND)
           add_definitions (-D_USE_LIBARCHIVE)
         else()
           message(FATAL_ERROR "LIBARCHIVE requested but package not found")

+ 0 - 1
cmake_modules/vcpkgSetup.cmake

@@ -2,7 +2,6 @@ set (USE_OPENLDAP OFF)
 
 set (USE_CBLAS OFF)
 
-set (USE_LIBARCHIVE OFF)
 set (USE_BOOST_REGEX OFF)
 
 set (USE_AZURE OFF)

+ 1 - 1
common/remote/hooks/libarchive/CMakeLists.txt

@@ -46,7 +46,7 @@ install ( TARGETS archivefile RUNTIME DESTINATION filehooks LIBRARY DESTINATION
 
 target_link_libraries ( archivefile
     jlib
-    ${LIBARCHIVE_LIBRARIES}
+    ${LibArchive_LIBRARIES}
     )
 
 if (WIN32)

+ 7 - 0
vcpkg.json

@@ -22,6 +22,13 @@
         },
         "curl",
         {
+            "name": "libarchive",
+            "default-features": false,
+            "features": [
+                "bzip2"
+            ]
+        },
+        {
             "name": "winflexbison",
             "platform": "windows"
         }