Switch libzip and xlsxio to be included with add_subdirectory(), disable xlsxio installation

develop
lethosor 2020-09-18 00:33:41 -04:00
parent f354f7800f
commit b85759620f
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
5 changed files with 31 additions and 37 deletions

@ -406,6 +406,7 @@ endif()
include_directories(depends/tthread)
include_directories(${ZLIB_INCLUDE_DIRS})
include_directories(depends/clsocket/src)
include_directories(depends/xlsxio/include)
add_subdirectory(depends)
find_package(Git REQUIRED)

@ -47,32 +47,33 @@ set(EXPAT_BUILD_TESTS OFF CACHE BOOL "")
set(EXPAT_BUILD_TOOLS OFF CACHE BOOL "")
set(EXPAT_SHARED_LIBS OFF CACHE BOOL "")
set(EXPAT_BUILD_DOCS OFF CACHE BOOL "")
set(EXPAT_ENABLE_INSTALL OFF CACHE BOOL "")
add_subdirectory(libexpat/expat)
set(LIBZIP_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/libzip)
set(LIBZIP_LIB ${LIBZIP_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}zip${CMAKE_STATIC_LIBRARY_SUFFIX})
set(LIBZIP_LIB ${LIBZIP_LIB} PARENT_SCOPE)
ExternalProject_Add(libzip_project
PREFIX libzip
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libzip
INSTALL_DIR ${LIBZIP_INSTALL_DIR}
BUILD_BYPRODUCTS ${LIBZIP_LIB}
CMAKE_GENERATOR "${CMAKE_GENERATOR}"
CMAKE_GENERATOR_TOOLSET "${CMAKE_GENERATOR_TOOLSET}"
CMAKE_ARGS ${CL_ARGS} -DCMAKE_INSTALL_PREFIX=${LIBZIP_INSTALL_DIR} -DCMAKE_BUILD_TYPE=Release -DBUILD_DOC=OFF -DBUILD_EXAMPLES=OFF -DBUILD_REGRESS=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_TOOLS=OFF -DENABLE_BZIP2=OFF -DENABLE_COMMONCRYPTO=OFF -DENABLE_GNUTLS=OFF -DENABLE_LZMA=OFF -DENABLE_MBEDTLS=OFF -DENABLE_OPENSSL=OFF -DENABLE_WINDOWS_CRYPTO=OFF -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_POSITION_INDEPENDENT_CODE=ON
)
set(LIBZIP_BUILD_DOC OFF CACHE BOOL "")
set(LIBZIP_BUILD_EXAMPLES OFF CACHE BOOL "")
set(LIBZIP_BUILD_REGRESS OFF CACHE BOOL "")
set(LIBZIP_BUILD_SHARED_LIBS OFF CACHE BOOL "")
set(LIBZIP_BUILD_TOOLS OFF CACHE BOOL "")
set(LIBZIP_ENABLE_BZIP2 OFF CACHE BOOL "")
set(LIBZIP_ENABLE_COMMONCRYPTO OFF CACHE BOOL "")
set(LIBZIP_ENABLE_GNUTLS OFF CACHE BOOL "")
set(LIBZIP_ENABLE_LZMA OFF CACHE BOOL "")
set(LIBZIP_ENABLE_MBEDTLS OFF CACHE BOOL "")
set(LIBZIP_ENABLE_OPENSSL OFF CACHE BOOL "")
set(LIBZIP_ENABLE_WINDOWS_CRYPTO OFF CACHE BOOL "")
set(LIBZIP_DO_INSTALL OFF CACHE BOOL "")
add_subdirectory(libzip)
set(XLSXIO_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/xlsxio)
set(XLSXIO_INSTALL_DIR ${XLSXIO_INSTALL_DIR} PARENT_SCOPE)
set(XLSXIO_LIB ${XLSXIO_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}xlsxio_read${CMAKE_STATIC_LIBRARY_SUFFIX})
set(XLSXIO_LIB ${XLSXIO_LIB} PARENT_SCOPE)
ExternalProject_Add(xlsxio_project
PREFIX xlsxio
DEPENDS libzip_project
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/xlsxio
INSTALL_DIR ${XLSXIO_INSTALL_DIR}
BUILD_BYPRODUCTS ${XLSXIO_LIB}
CMAKE_GENERATOR "${CMAKE_GENERATOR}"
CMAKE_GENERATOR_TOOLSET "${CMAKE_GENERATOR_TOOLSET}"
CMAKE_ARGS ${CL_ARGS} -DCMAKE_INSTALL_PREFIX=${XLSXIO_INSTALL_DIR} -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC=ON -DBUILD_SHARED=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_TOOLS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_DOCUMENTATION=OFF -DWITH_LIBZIP=ON -DZLIB_DIR=${ZLIB_DIR} -DLIBZIP_DIR=${LIBZIP_INSTALL_DIR} -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_C_FLAGS=${XLSXIO_C_FLAGS}
)
set(XLSXIO_USE_DFHACK_LIBS ON CACHE BOOL "")
set(XLSXIO_BUILD_STATIC ON CACHE BOOL "")
set(XLSXIO_BUILD_SHARED OFF CACHE BOOL "")
set(XLSXIO_BUILD_DOCUMENTATION OFF CACHE BOOL "")
set(XLSXIO_BUILD_EXAMPLES OFF CACHE BOOL "")
set(XLSXIO_BUILD_TOOLS OFF CACHE BOOL "")
set(XLSXIO_WITH_LIBZIP ON CACHE BOOL "")
set(XLSXIO_ZLIB_DIR "${ZLIB_DIR}" CACHE PATH "")
set(XLSXIO_LIBZIP_DIR "${CMAKE_CURRENT_BINARY_DIR}/libzip" CACHE PATH "")
set(XLSXIO_EXPAT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libexpat" CACHE PATH "")
set(XLSXIO_ENABLE_INSTALL OFF CACHE BOOL "")
add_subdirectory(xlsxio)

@ -1 +1 @@
Subproject commit 66e496489bdae81bfda8b0088172871d8fda0032
Subproject commit 2dec336772bf401e86ff7cf15647709e6697f84a

@ -1 +1 @@
Subproject commit cfd9ed517417000f5ffce428f2a4a7da0847c145
Subproject commit f801aeeb71e6ad70c0c59b8c35ebde47b1eb610e

@ -77,12 +77,6 @@ set_source_files_properties( Brushes.h PROPERTIES HEADER_FILE_ONLY TRUE )
add_library(buildingplan-lib STATIC buildingplan-lib.cpp)
target_link_libraries(buildingplan-lib dfhack)
# xlsxreader deps
add_library(xlsxio_read STATIC IMPORTED)
set_target_properties(xlsxio_read PROPERTIES IMPORTED_LOCATION ${XLSXIO_LIB})
add_library(zip STATIC IMPORTED)
set_target_properties(zip PROPERTIES IMPORTED_LOCATION ${LIBZIP_LIB})
if(WIN32)
set(LIB_Z_LIB "depends/zlib/lib/zlib")
else()
@ -187,11 +181,9 @@ if(BUILD_SUPPORTED)
add_subdirectory(tweak)
dfhack_plugin(workflow workflow.cpp LINK_LIBRARIES lua)
dfhack_plugin(workNow workNow.cpp)
dfhack_plugin(xlsxreader xlsxreader.cpp LINK_LIBRARIES lua xlsxio_read zip expat ${LIB_Z_LIB})
dfhack_plugin(xlsxreader xlsxreader.cpp LINK_LIBRARIES lua xlsxio_read_STATIC zip expat ${LIB_Z_LIB})
dfhack_plugin(zone zone.cpp LINK_LIBRARIES lua)
endif()
target_include_directories(xlsxreader PRIVATE ${XLSXIO_INSTALL_DIR}/include)
add_dependencies(xlsxreader xlsxio_project)
# this is the skeleton plugin. If you want to make your own, make a copy and then change it
option(BUILD_SKELETON "Build the skeleton plugin." OFF)