From: <ai...@us...> - 2013-07-01 04:14:20
|
Revision: 12398 http://sourceforge.net/p/plplot/code/12398 Author: airwin Date: 2013-07-01 04:14:16 +0000 (Mon, 01 Jul 2013) Log Message: ----------- Make libharu and its demos build properly for MinGW compiler. The visibility macros and corresponding CMake logic were completely reorganized and rationalized and another fix (HPDF_FontDef and HPDF_U3D typedefs implemented) done to make build work with MinGW compiler. Tested by: Alan W. Irwin <ai...@us...> using the build_libharu target for both "Unix Makefiles" on Linux and "MinGW Makefiles" on Wine version of Windows. Modified Paths: -------------- trunk/cmake/build_projects/libharu/CMakeLists.txt trunk/cmake/build_projects/libharu/demo/CMakeLists.txt trunk/cmake/build_projects/libharu/include/hpdf.h trunk/cmake/build_projects/libharu/src/CMakeLists.txt Modified: trunk/cmake/build_projects/libharu/CMakeLists.txt =================================================================== --- trunk/cmake/build_projects/libharu/CMakeLists.txt 2013-07-01 03:59:28 UTC (rev 12397) +++ trunk/cmake/build_projects/libharu/CMakeLists.txt 2013-07-01 04:14:16 UTC (rev 12398) @@ -82,23 +82,6 @@ option(USE_RPATH "Use -rpath when linking libraries, executables" ON) endif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") -# Set macros to define visibility for various Windows platforms. -# (gcc visibility support happens by default if none of these -# are defined). -# N.B. something slightly different must be done for the demo -# visibility, but at this stage this CMake-based build system ignores -# building the demos so don't worry about this issue for now. - -if(WIN32) - if(CYGWIN) - # Special Cygwin visibility support. - add_definitions(-DHPDF_DLL_MAKE_CDECL) - else(CYGWIN) - # proprietary and Mingw compilers for Windows without Cygwin. - add_definitions(-DHPDF_DLL_MAKE) - endif(CYGWIN) -endif(WIN32) - # Description of libharu for cpack. set(LIBHARU_DESCRIPTION "libHaru is a free, cross platform, open source library for generating PDF files.") set(LIBHARU_PACKAGE_NAME "libHaru-${LIBHARU_VERSION}-${COMPILER_LABEL}") Modified: trunk/cmake/build_projects/libharu/demo/CMakeLists.txt =================================================================== --- trunk/cmake/build_projects/libharu/demo/CMakeLists.txt 2013-07-01 03:59:28 UTC (rev 12397) +++ trunk/cmake/build_projects/libharu/demo/CMakeLists.txt 2013-07-01 04:14:16 UTC (rev 12398) @@ -66,6 +66,11 @@ # link the examples to the shared library otherwise to the static if(LIBHARU_SHARED) set(_LIBHARU_LIB hpdf) + if(CYGWIN OR MINGW) + add_definitions(-DHPDF_DLL_CDECL) + elseif(WIN32) + add_definitions(-DHPDF_DLL) + endif(CYGWIN OR MINGW) else(LIBHARU_SHARED) set(_LIBHARU_LIB hpdf_static) endif(LIBHARU_SHARED) Modified: trunk/cmake/build_projects/libharu/include/hpdf.h =================================================================== --- trunk/cmake/build_projects/libharu/include/hpdf.h 2013-07-01 03:59:28 UTC (rev 12397) +++ trunk/cmake/build_projects/libharu/include/hpdf.h 2013-07-01 04:14:16 UTC (rev 12398) @@ -20,37 +20,33 @@ #include "hpdf_config.h" #include "hpdf_version.h" -#ifdef HPDF_DLL_MAKE -# define HPDF_EXPORT(A) __declspec(dllexport) A __stdcall +#if defined ( hpdf_EXPORTS ) + #if defined ( HPDF_DLL_MAKE ) + #define HPDF_EXPORT(A) __declspec(dllexport) A __stdcall + #elif defined ( HPDF_DLL_MAKE_CDECL ) + #define HPDF_EXPORT(A) __declspec(dllexport) A + #elif defined ( __GNUC__ ) && __GNUC__ > 3 + // Follow ideas in http://gcc.gnu.org/wiki/Visibility for GCC version 4.x + #define HPDF_EXPORT(A) __attribute__ ((visibility("default"))) A + #elif defined ( HPDF_SHARED_MAKE ) + #define HPDF_EXPORT(A) extern A + #else + #define HPDF_EXPORT(A) extern A + #endif #else -# ifdef HPDF_DLL_MAKE_CDECL -# define HPDF_EXPORT(A) __declspec(dllexport) A -# else -# ifdef HPDF_SHARED_MAKE -# define HPDF_EXPORT(A) extern A -# elif defined ( __GNUC__ ) && __GNUC__ > 3 -/* Follow ideas in http://gcc.gnu.org/wiki/Visibility for GCC version 4.x */ -# define HPDF_EXPORT(A) __attribute__ ((visibility("default"))) A -# endif -# endif /* HPDF_DLL_MAKE_CDECL */ -#endif /* HPDF_DLL_MAKE */ + #if defined ( HPDF_DLL) + #define HPDF_SHARED + #define HPDF_EXPORT(A) __declspec(dllimport) A __stdcall + #elif defined ( HPDF_DLL_CDECL ) + #define HPDF_SHARED + #define HPDF_EXPORT(A) __declspec(dllimport) A + #else + #define HPDF_EXPORT(A) extern A + #endif +#endif -#ifdef HPDF_DLL -# define HPDF_SHARED -# define HPDF_EXPORT(A) __declspec(dllimport) A __stdcall -#else -# ifdef HPDF_DLL_CDECL -# define HPDF_SHARED -# define HPDF_EXPORT(A) __declspec(dllimport) A -# endif /* HPDF_DLL_CDECL */ -#endif /* HPDF_DLL */ - #ifdef HPDF_SHARED -#ifndef HPDF_EXPORT -#define HPDF_EXPORT(A) extern A -#endif /* HPDF_EXPORT */ - #include "hpdf_consts.h" #include "hpdf_types.h" @@ -67,13 +63,11 @@ typedef HPDF_HANDLE HPDF_XObject; typedef HPDF_HANDLE HPDF_Annotation; typedef HPDF_HANDLE HPDF_ExtGState; +typedef HPDF_HANDLE HPDF_FontDef; +typedef HPDF_HANDLE HPDF_U3D; #else -#ifndef HPDF_EXPORT -#define HPDF_EXPORT(A) A -#endif /* HPDF_EXPORT */ - #include "hpdf_consts.h" #include "hpdf_doc.h" Modified: trunk/cmake/build_projects/libharu/src/CMakeLists.txt =================================================================== --- trunk/cmake/build_projects/libharu/src/CMakeLists.txt 2013-07-01 03:59:28 UTC (rev 12397) +++ trunk/cmake/build_projects/libharu/src/CMakeLists.txt 2013-07-01 04:14:16 UTC (rev 12398) @@ -86,6 +86,16 @@ ) endif(POST_2.1.0) +# Set macros to define visibility for various Windows platforms. +# (gcc visibility support happens by default if none of these +# are defined). + +if(CYGWIN OR MINGW) + add_definitions(-DHPDF_DLL_MAKE_CDECL) +elseif(WIN32) + add_definitions(-DHPDF_DLL_MAKE) +endif(CYGWIN OR MINGW) + # ======================================================================= # create static and shared haru library # ======================================================================= This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |