Przeglądaj źródła

HPCC-27166 Add support for USE_APR to vcpkg

Signed-off-by: Gordon Smith <GordonJSmith@gmail.com>
Gordon Smith 3 lat temu
rodzic
commit
d0b95703fd

+ 9 - 83
cmake_modules/FindAPR.cmake

@@ -18,96 +18,22 @@
 # - Find Apache Portable Runtime
 # Find the APR includes and libraries
 # This module defines
-#  APR_INCLUDE_DIR and APRUTIL_INCLUDE_DIR, where to find apr.h, etc.
-#  APR_LIBRARIES and APRUTIL_LIBRARIES, the libraries needed to use APR.
-#  APR_FOUND and APRUTIL_FOUND, If false, do not try to use APR.
+#  APR_INCLUDE_DIR, where to find apr.h, etc.
+#  APR_LIBRARIES, the libraries needed to use APR.
+#  APR_FOUND, If false, do not try to use APR.
 # also defined, but not for general use are
-#  APR_LIBRARY and APRUTIL_LIBRARY, where to find the APR library.
-
-# APR first.
+#  APR_LIBRARY, where to find the APR library.
 
 FIND_PATH(APR_INCLUDE_DIR apr.h
-/usr/local/include/apr-1
-/usr/local/include/apr-1.0
-/usr/include/apr-1
-/usr/include/apr-1.0
-/opt/local/include/apr-1
-/opt/local/include/apr-1.0
+   PATH_SUFFIXES apr-1 apr-1.0
 )
 
-SET(APR_NAMES ${APR_NAMES} apr-1)
+SET(APR_NAMES ${APR_NAMES} libapr-1 apr-1)
 FIND_LIBRARY(APR_LIBRARY
   NAMES ${APR_NAMES}
-  PATHS /usr/lib /usr/local/lib /opt/local/lib
-  )
-
-IF (APR_LIBRARY AND APR_INCLUDE_DIR)
-    SET(APR_LIBRARIES ${APR_LIBRARY})
-    SET(APR_FOUND "YES")
-ELSE (APR_LIBRARY AND APR_INCLUDE_DIR)
-  SET(APR_FOUND "NO")
-ENDIF (APR_LIBRARY AND APR_INCLUDE_DIR)
-
-
-IF (APR_FOUND)
-   IF (NOT APR_FIND_QUIETLY)
-      MESSAGE(STATUS "Found APR: ${APR_LIBRARIES}")
-   ENDIF (NOT APR_FIND_QUIETLY)
-ELSE (APR_FOUND)
-   IF (APR_FIND_REQUIRED)
-      MESSAGE(FATAL_ERROR "Could not find APR library")
-   ENDIF (APR_FIND_REQUIRED)
-ENDIF (APR_FOUND)
-
-# Deprecated declarations.
-SET (NATIVE_APR_INCLUDE_PATH ${APR_INCLUDE_DIR} )
-GET_FILENAME_COMPONENT (NATIVE_APR_LIB_PATH ${APR_LIBRARY} PATH)
-
-MARK_AS_ADVANCED(
-  APR_LIBRARY
-  APR_INCLUDE_DIR
-  )
-
-# Next, APRUTIL.
-
-FIND_PATH(APRUTIL_INCLUDE_DIR apu.h
-/usr/local/include/apr-1
-/usr/local/include/apr-1.0
-/usr/include/apr-1
-/usr/include/apr-1.0
-/opt/local/include/apr-1
-/opt/local/include/apr-1.0
 )
 
-SET(APRUTIL_NAMES ${APRUTIL_NAMES} aprutil-1)
-FIND_LIBRARY(APRUTIL_LIBRARY
-  NAMES ${APRUTIL_NAMES}
-  PATHS /usr/lib /usr/local/lib /opt/local/lib
-  )
-
-IF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR)
-    SET(APRUTIL_LIBRARIES ${APRUTIL_LIBRARY})
-    SET(APRUTIL_FOUND "YES")
-ELSE (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR)
-  SET(APRUTIL_FOUND "NO")
-ENDIF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR)
-
-
-IF (APRUTIL_FOUND)
-   IF (NOT APRUTIL_FIND_QUIETLY)
-      MESSAGE(STATUS "Found APRUTIL: ${APRUTIL_LIBRARIES}")
-   ENDIF (NOT APRUTIL_FIND_QUIETLY)
-ELSE (APRUTIL_FOUND)
-   IF (APRUTIL_FIND_REQUIRED)
-      MESSAGE(FATAL_ERROR "Could not find APRUTIL library")
-   ENDIF (APRUTIL_FIND_REQUIRED)
-ENDIF (APRUTIL_FOUND)
-
-# Deprecated declarations.
-SET (NATIVE_APRUTIL_INCLUDE_PATH ${APRUTIL_INCLUDE_DIR} )
-GET_FILENAME_COMPONENT (NATIVE_APRUTIL_LIB_PATH ${APRUTIL_LIBRARY} PATH)
+find_package_handle_standard_args(APR DEFAULT_MSG
+   APR_LIBRARY APR_INCLUDE_DIR)
 
