diff options
author | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2020-05-06 08:19:14 +0000 |
---|---|---|
committer | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2020-05-06 08:19:14 +0000 |
commit | efa006d4aeacd533abcdc39ee4943803deb5ec56 (patch) | |
tree | 237ce386a1421d433a454b6aecb8cc803a865280 | |
parent | 9b2cafe5addb364cdb62d1c935c662b80317d941 (diff) | |
parent | 16e6d3ce59638846fc09caec7b9014b9230fbb30 (diff) |
Merge branch 'use-dllexport-1-14' into 'cairomm-1-14'
Use __declspec(dllexport) when building cairomm on Visual Studio (cairomm-1-14)
See merge request cairo/cairomm!4
-rw-r--r-- | MSVC_NMake/README | 6 | ||||
-rw-r--r-- | MSVC_NMake/build-rules-msvc.mak | 9 | ||||
-rw-r--r-- | MSVC_NMake/config-msvc.mak | 14 | ||||
-rw-r--r-- | MSVC_NMake/gendef/meson.build | 9 | ||||
-rw-r--r-- | MSVC_NMake/generate-msvc.mak | 3 | ||||
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | cairomm/context.h | 2 | ||||
-rw-r--r-- | cairomm/device.h | 2 | ||||
-rw-r--r-- | cairomm/exception.h | 4 | ||||
-rw-r--r-- | cairomm/fontface.h | 12 | ||||
-rw-r--r-- | cairomm/fontoptions.h | 4 | ||||
-rw-r--r-- | cairomm/matrix.h | 9 | ||||
-rw-r--r-- | cairomm/meson.build | 52 | ||||
-rw-r--r-- | cairomm/path.h | 4 | ||||
-rw-r--r-- | cairomm/pattern.h | 14 | ||||
-rw-r--r-- | cairomm/quartz_font.h | 2 | ||||
-rw-r--r-- | cairomm/quartz_surface.h | 2 | ||||
-rw-r--r-- | cairomm/region.h | 2 | ||||
-rw-r--r-- | cairomm/scaledfont.h | 4 | ||||
-rw-r--r-- | cairomm/script.h | 2 | ||||
-rw-r--r-- | cairomm/script_surface.h | 2 | ||||
-rw-r--r-- | cairomm/surface.h | 14 | ||||
-rw-r--r-- | cairomm/types.h | 2 | ||||
-rw-r--r-- | cairomm/win32_font.h | 4 | ||||
-rw-r--r-- | cairomm/win32_surface.h | 4 | ||||
-rw-r--r-- | cairomm/xlib_surface.h | 2 | ||||
-rw-r--r-- | cairommconfig.h.in | 19 | ||||
-rw-r--r-- | cairommconfig.h.meson | 18 | ||||
-rw-r--r-- | meson.build | 3 |
29 files changed, 123 insertions, 102 deletions
diff --git a/MSVC_NMake/README b/MSVC_NMake/README index 944642e..7ff0da1 100644 --- a/MSVC_NMake/README +++ b/MSVC_NMake/README @@ -6,8 +6,12 @@ Building cairomm with Visual Studio .NET 2015 or later the paths to headers and import libraries to Visual Studio, if they are not already in
$(srcroot)/../vs$(VSVER)/$(Platform).
* In a Visual Studio command prompt, go to $(srcroot)\MSVC_NMake
-* Build using nmake /f Makefile.vc CFG=[release|debug]
+* Build using nmake /f Makefile.vc CFG=[release|debug].
* Run the tests
+* If it is inconvenient for you to re-build any software using
+ cairomm, you may need to pass in BUILD_COMPAT_LIB in your
+ NMake command line so that your application will continue to
+ run properly.
Cedric Gustin
08/18/2006
diff --git a/MSVC_NMake/build-rules-msvc.mak b/MSVC_NMake/build-rules-msvc.mak index 7a10d21..22b772e 100644 --- a/MSVC_NMake/build-rules-msvc.mak +++ b/MSVC_NMake/build-rules-msvc.mak @@ -33,8 +33,8 @@ $(CAIROMM_LIB): $(CAIROMM_DLL) # $(dependent_objects) # << # @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2 -$(CAIROMM_DLL): vs$(PDBVER)\$(CFG)\$(PLAT)\cairomm\cairomm.def $(cairomm_OBJS) - link /DLL $(LDFLAGS_NOLTCG) $(CAIRO_LIB) $(LIBSIGC_LIB) /implib:$(CAIROMM_LIB) /def:vs$(PDBVER)\$(CFG)\$(PLAT)\cairomm\cairomm.def -out:$@ @<< +$(CAIROMM_DLL): $(cairomm_OBJS) $(EXTRA_CAIROMM_DEPENDENCIES) + link /DLL $(LDFLAGS_NOLTCG) $(CAIRO_LIB) $(LIBSIGC_LIB) /implib:$(CAIROMM_LIB) $(EXTRA_CAIROMM_LDFLAG) -out:$@ @<< $(cairomm_OBJS) << @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2 @@ -47,9 +47,10 @@ $(cairomm_OBJS) # << # @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1 -{.\gendef\}.cc{vs$(PDBVER)\$(CFG)\$(PLAT)\}.exe: +{..\MSVC_NMake\gendef\}.cc{vs$(PDBVER)\$(CFG)\$(PLAT)\}.exe: @if not exist $(@D)\gendef\ md $(@D)\gendef - $(CXX) $(CAIROMM_BASE_CFLAGS) $(CFLAGS) /Fo$(@D)\gendef\ /Fd$(@D)\gendef\ $< /link $(LDFLAGS) /out:$@ + $(CXX) $(CFLAGS) /Fo$(@D)\gendef\ /Fd$(@D)\gendef\ $< /Fe$@ /link $(LDFLAGS) + @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1 {..\examples\text\}.cc{vs$(PDBVER)\$(CFG)\$(PLAT)\}.exe: @if not exist vs$(PDBVER)\$(CFG)\$(PLAT)\cairomm-ex\ md vs$(PDBVER)\$(CFG)\$(PLAT)\cairomm-ex diff --git a/MSVC_NMake/config-msvc.mak b/MSVC_NMake/config-msvc.mak index 3f595c8..7af088f 100644 --- a/MSVC_NMake/config-msvc.mak +++ b/MSVC_NMake/config-msvc.mak @@ -23,7 +23,17 @@ CAIROMM_BASE_CFLAGS = \ /I.. /I.\cairomm \ /D_USE_MATH_DEFINES \ /EHsc \ - /wd4530 + /wd4251 /wd4275 /wd4530 + +!ifdef BUILD_COMPAT_LIB +CAIROMM_BASE_CFLAGS = $(CAIROMM_BASE_CFLAGS) /DCAIROMM_USE_GENDEF +EXTRA_CAIROMM_DEPENDENCIES = \ +vs$(PDBVER)\$(CFG)\$(PLAT)\cairomm\cairomm.def +EXTRA_CAIROMM_LDFLAG = /def:vs$(PDBVER)\$(CFG)\$(PLAT)\cairomm\cairomm.def +!else +EXTRA_CAIROMM_DEPENDENCIES = +EXTRA_CAIROMM_LDFLAG = +!endif CAIROMM_EXTRA_INCLUDES = \ /I$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION) \ @@ -58,8 +68,8 @@ CAIROMM_LIBNAME = cairomm-vc$(PDBVER)0$(DEBUG_SUFFIX)-$(CAIROMM_MAJOR_VERSION)_$ CAIROMM_DLL = vs$(PDBVER)\$(CFG)\$(PLAT)\$(CAIROMM_LIBNAME).dll CAIROMM_LIB = vs$(PDBVER)\$(CFG)\$(PLAT)\$(CAIROMM_LIBNAME).lib -GENDEF = vs$(PDBVER)\$(CFG)\$(PLAT)\gendef.exe CAIRO_LIB = cairo.lib +GENDEF = vs$(PDBVER)\$(CFG)\$(PLAT)\gendef.exe !ifdef BOOST_DLL CAIROMM_EX_CFLAGS = $(CAIROMM_EX_CFLAGS) /DBOOST_ALL_DYN_LINK diff --git a/MSVC_NMake/gendef/meson.build b/MSVC_NMake/gendef/meson.build deleted file mode 100644 index 3dc9cc2..0000000 --- a/MSVC_NMake/gendef/meson.build +++ /dev/null @@ -1,9 +0,0 @@ -# MSVC_NMake/gendef - -# Input: is_msvc -# Output: gendef - -# Used to generate the .def file required to obtain the import .lib file -if is_msvc - gendef = executable('gendef', 'gendef.cc', install: false) -endif diff --git a/MSVC_NMake/generate-msvc.mak b/MSVC_NMake/generate-msvc.mak index 0df14e7..3233766 100644 --- a/MSVC_NMake/generate-msvc.mak +++ b/MSVC_NMake/generate-msvc.mak @@ -4,9 +4,8 @@ # one is maintaining the NMake build files. # Generate .def files - vs$(PDBVER)\$(CFG)\$(PLAT)\cairomm\cairomm.def: $(GENDEF) $(cairomm_OBJS) - vs$(PDBVER)\$(CFG)\$(PLAT)\gendef.exe $@ $(CAIROMM_LIBNAME) vs$(PDBVER)\$(CFG)\$(PLAT)\cairomm\*.obj + $(GENDEF) $@ $(CAIROMM_LIBNAME) $(@D)\*.obj # Generate pre-generated resources and configuration headers (builds from GIT) prep-git-build: pkg-ver.mak diff --git a/Makefile.am b/Makefile.am index 0f50ed5..1f67414 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,7 +46,6 @@ EXTRA_DIST = \ meson_options.txt \ cairommconfig.h.meson \ MSVC_NMake/cairomm/meson.build \ - MSVC_NMake/gendef/meson.build \ cairomm/meson.build \ data/meson.build \ docs/reference/meson.build \ diff --git a/cairomm/context.h b/cairomm/context.h index 90e6e7b..93ab2ce 100644 --- a/cairomm/context.h +++ b/cairomm/context.h @@ -48,7 +48,7 @@ namespace Cairo * * Context is a reference-counted object that should be used via Cairo::RefPtr. */ -class Context +class CAIROMM_API Context { protected: explicit Context(const RefPtr<Surface>& target); diff --git a/cairomm/device.h b/cairomm/device.h index 3cb1e7c..79cd84c 100644 --- a/cairomm/device.h +++ b/cairomm/device.h @@ -53,7 +53,7 @@ namespace Cairo * * @since 1.10 */ -class Device +class CAIROMM_API Device { public: /** A convenience class for acquiring a Device object in an exception-safe diff --git a/cairomm/exception.h b/cairomm/exception.h index 25731a9..b60c190 100644 --- a/cairomm/exception.h +++ b/cairomm/exception.h @@ -19,6 +19,8 @@ #ifndef __CAIRO_EXCEPTION_H #define __CAIRO_EXCEPTION_H +#include <cairommconfig.h> + #include <cairomm/enums.h> #include <stdexcept> @@ -32,7 +34,7 @@ namespace Cairo /** */ -class logic_error: public std::logic_error +class CAIROMM_API logic_error: public std::logic_error { public: explicit logic_error(ErrorStatus status); diff --git a/cairomm/fontface.h b/cairomm/fontface.h index 4243b09..7a05ad0 100644 --- a/cairomm/fontface.h +++ b/cairomm/fontface.h @@ -34,8 +34,8 @@ namespace Cairo { -class ScaledFont; -class Context; +class CAIROMM_API ScaledFont; +class CAIROMM_API Context; /** * A FontFace represents a particular font at a particular weight, slant, and @@ -45,7 +45,7 @@ class Context; * using the toy text API by way of Context::select_font_face(). The resulting * face can be accessed using Context::get_font_face(). */ -class FontFace +class CAIROMM_API FontFace { protected: @@ -101,7 +101,7 @@ protected: * A simple font face used for the cairo 'toy' font API. * @since 1.8 */ -class ToyFontFace : public FontFace +class CAIROMM_API ToyFontFace : public FontFace { public: @@ -204,7 +204,7 @@ protected: * * @since 1.8 */ -class UserFontFace : public FontFace +class CAIROMM_API UserFontFace : public FontFace { public: @@ -397,7 +397,7 @@ private: // font system support #ifdef CAIRO_HAS_FT_FONT -class FtFontFace : public FontFace +class CAIROMM_API FtFontFace : public FontFace { public: /** Creates a new font face for the FreeType font backend from a pre-opened diff --git a/cairomm/fontoptions.h b/cairomm/fontoptions.h index 3059c69..7279b2e 100644 --- a/cairomm/fontoptions.h +++ b/cairomm/fontoptions.h @@ -19,6 +19,8 @@ #ifndef __CAIROMM_FONTOPTIONS_H #define __CAIROMM_FONTOPTIONS_H +#include <cairommconfig.h> + #include <cairomm/enums.h> #include <string> //#include <cairo.h> @@ -35,7 +37,7 @@ namespace Cairo * need any changes, but for pixel-based targets tweaking font options * may result in superior output on a particular display. */ -class FontOptions +class CAIROMM_API FontOptions { public: FontOptions(); diff --git a/cairomm/matrix.h b/cairomm/matrix.h index fe2fef9..603576d 100644 --- a/cairomm/matrix.h +++ b/cairomm/matrix.h @@ -18,6 +18,8 @@ #ifndef __CAIROMM_MATRIX_H #define __CAIROMM_MATRIX_H +#include <cairommconfig.h> + #include <cairo.h> namespace Cairo @@ -47,7 +49,7 @@ namespace Cairo * @sa Context::get_matrix() * @sa Context::set_matrix() */ -class Matrix : public cairo_matrix_t +class CAIROMM_API Matrix : public cairo_matrix_t { public: /** Creates an uninitialized matrix. If you want a matrix initialized to a @@ -163,6 +165,7 @@ public: * * @relates Matrix */ +CAIROMM_API Matrix identity_matrix(); /** Returns a Matrix initialized to a transformation that translates by tx and @@ -173,6 +176,7 @@ Matrix identity_matrix(); * * @relates Matrix */ +CAIROMM_API Matrix translation_matrix(double tx, double ty); /** Returns a Matrix initialized to a transformation that scales by sx and sy in @@ -183,6 +187,7 @@ Matrix translation_matrix(double tx, double ty); * * @relates Matrix */ +CAIROMM_API Matrix scaling_matrix(double sx, double sy); /** Returns a Matrix initialized to a transformation that rotates by radians. @@ -194,6 +199,7 @@ Matrix scaling_matrix(double sx, double sy); * * @relates Matrix */ +CAIROMM_API Matrix rotation_matrix(double radians); /** Multiplies the affine transformations in a and b together and returns the @@ -208,6 +214,7 @@ Matrix rotation_matrix(double radians); * * @relates Matrix */ +CAIROMM_API Matrix operator*(const Matrix& a, const Matrix& b); } // namespace Cairo diff --git a/cairomm/meson.build b/cairomm/meson.build index 298c930..afc724f 100644 --- a/cairomm/meson.build +++ b/cairomm/meson.build @@ -1,7 +1,7 @@ # cairomm # Input: cairomm_build_dep, cairomm_pcname, cairomm_libversion, cairomm_rc, -# is_msvc, gendef +# is_msvc # Output: source_h_files, cairomm_dep # There are no built source files in cairomm. @@ -79,48 +79,14 @@ endif extra_include_dirs = ['..'] -if not is_msvc - cairomm_library = library(cairomm_pcname, - cairomm_cc, extra_cairomm_objects, - version: cairomm_libversion, - include_directories: extra_include_dirs, - cpp_args: cairomm_cpp_args, - dependencies: cairomm_build_dep, - install: true, - ) -else # is_msvc - - # Run gendef.exe to get the .def file needed for obtaining - # the .lib file for the cairomm DLL. - cairomm_int_lib = static_library('cairomm-int', - cairomm_cc, - include_directories: extra_include_dirs, - cpp_args: cairomm_cpp_args, - dependencies: cairomm_build_dep, - install: false, - ) - - cairomm_def = custom_target('cairomm.def', - output: 'cairomm.def', - depends: cairomm_int_lib, - command: [ gendef, - '@OUTPUT@', - '@0@-@1@.dll'.format(cairomm_pcname, cairomm_libversion.split('.')[0]), - cairomm_int_lib.full_path(), - ], - install: false, - ) - cairomm_extra_link_args = ['/def:@0@'.format(cairomm_def.full_path())] - - cairomm_library = library(cairomm_pcname, extra_cairomm_objects, - objects: cairomm_int_lib.extract_all_objects(), - version: cairomm_libversion, - dependencies: cairomm_build_dep, - link_depends: cairomm_def, - link_args: cairomm_extra_link_args, - install: true, - ) -endif +cairomm_library = library(cairomm_pcname, + cairomm_cc, extra_cairomm_objects, + version: cairomm_libversion, + include_directories: extra_include_dirs, + cpp_args: cairomm_cpp_args, + dependencies: cairomm_build_dep, + install: true, +) # This is useful in the main project when cairomm is used as a subproject. # It's also used when building example programs and test programs. diff --git a/cairomm/path.h b/cairomm/path.h index f168d94..d1f7d5f 100644 --- a/cairomm/path.h +++ b/cairomm/path.h @@ -19,6 +19,8 @@ #ifndef __CAIROMM_PATH_H #define __CAIROMM_PATH_H +#include <cairommconfig.h> + #include <cairomm/enums.h> #include <string> #include <cairo.h> @@ -35,7 +37,7 @@ namespace Cairo * @todo There's currently no way to access the path data without reverting to * the C object (see cobj()) */ -class Path +class CAIROMM_API Path { public: //Path(); diff --git a/cairomm/pattern.h b/cairomm/pattern.h index 269fe0d..957ed12 100644 --- a/cairomm/pattern.h +++ b/cairomm/pattern.h @@ -32,7 +32,7 @@ struct ColorStop double red, green, blue, alpha; }; -class Matrix; +class CAIROMM_API Matrix; /** * Cairo::Pattern is the paint with which cairo draws. The primary use of @@ -41,7 +41,7 @@ class Matrix; * * This is a reference-counted object that should be used via Cairo::RefPtr. */ -class Pattern +class CAIROMM_API Pattern { protected: //Use derived constructors. @@ -152,7 +152,7 @@ protected: cobject* m_cobject; }; -class SolidPattern : public Pattern +class CAIROMM_API SolidPattern : public Pattern { protected: @@ -205,7 +205,7 @@ public: ~SolidPattern() override; }; -class SurfacePattern : public Pattern +class CAIROMM_API SurfacePattern : public Pattern { protected: @@ -272,7 +272,7 @@ public: Filter get_filter() const; }; -class Gradient : public Pattern +class CAIROMM_API Gradient : public Pattern { protected: //Use derived constructors. @@ -346,7 +346,7 @@ protected: Gradient(); }; -class LinearGradient : public Gradient +class CAIROMM_API LinearGradient : public Gradient { protected: @@ -394,7 +394,7 @@ public: static RefPtr<LinearGradient> create(double x0, double y0, double x1, double y1); }; -class RadialGradient : public Gradient +class CAIROMM_API RadialGradient : public Gradient { protected: diff --git a/cairomm/quartz_font.h b/cairomm/quartz_font.h index 5c3ddb2..16fd479 100644 --- a/cairomm/quartz_font.h +++ b/cairomm/quartz_font.h @@ -35,7 +35,7 @@ namespace Cairo * * @since 1.8 */ -class QuartzFontFace : public FontFace +class CAIROMM_API QuartzFontFace : public FontFace { public: diff --git a/cairomm/quartz_surface.h b/cairomm/quartz_surface.h index 4f9fcfb..31737f7 100644 --- a/cairomm/quartz_surface.h +++ b/cairomm/quartz_surface.h @@ -39,7 +39,7 @@ namespace Cairo * * @since 1.4 */ -class QuartzSurface : public Surface +class CAIROMM_API QuartzSurface : public Surface { public: diff --git a/cairomm/region.h b/cairomm/region.h index 686d3f1..01dde0c 100644 --- a/cairomm/region.h +++ b/cairomm/region.h @@ -38,7 +38,7 @@ namespace Cairo * * @since: 1.10 **/ -class Region +class CAIROMM_API Region { private: diff --git a/cairomm/scaledfont.h b/cairomm/scaledfont.h index d82b957..5ccecca 100644 --- a/cairomm/scaledfont.h +++ b/cairomm/scaledfont.h @@ -37,7 +37,7 @@ namespace Cairo * is most useful for low-level font usage where a library or application wants * to cache a reference to a scaled font to speed up the computation of metrics. */ -class ScaledFont +class CAIROMM_API ScaledFont { public: @@ -238,7 +238,7 @@ protected: /** * @since 1.8 */ -class FtScaledFont : public ScaledFont +class CAIROMM_API FtScaledFont : public ScaledFont { public: /** Creates a ScaledFont From a FtFontFace. diff --git a/cairomm/script.h b/cairomm/script.h index 8bc543e..5a27417 100644 --- a/cairomm/script.h +++ b/cairomm/script.h @@ -55,7 +55,7 @@ enum ScriptMode { * * @since 1.12 */ -class Script : public Device { +class CAIROMM_API Script : public Device { public: /** diff --git a/cairomm/script_surface.h b/cairomm/script_surface.h index 75bff7b..f2fc076 100644 --- a/cairomm/script_surface.h +++ b/cairomm/script_surface.h @@ -33,7 +33,7 @@ namespace Cairo { * * @since 1.12 */ -class ScriptSurface : public Surface { +class CAIROMM_API ScriptSurface : public Surface { public: /** diff --git a/cairomm/surface.h b/cairomm/surface.h index 865fc8e..93277f6 100644 --- a/cairomm/surface.h +++ b/cairomm/surface.h @@ -75,7 +75,7 @@ namespace Cairo * * Surfaces are reference-counted objects that should be used via Cairo::RefPtr. */ -class Surface +class CAIROMM_API Surface { public: /** For example: @@ -436,7 +436,7 @@ protected: * * Note that like all surfaces, an ImageSurface is a reference-counted object that should be used via Cairo::RefPtr. */ -class ImageSurface : public Surface +class CAIROMM_API ImageSurface : public Surface { protected: //TODO?: Surface(cairo_surface_t *target); @@ -612,7 +612,7 @@ public: * Note that like all surfaces, a RecordingSurface is a reference-counted object * that should be used via Cairo::RefPtr. */ -class RecordingSurface : public Surface +class CAIROMM_API RecordingSurface : public Surface { public: @@ -704,7 +704,7 @@ typedef enum * @note For this Surface to be available, cairo must have been compiled with * PDF support */ -class PdfSurface : public Surface +class CAIROMM_API PdfSurface : public Surface { public: @@ -807,7 +807,7 @@ typedef enum { * @note For this Surface to be available, cairo must have been compiled with * PostScript support */ -class PsSurface : public Surface +class CAIROMM_API PsSurface : public Surface { public: @@ -962,7 +962,7 @@ typedef enum * @note For this Surface to be available, cairo must have been compiled with * SVG support */ -class SvgSurface : public Surface +class CAIROMM_API SvgSurface : public Surface { public: @@ -1049,7 +1049,7 @@ public: * @warning This is an experimental surface. It is not yet marked as a fully * supported surface by the cairo library */ -class GlitzSurface : public Surface +class CAIROMM_API GlitzSurface : public Surface { public: diff --git a/cairomm/types.h b/cairomm/types.h index 2565b04..80f7a5c 100644 --- a/cairomm/types.h +++ b/cairomm/types.h @@ -18,6 +18,8 @@ #ifndef __CAIROMM_TYPES_H #define __CAIROMM_TYPES_H +#include <cairommconfig.h> + #include <cairo.h> namespace Cairo diff --git a/cairomm/win32_font.h b/cairomm/win32_font.h index 070d664..65d50e7 100644 --- a/cairomm/win32_font.h +++ b/cairomm/win32_font.h @@ -32,7 +32,7 @@ namespace Cairo * * @since 1.8 */ -class Win32FontFace : public FontFace +class CAIROMM_API Win32FontFace : public FontFace { public: @@ -83,7 +83,7 @@ protected: * * @since 1.8 */ -class Win32ScaledFont : public ScaledFont +class CAIROMM_API Win32ScaledFont : public ScaledFont { public: diff --git a/cairomm/win32_surface.h b/cairomm/win32_surface.h index e8dae37..aa8ae23 100644 --- a/cairomm/win32_surface.h +++ b/cairomm/win32_surface.h @@ -40,7 +40,7 @@ namespace Cairo * @note For this Surface to be available, cairo must have been compiled with * Win32 support */ -class Win32Surface : public Surface +class CAIROMM_API Win32Surface : public Surface { public: @@ -124,7 +124,7 @@ public: * * @since 1.8 */ -class Win32PrintingSurface : public Surface +class CAIROMM_API Win32PrintingSurface : public Surface { public: explicit Win32PrintingSurface(cairo_surface_t* cobject, bool has_reference = false); diff --git a/cairomm/xlib_surface.h b/cairomm/xlib_surface.h index 37c8c9c..24e5a29 100644 --- a/cairomm/xlib_surface.h +++ b/cairomm/xlib_surface.h @@ -45,7 +45,7 @@ namespace Cairo * @note For this surface to be availabe, cairo must have been compiled with * support for XLib Surfaces */ -class XlibSurface : public Surface +class CAIROMM_API XlibSurface : public Surface { public: diff --git a/cairommconfig.h.in b/cairommconfig.h.in index f88ed99..268e2b9 100644 --- a/cairommconfig.h.in +++ b/cairommconfig.h.in @@ -11,3 +11,22 @@ /* Micro version number of cairomm. */ #undef CAIROMM_MICRO_VERSION + +/* Enable DLL-specific stuff only when not building a static library */ +#if !defined(__CYGWIN__) && \ + (defined(__MINGW32__) || defined (_MSC_VER)) && \ + !defined(CAIROMM_STATIC_LIB) && \ + !defined(CAIROMM_USE_GENDEF) +# define CAIROMM_DLL 1 +#endif + +#ifdef CAIROMM_DLL +# if defined(CAIROMM_BUILD) +# define CAIROMM_API __declspec(dllexport) +# else +# define CAIROMM_API __declspec(dllimport) +# endif +/* Build a static or non-native-Windows library */ +#else +# define CAIROMM_API +#endif /* CAIROMM_DLL */ diff --git a/cairommconfig.h.meson b/cairommconfig.h.meson index 8923c96..5a1e7b9 100644 --- a/cairommconfig.h.meson +++ b/cairommconfig.h.meson @@ -18,4 +18,22 @@ /* Micro version number of cairomm. */ #mesondefine CAIROMM_MICRO_VERSION +/* Enable DLL-specific stuff only when not building a static library */ +#if !defined(__CYGWIN__) && \ + (defined(__MINGW32__) || defined (_MSC_VER)) && \ + !defined(CAIROMM_STATIC_LIB) +# define CAIROMM_DLL 1 +#endif + +#ifdef CAIROMM_DLL +# if defined(CAIROMM_BUILD) +# define CAIROMM_API __declspec(dllexport) +# else +# define CAIROMM_API __declspec(dllimport) +# endif +/* Build a static or non-native-Windows library */ +#else +# define CAIROMM_API +#endif /* CAIROMM_DLL */ + #endif /* _CAIROMM_CONFIG_H */ diff --git a/meson.build b/meson.build index b9e09ad..837a1ae 100644 --- a/meson.build +++ b/meson.build @@ -203,7 +203,7 @@ add_project_arguments(warning_flags, language: 'cpp') # MSVC: Ignore warnings that aren't really harmful, but make those # that should not be overlooked stand out. if is_msvc - foreach wd : ['/FImsvc_recommended_pragmas.h', '/wd4267', '/wd4530', '/utf-8'] + foreach wd : ['/FImsvc_recommended_pragmas.h', '/wd4251', '/wd4267', '/wd4275', '/wd4530', '/utf-8'] disabled_warning = cpp_compiler.get_supported_arguments(wd) add_project_arguments(disabled_warning, language: 'cpp') endforeach @@ -230,7 +230,6 @@ cairommconfig_h = configure_file( install_dir: install_includeconfigdir, ) -subdir('MSVC_NMake/gendef') subdir('MSVC_NMake/cairomm') subdir('data') subdir('cairomm') |