Merge branch 'libconfig' of https://github.com/atkawa7/vcpkg into libconfig

This commit is contained in:
atkawa7 2017-07-03 21:09:27 -07:00
commit 0cae541040
4 changed files with 25 additions and 53 deletions

View File

@ -6,53 +6,34 @@ if(MSVC)
add_compile_options(/W3 /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS)
endif()
set(SOURCE_PATH ${PROJECT_SOURCE_DIR}/lib)
set(COMMON_INCLUDES ${PROJECT_BINARY_DIR}/includes)
set(C_HEADERS
${SOURCE_PATH}/grammar.h
${SOURCE_PATH}/libconfig.h
${SOURCE_PATH}/libconfig.hh
${SOURCE_PATH}/parsectx.h
${SOURCE_PATH}/scanctx.h
${SOURCE_PATH}/scanner.h
${SOURCE_PATH}/wincompat.h
${SOURCE_PATH}/libconfig.h++
${SOURCE_PATH}/libconfigcpp.c++
)
set(
EXTERNAL_HEADERS ${SOURCE_PATH}/win32
)
set(C_SOURCES
${SOURCE_PATH}/grammar.c
${SOURCE_PATH}/libconfig.c
${SOURCE_PATH}/scanctx.c
${SOURCE_PATH}/win32/scandir.c
${SOURCE_PATH}/scanner.c
${SOURCE_PATH}/strbuf.c
lib/grammar.c
lib/libconfig.c
lib/scanctx.c
lib/win32/scandir.c
lib/scanner.c
lib/strbuf.c
)
set(CPP_SOURCES
${SOURCE_PATH}/libconfigcpp.cc
lib/libconfigcpp.cc
)
file(COPY ${C_HEADERS} DESTINATION ${COMMON_INCLUDES})
include_directories(lib)
include_directories(${COMMON_INCLUDES})
include_directories(${EXTERNAL_HEADERS})
find_path(DIRENT_H dirent.h)
find_path(STDINT_H stdint.h)
if(BUILD_SHARED)
add_library(libconfig SHARED ${C_SOURCES})
add_library(libconfig++ SHARED ${C_SOURCES} ${CPP_SOURCES})
include_directories(${DIRENT_H})
include_directories(${STDINT_H})
add_library(libconfig ${C_SOURCES})
add_library(libconfig++ ${C_SOURCES} ${CPP_SOURCES})
if(BUILD_SHARED_LIBS)
target_compile_definitions(libconfig PRIVATE -DLIBCONFIG_EXPORTS -DYY_NO_UNISTD_H -DYY_USE_CONST)
target_compile_definitions(libconfig++ PRIVATE -DLIBCONFIG_EXPORTS -DLIBCONFIGXX_EXPORTS -DYY_NO_UNISTD_H -DYY_USE_CONST)
else()
add_library(libconfig STATIC ${C_SOURCES})
add_library(libconfig++ STATIC ${C_SOURCES} ${CPP_SOURCES})
target_compile_definitions(libconfig PRIVATE -DLIBCONFIG_STATIC -DYY_NO_UNISTD_H)
target_compile_definitions(libconfig++ PRIVATE -DLIBCONFIG_STATIC -DYY_NO_UNISTD_H)
endif()
@ -65,5 +46,5 @@ install(
)
if(NOT DISABLE_INSTALL_HEADERS)
install(DIRECTORY "${COMMON_INCLUDES}/" DESTINATION include)
install(FILES lib/libconfig.h++ lib/libconfig.h DESTINATION include)
endif()

View File

@ -15,27 +15,17 @@ vcpkg_apply_patches(
"${CMAKE_CURRENT_LIST_DIR}/fix-scanner-header-msvc-patch.patch"
)
set(DIRENT_HOME ${VCPKG_ROOT_DIR}/packages/dirent_${TARGET_TRIPLET})
set(MIINTTYPES_HOME ${VCPKG_ROOT_DIR}/packages/msinttypes_${TARGET_TRIPLET})
set(WIN_SRC ${SOURCE_PATH}/lib/win32)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/scandir.c DESTINATION ${WIN_SRC})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/scandir.c DESTINATION ${SOURCE_PATH}/lib/win32)
file(COPY ${DIRENT_HOME}/include/dirent.h DESTINATION ${WIN_SRC})
file(COPY ${MIINTTYPES_HOME}/include/stdint.h DESTINATION ${WIN_SRC})
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set (BUILD_SHARED_LIBRARY ON)
else()
set(BUILD_SHARED_LIBRARY OFF)
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS -DBUILD_SHARED=${BUILD_SHARED_LIBRARY}
OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON
)
vcpkg_install_cmake()
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libconfig RENAME copyright)
vcpkg_copy_pdbs()

View File

@ -22,6 +22,7 @@
// Emulation of posix scandir() call
// This source file is #include'd by scandir.c
// THIS IS A C FILE! DO NOT CHANGE TO C++!!!
// See @http://www.fltk.org/strfiles/1779/scandir.c
#include <string.h>
#include <windows.h>

View File

@ -8,6 +8,6 @@ vcpkg_from_github(
HEAD_REF master
)
file(INSTALL ${SOURCE_PATH}/inttypes.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
file(INSTALL ${SOURCE_PATH}/stdint.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
file(INSTALL ${SOURCE_PATH}/inttypes.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/msinttypes)
file(INSTALL ${SOURCE_PATH}/stdint.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/msinttypes)
file(INSTALL ${SOURCE_PATH}/stdint.h DESTINATION ${CURRENT_PACKAGES_DIR}/share/msinttypes RENAME copyright)