Merge branch 'deps-subdirectory' into develop

develop
lethosor 2020-09-19 20:17:22 -04:00
commit be1bd54860
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
8 changed files with 48 additions and 90 deletions

6
.gitmodules vendored

@ -18,13 +18,13 @@
url = ../../DFHack/jsoncpp.git url = ../../DFHack/jsoncpp.git
[submodule "depends/xlsxio"] [submodule "depends/xlsxio"]
path = depends/xlsxio path = depends/xlsxio
url = ../../brechtsanders/xlsxio.git url = ../../DFHack/xlsxio.git
shallow = true shallow = true
[submodule "depends/libzip"] [submodule "depends/libzip"]
path = depends/libzip path = depends/libzip
url = ../../nih-at/libzip.git url = ../../DFHack/libzip.git
shallow = true shallow = true
[submodule "depends/libexpat"] [submodule "depends/libexpat"]
path = depends/libexpat path = depends/libexpat
url = ../../libexpat/libexpat.git url = ../../DFHack/libexpat.git
shallow = true shallow = true

@ -2,6 +2,7 @@
## some generic CMake magic ## some generic CMake magic
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
cmake_policy(SET CMP0048 NEW)
project(dfhack) project(dfhack)
if("${CMAKE_GENERATOR}" STREQUAL Ninja) if("${CMAKE_GENERATOR}" STREQUAL Ninja)
@ -406,6 +407,7 @@ endif()
include_directories(depends/tthread) include_directories(depends/tthread)
include_directories(${ZLIB_INCLUDE_DIRS}) include_directories(${ZLIB_INCLUDE_DIRS})
include_directories(depends/clsocket/src) include_directories(depends/clsocket/src)
include_directories(depends/xlsxio/include)
add_subdirectory(depends) add_subdirectory(depends)
find_package(Git REQUIRED) find_package(Git REQUIRED)

