[new port] libmaxminddb init (#4132)

* maxminddb init

* [libmaxminddb] CMake cleanup. Build static lib instead of exporting all symbols on Windows.
This commit is contained in:
atkawa7 2018-08-22 00:57:50 +02:00 committed by Robert Schumacher
parent 43b9d80306
commit 093900b225
3 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,34 @@
cmake_minimum_required (VERSION 3.9)
project(maxminddb C)
set(CMAKE_DEBUG_POSTFIX d)
set(CMAKE_SHARED_LIBRARY_PREFIX lib)
set(CMAKE_STATIC_LIBRARY_PREFIX lib)
if(MSVC)
add_compile_options(-D_CRT_SECURE_NO_WARNINGS)
endif()
set(SRCS
src/maxminddb.c
src/data-pool.c
)
include_directories(. src include projects/VS12)
add_library(maxminddb ${SRCS})
if(WIN32)
target_link_libraries(maxminddb ws2_32)
endif()
install(
TARGETS maxminddb
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
if(NOT DISABLE_INSTALL_HEADERS)
install(FILES include/maxminddb.h projects/VS12/maxminddb_config.h DESTINATION include/maxminddb)
endif()

View File

@ -0,0 +1,3 @@
Source: libmaxminddb
Version: 1.3.2-1
Description: C library for the MaxMind DB file format

View File

@ -0,0 +1,26 @@
include(vcpkg_common_functions)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO maxmind/libmaxminddb
REF 1.3.2
SHA512 43ff5f4e3a413772cd315412afc1070fb80280405d8845dc9d94a795265a71007c6c182dc01da8e14bf7b8ab8defe05714bec543faa956e7fb0f0a7756e7df48
HEAD_REF master
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS_DEBUG
-DDISABLE_INSTALL_HEADERS=ON
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libmaxminddb RENAME copyright)