-MARK_AS_ADVANCED(
-  APRUTIL_LIBRARY
-  APRUTIL_INCLUDE_DIR
-  )
+MARK_AS_ADVANCED(APR_INCLUDE_DIR APR_LIBRARY)

+ 39 - 0
cmake_modules/FindAPRUTIL.cmake

@@ -0,0 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+# - Find Apache Portable Runtime
+# Find the APR includes and libraries
+# This module defines
+#  APRUTIL_INCLUDE_DIR, where to find apr.h, etc.
+#  APRUTIL_LIBRARIES, the libraries needed to use APR.
+#  APRUTIL_FOUND, If false, do not try to use APR.
+# also defined, but not for general use are
+#  APRUTIL_LIBRARY, where to find the APR library.
+
+FIND_PATH(APRUTIL_INCLUDE_DIR apu.h
+   PATH_SUFFIXES apr-1 apr-1.0
+)
+
+SET(APRUTIL_NAMES ${APRUTIL_NAMES} libaprutil-1 aprutil-1)
+FIND_LIBRARY(APRUTIL_LIBRARY
+  NAMES ${APRUTIL_NAMES}
+)
+
+find_package_handle_standard_args(APRUTIL DEFAULT_MSG
+   APRUTIL_LIBRARY APRUTIL_INCLUDE_DIR)
+
+MARK_AS_ADVANCED(APRUTIL_INCLUDE_DIR APRUTIL_LIBRARY)

+ 5 - 6
cmake_modules/commonSetup.cmake

@@ -1013,17 +1013,16 @@ endif ()
         find_package(APR)
         if (APR_FOUND)
           add_definitions (-D_USE_APR)
-          include_directories(${APR_INCLUDE_DIR})
-          link_directories(${APR_LIBRARY_DIR})
         else()
           message(FATAL_ERROR "APR requested but package not found")
         endif()
-        if (APRUTIL_FOUND)
-          include_directories(${APRUTIL_INCLUDE_DIR})
-          link_directories(${APRUTIL_LIBRARY_DIR})
-        else()
+        find_package(APRUTIL)
+        if (NOT APRUTIL_FOUND)
           message(FATAL_ERROR "APRUTIL requested but package not found")
         endif()
+        if (APPLE)
+          find_package(Iconv REQUIRED)
+        endif()
       else()
         add_definitions (-D_NO_APR)
       endif(USE_APR)

+ 0 - 1
cmake_modules/vcpkgSetup.cmake

@@ -5,7 +5,6 @@ set (USE_CBLAS OFF)
 set (USE_LIBARCHIVE OFF)
 set (USE_BOOST_REGEX OFF)
 
-set (USE_APR OFF)
 set (USE_AZURE OFF)
 set (USE_AWS OFF)
 set (WSSQL_SERVICE OFF)

+ 4 - 5
system/security/plugins/htpasswdSecurity/CMakeLists.txt

@@ -37,8 +37,8 @@ include_directories (
          ${HPCC_SOURCE_DIR}/system/jlib
          ${HPCC_SOURCE_DIR}/esp/platform
          ${HPCC_SOURCE_DIR}/dali/base
-         ${APR_INCLUDE_DIR}
          ${APRUTIL_INCLUDE_DIR}
+         ${APR_INCLUDE_DIR}
     )
 
 ADD_DEFINITIONS( -DHTPASSWDSECURITY_EXPORTS -D_USRDLL )
@@ -48,8 +48,7 @@ install ( TARGETS htpasswdSecurity RUNTIME DESTINATION ${EXEC_DIR} LIBRARY DESTI
 target_link_libraries ( htpasswdSecurity
          jlib
          dalibase
-         ${APR_LIBRARIES}
-         ${APRUTIL_LIBRARIES}
+         ${APRUTIL_LIBRARY}
+         ${APR_LIBRARY}
+         ${Iconv_LIBRARIES}
     )
-
-

+ 6 - 0
vcpkg.json

@@ -13,6 +13,12 @@
             "features": []
         },
         "boost-property-tree",
+        "apr",
+        "apr-util",
+        {
+            "name": "libiconv",
+            "platform": "osx"
+        },
         {
             "name": "winflexbison",
             "platform": "windows"