@ -18,67 +18,40 @@ option(CLSOCKET_DEP_ONLY "Build for use inside other CMake projects as dependenc
add_subdirectory(clsocket) add_subdirectory(clsocket)
ide_folder(clsocket "Depends") ide_folder(clsocket "Depends")
# assemble environment args to pass on to dependency projects # set the default values of libexpat options - the descriptions are left empty
get_cmake_property(vars CACHE_VARIABLES) # because later option() calls *do* override those
foreach(var ${vars}) set(EXPAT_BUILD_EXAMPLES OFF CACHE BOOL "")
if(var MATCHES "^CMAKE_" set(EXPAT_BUILD_TESTS OFF CACHE BOOL "")
AND NOT var MATCHES "^CMAKE_CACHE" set(EXPAT_BUILD_TOOLS OFF CACHE BOOL "")
AND NOT var MATCHES "^CMAKE_HOME" set(EXPAT_SHARED_LIBS OFF CACHE BOOL "")
AND NOT var MATCHES "^CMAKE_PROJECT") set(EXPAT_BUILD_DOCS OFF CACHE BOOL "")
list(APPEND CL_ARGS "-D${var}=${${var}}") set(EXPAT_ENABLE_INSTALL OFF CACHE BOOL "")
endif() add_subdirectory(libexpat/expat)
if(var MATCHES "^ZLIB")
list(APPEND CL_ARGS "-D${var}=${${var}}") set(LIBZIP_BUILD_DOC OFF CACHE BOOL "")
endif() set(LIBZIP_BUILD_EXAMPLES OFF CACHE BOOL "")
endforeach() set(LIBZIP_BUILD_REGRESS OFF CACHE BOOL "")
set(LIBZIP_BUILD_SHARED_LIBS OFF CACHE BOOL "")
include(ExternalProject) set(LIBZIP_BUILD_TOOLS OFF CACHE BOOL "")
set(LIBZIP_ENABLE_BZIP2 OFF CACHE BOOL "")
if(WIN32) set(LIBZIP_ENABLE_COMMONCRYPTO OFF CACHE BOOL "")
set(EXPAT_LIB_NAME_SUFFIX "MD") set(LIBZIP_ENABLE_GNUTLS OFF CACHE BOOL "")
set(XLSXIO_C_FLAGS "${CMAKE_C_FLAGS} /DXML_STATIC") set(LIBZIP_ENABLE_LZMA OFF CACHE BOOL "")
else() set(LIBZIP_ENABLE_MBEDTLS OFF CACHE BOOL "")
set(EXPAT_LIB_NAME_SUFFIX "") set(LIBZIP_ENABLE_OPENSSL OFF CACHE BOOL "")
set(XLSXIO_C_FLAGS "${CMAKE_C_FLAGS} -DXML_STATIC") set(LIBZIP_ENABLE_WINDOWS_CRYPTO OFF CACHE BOOL "")
endif() set(LIBZIP_DO_INSTALL OFF CACHE BOOL "")
add_subdirectory(libzip)
set(LIBEXPAT_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/libexpat)
set(LIBEXPAT_LIB ${LIBEXPAT_INSTALL_DIR}/lib/libexpat${EXPAT_LIB_NAME_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) set(XLSXIO_USE_DFHACK_LIBS ON CACHE BOOL "")
set(LIBEXPAT_LIB ${LIBEXPAT_LIB} PARENT_SCOPE) set(XLSXIO_BUILD_STATIC ON CACHE BOOL "")
ExternalProject_Add(libexpat_project set(XLSXIO_BUILD_SHARED OFF CACHE BOOL "")
PREFIX libexpat set(XLSXIO_BUILD_DOCUMENTATION OFF CACHE BOOL "")
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libexpat/expat set(XLSXIO_BUILD_EXAMPLES OFF CACHE BOOL "")
INSTALL_DIR ${LIBEXPAT_INSTALL_DIR} set(XLSXIO_BUILD_TOOLS OFF CACHE BOOL "")
BUILD_BYPRODUCTS ${LIBEXPAT_LIB} set(XLSXIO_WITH_LIBZIP ON CACHE BOOL "")
CMAKE_GENERATOR "${CMAKE_GENERATOR}" set(XLSXIO_ZLIB_DIR "${ZLIB_DIR}" CACHE PATH "")
CMAKE_GENERATOR_TOOLSET "${CMAKE_GENERATOR_TOOLSET}" set(XLSXIO_LIBZIP_DIR "${CMAKE_CURRENT_BINARY_DIR}/libzip" CACHE PATH "")
CMAKE_ARGS ${CL_ARGS} -DCMAKE_INSTALL_PREFIX=${LIBEXPAT_INSTALL_DIR} -DCMAKE_BUILD_TYPE=Release -DEXPAT_BUILD_EXAMPLES=OFF -DEXPAT_BUILD_TESTS=OFF -DEXPAT_BUILD_TOOLS=OFF -DEXPAT_SHARED_LIBS=OFF -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_POSITION_INDEPENDENT_CODE=ON set(XLSXIO_EXPAT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libexpat" CACHE PATH "")
) set(XLSXIO_ENABLE_INSTALL OFF CACHE BOOL "")
add_subdirectory(xlsxio)
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(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 libexpat_project 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} -DEXPAT_DIR=${LIBEXPAT_INSTALL_DIR} -DEXPAT_LIBRARIES=${LIBEXPAT_LIB} -DEXPAT_INCLUDE_DIRS=${LIBEXPAT_INSTALL_DIR}/include -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_C_FLAGS=${XLSXIO_C_FLAGS}
)

@ -1 +1 @@
Subproject commit a7bc26b69768f7fb24f0c7976fae24b157b85b13 Subproject commit 26839cce4534ea4ee70ba992a6d7a774c624d584

@ -1 +1 @@
Subproject commit 29b881d286f43189ff7392f609da78daa80c0606 Subproject commit 33c059d2217de6a5271e9ecbf19908e6efbf0e79

@ -1 +1 @@
Subproject commit 261d56815b29908fc960fecb9cb3143db4b485ad Subproject commit 4056226fe0df6bff4593ee2353cca07c2b7f327e

@ -8,6 +8,8 @@
#pragma once #pragma once
#include <xlsxio_read.h>
#include "DataIdentity.h" #include "DataIdentity.h"
namespace DFHack { namespace DFHack {
@ -26,14 +28,12 @@ struct DFHACK_EXPORT xlsx_sheet_handle_identity : public compound_identity {
}; };
struct DFHACK_EXPORT xlsx_file_handle { struct DFHACK_EXPORT xlsx_file_handle {
typedef struct xlsxio_read_struct* xlsxioreader;
const xlsxioreader handle; const xlsxioreader handle;
xlsx_file_handle(xlsxioreader handle): handle(handle) {} xlsx_file_handle(xlsxioreader handle): handle(handle) {}
static xlsx_file_handle_identity _identity; static xlsx_file_handle_identity _identity;
}; };
struct DFHACK_EXPORT xlsx_sheet_handle { struct DFHACK_EXPORT xlsx_sheet_handle {
typedef struct xlsxio_read_sheet_struct* xlsxioreadersheet;
const xlsxioreadersheet handle; const xlsxioreadersheet handle;
xlsx_sheet_handle(xlsxioreadersheet handle): handle(handle) {} xlsx_sheet_handle(xlsxioreadersheet handle): handle(handle) {}
static xlsx_sheet_handle_identity _identity; static xlsx_sheet_handle_identity _identity;

@ -77,20 +77,6 @@ set_source_files_properties( Brushes.h PROPERTIES HEADER_FILE_ONLY TRUE )
add_library(buildingplan-lib STATIC buildingplan-lib.cpp) add_library(buildingplan-lib STATIC buildingplan-lib.cpp)
target_link_libraries(buildingplan-lib dfhack) 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})
add_library(expat STATIC IMPORTED)
set_target_properties(expat PROPERTIES IMPORTED_LOCATION ${LIBEXPAT_LIB})
if(WIN32)
set(LIB_Z_LIB "depends/zlib/lib/zlib")
else()
set(LIB_Z_LIB "z")
endif()
# Plugins # Plugins
option(BUILD_SUPPORTED "Build the supported plugins (reveal, probe, etc.)." ON) option(BUILD_SUPPORTED "Build the supported plugins (reveal, probe, etc.)." ON)
if(BUILD_SUPPORTED) if(BUILD_SUPPORTED)
@ -189,11 +175,8 @@ if(BUILD_SUPPORTED)
add_subdirectory(tweak) add_subdirectory(tweak)
dfhack_plugin(workflow workflow.cpp LINK_LIBRARIES lua) dfhack_plugin(workflow workflow.cpp LINK_LIBRARIES lua)
dfhack_plugin(workNow workNow.cpp) 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)
dfhack_plugin(zone zone.cpp LINK_LIBRARIES lua) dfhack_plugin(zone zone.cpp LINK_LIBRARIES lua)
target_include_directories(xlsxreader PRIVATE ${XLSXIO_INSTALL_DIR}/include)
add_dependencies(xlsxreader xlsxio_project)
endif() endif()
# this is the skeleton plugin. If you want to make your own, make a copy and then change it # this is the skeleton plugin. If you want to make your own, make a copy and then change it