From 3bd426dce9d6c9e37dc08e9591a2caa6fa1fdb20 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 24 Jun 2017 11:14:10 +0200 Subject: Add build system support for modularization --- build/root.build | 3 ++- libbutl/buildfile | 6 ++++-- libbutl/export.hxx | 10 +++++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/build/root.build b/build/root.build index 196d2a3..63e6266 100644 --- a/build/root.build +++ b/build/root.build @@ -2,10 +2,11 @@ # copyright : Copyright (c) 2014-2017 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -cxx.std = latest +cxx.std = experimental using cxx +mxx{*}: extension = mxx hxx{*}: extension = hxx ixx{*}: extension = ixx txx{*}: extension = txx diff --git a/libbutl/buildfile b/libbutl/buildfile index 42fc421..28cbc7b 100644 --- a/libbutl/buildfile +++ b/libbutl/buildfile @@ -71,9 +71,11 @@ if $version.pre_release else lib{butl}: bin.lib.version = @"-$version.major.$version.minor" +bmi{*}: cxx.poptions += -DLIBBUTL_MODULE_BUILD + cxx.poptions =+ "-I$out_root" "-I$src_root" -obja{*}: cxx.poptions += -DLIBBUTL_STATIC_BUILD -objs{*}: cxx.poptions += -DLIBBUTL_SHARED_BUILD +obja{*} bmia{*}: cxx.poptions += -DLIBBUTL_STATIC_BUILD +objs{*} bmis{*}: cxx.poptions += -DLIBBUTL_SHARED_BUILD lib{butl}: cxx.export.poptions = "-I$out_root" "-I$src_root" liba{butl}: cxx.export.poptions += -DLIBBUTL_STATIC diff --git a/libbutl/export.hxx b/libbutl/export.hxx index 3c2d2a9..5c59539 100644 --- a/libbutl/export.hxx +++ b/libbutl/export.hxx @@ -5,6 +5,14 @@ #ifndef LIBBUTL_EXPORT_HXX #define LIBBUTL_EXPORT_HXX +// If we are compiling a module interface, setup the module export. +// +#ifdef LIBBUTL_MODULE_BUILD +# define LIBBUTL_MODEXPORT export +#else +# define LIBBUTL_MODEXPORT +#endif + // Normally we don't export class templates (but do complete specializations), // inline functions, and classes with only inline member functions. Exporting // classes that inherit from non-exported/imported bases (e.g., std::string) @@ -35,7 +43,7 @@ // type. Note that this fallback works for both static and shared but in case // of shared will be sub-optimal compared to having dllimport. // -# define LIBBUTL_SYMEXPORT // Using static or shared. +# define LIBBUTL_SYMEXPORT // Using static or shared. #endif #endif // LIBBUTL_EXPORT_HXX -- cgit v1.1