# file : buildfile # copyright : Copyright (c) 2014-2016 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file ./: exe{driver} lib{bar}: {hxx cxx}{bar} # The order of prerequisites is important. When compile with VC using modules # the module interface file (foo.ifc) should be produced before module consumer # (driver.cxx) is compiled. The same reasoning is applied for bar.ifc. # if ($cxx.id == "msvc") exe{driver}: lib{bar} {hxx cxx}{foo} cxx{driver} else exe{driver}: {hxx cxx}{foo} cxx{driver} lib{bar} cxx.poptions =+ -I$src_root if ($use_modules == true) { cxx.poptions += -DMODTEST_USE_MODULES if ($cxx.id == "clang") { # -Wno-ambiguous-macro - required to suppress "ambiguous expansion of macro # MODTEST_MACRO" warning (do not mix up with macro # redefinition warning). The warning seems to follow # from a module macro leakage effect. # cxx.coptions += -fmodules -Wno-ambiguous-macro \ -fmodules-cache-path=$out_root/modcache # Frankly not 100% sure this is required. # obj{foo}: cxx.coptions += -fmodule-name=foo obj{bar}: cxx.coptions += -fmodule-name=bar } if ($cxx.id == "clang-apple") { # While compiler (8.0.0) recognizes -fmodules* options they just get # ignored as no import module semantics is assigned to #include directive. # # @@ Can there be something wrong with module.modulemap file? # cxx.coptions += -fmodules -fmodules-cache-path=$out_root/modcache obj{foo}: cxx.coptions += -fmodule-name=foo obj{bar}: cxx.coptions += -fmodule-name=bar } elif ($cxx.id == "msvc") { # /module:interface - produce ifc-file if there is interface definition # in a file. # /module:search - directory to search for ifc-files. In its absense # need to use /module:reference option when # compile consumer of the module represented with the # corresponding ifc-file. # cxx.coptions += /experimental:module /module:interface \ /module:search $out_base } }