Skip to content

Commit

Permalink
Replaced config setup to fix #2 and use lib meta data instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
Klaim committed Dec 10, 2022
1 parent cc24203 commit bef2ed5
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 19 deletions.
7 changes: 0 additions & 7 deletions build/config-options.build2

This file was deleted.

8 changes: 7 additions & 1 deletion build/root.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ mxx{*}: extension = cc
#
test.target = $cxx.target

include $src_root/build/config-options.build2

##############################
# Project-specific options:

# Set to true to build and provide the `fmt` C++ module.
config [bool] config.fmt.enable_modules ?= $cxx.features.modules # $($cxx.features.modules == true)

6 changes: 6 additions & 0 deletions fmt/buildfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ lib{fmt}: include/hxx{**} hxx{version} $imp_libs $int_libs
lib{fmt}: src/mxx{fmt} : include = ($config.fmt.enable_modules) # `fmt` C++ module only
lib{fmt}: src/cxx{** -fmt} : include = (!$config.fmt.enable_modules) # no modules only

# Meta data for users
lib{fmt}:
{
fmt.is_module = [bool] $config.fmt.enable_modules
}

# Include the generated version header into the distribution (so that we don't
# pick up an installed one) and don't remove it when cleaning in src (so that
# clean results in a state identical to distributed).
Expand Down
2 changes: 1 addition & 1 deletion tests/basics/buildfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import libs = fmt%lib{fmt}

./ : exe{driver} : {cxx}{driver} hxx{tests.inl} $libs testscript{**}

if($config.fmt.enable_modules)
if $($libs: fmt.is_module)
{
./ : exe{driver-modules} : {cxx}{driver-modules} hxx{tests.inl} $libs testscript{**}
}
Expand Down
4 changes: 1 addition & 3 deletions tests/basics/driver-modules.cxx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@

#include <cassert>
import <chrono>;
import <vector>;

import std;
import fmt;

#include "tests.inl"
Expand Down
1 change: 0 additions & 1 deletion tests/build/config-options.build2

This file was deleted.

7 changes: 1 addition & 6 deletions tests/build/root.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ hxx{*}: extension = hxx
ixx{*}: extension = ixx
txx{*}: extension = txx
cxx{*}: extension = cxx
mxx{*}: extension = cc

# Every exe{} in this subproject is by default a test.
#
Expand All @@ -15,9 +16,3 @@ exe{*}: test = true
#
test.target = $cxx.target

include $src_root/build/config-options.build2

if($config.fmt.enable_modules)
{
mxx{*}: extension = cc
}

0 comments on commit bef2ed5

Please sign in to comment.