From 2c925bffb4ccedc8ddeb4c207bf2accc5142aa5d Mon Sep 17 00:00:00 2001 From: Brecht Sanders Date: Sun, 31 Dec 2017 14:12:22 +0100 Subject: [PATCH] --- CMakeLists.txt | 12 +----------- Changelog.txt | 4 ++++ Makefile | 17 ++++++++++++++++- include/xlsxio_read.h | 2 +- include/xlsxio_write.h | 2 +- lib/xlsxio_private.h | 2 +- lib/xlsxio_write.c | 2 +- 7 files changed, 25 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e8a2e2..a56bced 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,25 +42,15 @@ IF(BUILD_SHARED) ENDIF() FOREACH(LINKTYPE ${LINKTYPES}) - #SET(LINKTYPEDEFINE) - #IF(LINKTYPE STREQUAL "STATIC") - # SET(LINKTYPEDEFINE "BUILD_XLSXIO_STATIC") - #ENDIF() - #IF(LINKTYPE STREQUAL "SHARED") - # SET(LINKTYPEDEFINE "BUILD_XLSXIO_DLL") - #ENDIF() - ADD_LIBRARY(xlsxio_read_${LINKTYPE} ${LINKTYPE} lib/xlsxio_read.c lib/xlsxio_read_sharedstrings.c) - #SET_TARGET_PROPERTIES(xlsxio_read_${LINKTYPE} PROPERTIES COMPILE_DEFINITIONS ${LINKTYPEDEFINE}) SET_TARGET_PROPERTIES(xlsxio_read_${LINKTYPE} PROPERTIES COMPILE_DEFINITIONS "BUILD_XLSXIO") - SET_TARGET_PROPERTIES(xlsxio_read_${LINKTYPE} PROPERTIES DEFINE_SYMBOL "BUILD_XLSXIO_DLL") + SET_TARGET_PROPERTIES(xlsxio_read_${LINKTYPE} PROPERTIES DEFINE_SYMBOL "BUILD_XLSXIO_${LINKTYPE}") SET_TARGET_PROPERTIES(xlsxio_read_${LINKTYPE} PROPERTIES OUTPUT_NAME xlsxio_read) TARGET_INCLUDE_DIRECTORIES(xlsxio_read_${LINKTYPE} PRIVATE lib) TARGET_LINK_LIBRARIES(xlsxio_read_${LINKTYPE} ${LIBZIP_LIBRARIES} ${EXPAT_LIBRARIES}) SET(ALLTARGETS ${ALLTARGETS} xlsxio_read_${LINKTYPE}) ADD_LIBRARY(xlsxio_write_${LINKTYPE} ${LINKTYPE} lib/xlsxio_write.c) - #SET_TARGET_PROPERTIES(xlsxio_write_${LINKTYPE} PROPERTIES COMPILE_DEFINITIONS ${LINKTYPEDEFINE}) SET_TARGET_PROPERTIES(xlsxio_write_${LINKTYPE} PROPERTIES COMPILE_DEFINITIONS "BUILD_XLSXIO") SET_TARGET_PROPERTIES(xlsxio_write_${LINKTYPE} PROPERTIES DEFINE_SYMBOL "BUILD_XLSXIO_DLL") SET_TARGET_PROPERTIES(xlsxio_write_${LINKTYPE} PROPERTIES OUTPUT_NAME xlsxio_write) diff --git a/Changelog.txt b/Changelog.txt index f3da034..367f136 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,9 @@ 0.2.11 +2017-12-31 Brecht Sanders https://github.com/brechtsanders/ + + * fixed CMakeLists.txt for proper DLL builds on Windows + 2017-11-28 Brecht Sanders https://github.com/brechtsanders/ * fixed bug in XML_Char_poscpy when compiled for UTF-16 (thanks to https://github.com/dsmccall) diff --git a/Makefile b/Makefile index 8f6f9f9..3d7b022 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,15 @@ CP = cp -f CPDIR = cp -rf DOXYGEN := $(shell which doxygen) +OSALIAS := $(OS) +ifeq ($(OS),Windows_NT) +ifneq (,$(findstring x86_64,$(shell gcc --version))) +OSALIAS := win64 +else +OSALIAS := win32 +endif +endif + XLSXIOREAD_OBJ = lib/xlsxio_read.o lib/xlsxio_read_sharedstrings.o XLSXIOREAD_LDFLAGS = -lzip -lexpat XLSXIOREADW_LDFLAGS = -lzip -lexpatw @@ -177,7 +186,13 @@ package: version .PHONY: package binarypackage: version $(MAKE) PREFIX=binarypackage_temp install STATICDLL=1 - tar cfJ "xlsxio-$(shell cat version)-$(OS).tar.xz" --transform="s?^binarypackage_temp/??" $(COMMON_PACKAGE_FILES) binarypackage_temp/* +ifneq ($(OS),Windows_NT) + tar cfJ "xlsxio-$(shell cat version)-$(OSALIAS).tar.xz" --transform="s?^binarypackage_temp/??" $(COMMON_PACKAGE_FILES) binarypackage_temp/* +else + rm -f xlsxio-$(shell cat version)-$(OSALIAS).zip + cp -f $(COMMON_PACKAGE_FILES) binarypackage_temp/ + cd binarypackage_temp && zip -r -9 "../xlsxio-$(shell cat version)-binary-$(OSALIAS).zip" $(COMMON_PACKAGE_FILES) * && cd .. +endif rm -rf binarypackage_temp .PHONY: clean diff --git a/include/xlsxio_read.h b/include/xlsxio_read.h index 3211b5d..616f970 100644 --- a/include/xlsxio_read.h +++ b/include/xlsxio_read.h @@ -60,7 +60,7 @@ typedef unsigned __int64 uint64_t; /*! \cond PRIVATE */ #ifndef DLL_EXPORT_XLSXIO #ifdef _WIN32 -#if defined(BUILD_XLSXIO_DLL) +#if defined(BUILD_XLSXIO_DLL) || defined(BUILD_XLSXIO_SHARED) #define DLL_EXPORT_XLSXIO __declspec(dllexport) #elif !defined(STATIC) && !defined(BUILD_XLSXIO_STATIC) && !defined(BUILD_XLSXIO) #define DLL_EXPORT_XLSXIO __declspec(dllimport) diff --git a/include/xlsxio_write.h b/include/xlsxio_write.h index 07012d4..7d9c9a6 100644 --- a/include/xlsxio_write.h +++ b/include/xlsxio_write.h @@ -45,7 +45,7 @@ typedef signed __int64 int64_t; /*! \cond PRIVATE */ #ifndef DLL_EXPORT_XLSXIO #ifdef _WIN32 -#if defined(BUILD_XLSXIO_DLL) +#if defined(BUILD_XLSXIO_DLL) || defined(BUILD_XLSXIO_SHARED) #define DLL_EXPORT_XLSXIO __declspec(dllexport) #elif !defined(STATIC) && !defined(BUILD_XLSXIO_STATIC) && !defined(BUILD_XLSXIO) #define DLL_EXPORT_XLSXIO __declspec(dllimport) diff --git a/lib/xlsxio_private.h b/lib/xlsxio_private.h index 3285498..b7459e6 100644 --- a/lib/xlsxio_private.h +++ b/lib/xlsxio_private.h @@ -1,7 +1,7 @@ #ifndef INCLUDED_XLSXIO_PRIVATE_H #define INCLUDED_XLSXIO_PRIVATE_H -#if (defined(STATIC) || defined(BUILD_XLSXIO_STATIC) || defined(BUILD_XLSXIO_STATIC_DLL) || (defined(BUILD_XLSXIO) && !defined(BUILD_XLSXIO_DLL))) && !defined(ZIP_STATIC) +#if (defined(STATIC) || defined(BUILD_XLSXIO_STATIC) || defined(BUILD_XLSXIO_STATIC_DLL) || (defined(BUILD_XLSXIO) && !defined(BUILD_XLSXIO_DLL) && !defined(BUILD_XLSXIO_SHARED))) && !defined(ZIP_STATIC) #define ZIP_STATIC #endif #include diff --git a/lib/xlsxio_write.c b/lib/xlsxio_write.c index 6412c27..5e37daa 100644 --- a/lib/xlsxio_write.c +++ b/lib/xlsxio_write.c @@ -10,7 +10,7 @@ #endif #include #include -#if (defined(STATIC) || defined(BUILD_XLSXIO_STATIC) || defined(BUILD_XLSXIO_STATIC_DLL) || (defined(BUILD_XLSXIO) && !defined(BUILD_XLSXIO_DLL))) && !defined(ZIP_STATIC) +#if (defined(STATIC) || defined(BUILD_XLSXIO_STATIC) || defined(BUILD_XLSXIO_STATIC_DLL) || (defined(BUILD_XLSXIO) && !defined(BUILD_XLSXIO_DLL) && !defined(BUILD_XLSXIO_SHARED))) && !defined(ZIP_STATIC) #define ZIP_STATIC #endif #include