Skip to content

Commit

Permalink
Fixes #200
Browse files Browse the repository at this point in the history
  • Loading branch information
brettviren committed Mar 8, 2023
1 parent 8131247 commit 61a3578
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 11 deletions.
54 changes: 54 additions & 0 deletions test/test/test_issue200.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bats

# Test for https://github.com/WireCell/wire-cell-toolkit/issues/200
#
# In part this issue invovles a problem building against WCT so we put
# this test outside of sub-packages.

@test "assure build config built" {
eval $(../wcb dumpenv|grep =)
[[ -f "$BuildConfig" ]]
}

@test "assure build config installed" {
eval $(../wcb dumpenv|grep =)
[[ -n "$PREFIX" ]]
[[ -n "$BuildConfig" ]]

echo "Expect build config file: $PREFIX/include/$BuildConfig"
[[ -f "$PREFIX/include/$BuildConfig" ]]
}

@test "external build with config" {
# assume we run from build/
eval $(../wcb dumpenv|grep =)
[[ -n "$PREFIX" ]]
[[ -n "$BuildConfig" ]]
[[ -n "$CXX" ]]

here=$(pwd)
tmp="$(mktemp -d ${BATS_TMPDIR}/test-issue200-build-with-config-XXXXX)"
echo "working in: $tmp"
cd $tmp/

cat <<EOF > check.cxx
#include "$BuildConfig"
#include <iostream>
int main() {
std::cout << "version " << WIRECELL_VERSION << std::endl;
return 0;
}
EOF
run $CXX -I $PREFIX/include -o check check.cxx
echo $output
[[ "$status" -eq 0 ]]

run ./check
echo "$output"
[[ "$status" -eq 0 ]]

[[ -n "$(echo $output|grep version)" ]]

cd $here
rm -rf $tmp
}
4 changes: 2 additions & 2 deletions util/inc/WireCellUtil/Exceptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@

#include <boost/exception/all.hpp>

// defining this will give more info in the back trace but requires
// Defining this will give more info in the back trace but requires
// linking to -lbacktrace which is usually provided by the compiler.
// This library is fairly prevalent but not everywhere. The main
// wscript auto-detects if it is available.
#include "config.h"
#include "WireCellUtil/BuildConfig.h"
#ifdef HAVE_BACKTRACE_LIB
#define BOOST_STACKTRACE_USE_BACKTRACE
#endif
Expand Down
6 changes: 3 additions & 3 deletions util/inc/WireCellUtil/PointCloud.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#include "WireCellUtil/Dtype.h"
#include "WireCellUtil/Configuration.h"

// fixme: Only keep this in place while SOME PEOPLE still don't have
// boost 1.78. see also wscript test for this header.
#include "config.h"
// fixme: Only need to keep this ifdef in place unil users upgrade to
// at least boost 1.78. Can then remove this test from wscript.
#include "WireCellUtil/BuildConfig.h"
#ifdef HAVE_BOOST_CORE_SPAN_HPP
#include "boost/core/span.hpp"
#else
Expand Down
3 changes: 2 additions & 1 deletion util/inc/WireCellUtil/Version.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#ifndef WIRECELLUTIL_VERSION
#define WIRECELLUTIL_VERSION

#include "config.h"
// This is generated by waf in build/ and later installed
#include "WireCellUtil/BuildConfig.h"

namespace WireCell {

Expand Down
10 changes: 5 additions & 5 deletions wcb

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions wscript
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

import os

# fixme: move into waft/
from waflib.Build import BuildContext
from waflib.Logs import debug, info, error, warn

TOP = '.'
APPNAME = 'WireCell'
VERSION = os.popen("git describe --tags").read().strip()
Expand Down Expand Up @@ -67,3 +71,23 @@ int main(int argc,const char *argv[])

def build(bld):
bld.load('wcb')



## fixme: move into waft
def dumpenv(bld):
'print build environment'
for key in bld.env:
val = bld.env[key]
if isinstance(val, list):
val = ' '.join(val)
if "-" in key:
warn("replace '-' with '_' in: %s" % key)
key = key.replace("-","_")
print('%s="%s"' % (key, val))


class DumpenvContext(BuildContext):
cmd = 'dumpenv'
fun = 'dumpenv'

0 comments on commit 61a3578

Please sign in to comment.