From f114e81a7552327d7cd60e3842b837caf8baa663 Mon Sep 17 00:00:00 2001 From: atkawa7 Date: Thu, 29 Jun 2017 13:38:45 -0700 Subject: [PATCH] [libconfig] fixed issues with portfile --- ports/libconfig/CMakeLists.txt | 50 +++++++++------------------------- ports/libconfig/portfile.cmake | 14 ++-------- 2 files changed, 16 insertions(+), 48 deletions(-) diff --git a/ports/libconfig/CMakeLists.txt b/ports/libconfig/CMakeLists.txt index c04e2976aa..e81d77948a 100644 --- a/ports/libconfig/CMakeLists.txt +++ b/ports/libconfig/CMakeLists.txt @@ -6,53 +6,29 @@ 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(lib/win32) -include_directories(${COMMON_INCLUDES}) -include_directories(${EXTERNAL_HEADERS}) +add_library(libconfig ${C_SOURCES}) +add_library(libconfig++ ${C_SOURCES} ${CPP_SOURCES}) -if(BUILD_SHARED) - add_library(libconfig SHARED ${C_SOURCES}) - add_library(libconfig++ SHARED ${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 +41,5 @@ install( ) if(NOT DISABLE_INSTALL_HEADERS) - install(DIRECTORY "${COMMON_INCLUDES}/" DESTINATION include) + install(FILES lib/libconfig.h++ lib/libconfig.h DESTINATION include) endif() diff --git a/ports/libconfig/portfile.cmake b/ports/libconfig/portfile.cmake index 7500e81183..01df063722 100644 --- a/ports/libconfig/portfile.cmake +++ b/ports/libconfig/portfile.cmake @@ -15,27 +15,19 @@ 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 ${CURRENT_INSTALLED_DIR}/include/dirent.h DESTINATION ${WIN_SRC}) +file(COPY ${CURRENT_INSTALLED_DIR}/include/stdint.h DESTINATION ${WIN_SRC}) -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)