aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-06-24 11:14:10 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-06-24 11:14:10 +0200
commit3bd426dce9d6c9e37dc08e9591a2caa6fa1fdb20 (patch)
tree9fc84320c4b777a52512c317b591c90708f13a7a
parente652a49cbac1098dd97695309336545ef4e9ae89 (diff)
Add build system support for modularization
-rw-r--r--build/root.build3
-rw-r--r--libbutl/buildfile6
-rw-r--r--libbutl/export.hxx10
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