--- /dev/null
+Import('env')
+env = env.Clone()
+
+env.Append(RUSTCFLAGS = [
+ '-g',
+ '-C', 'opt-level=s',
+])
+
+SConscript('SConscript.libcommon.rs', exports='env', duplicate=0)
+
+test_source_files = [
+ 'test/main.rs', # Must be listed first (see below).
+]
+
+test_env = env.Clone()
+
+test_env.Append(RUSTCFLAGS = [
+ '-L', '$LIBPATH',
+ '--test',
+])
+
+test = test_env.Rustc('gps-watch-test', test_source_files[0])
+
+for f in test_source_files:
+ Depends(test, f)
+
+Depends(test, 'libcommon.rlib')
+
+Default(test)
env['variant_dir'] = 'build-target'
env['LIBPATH'] = env['variant_dir']
SConscript('SConscript.target', exports='env', variant_dir=env['variant_dir'], duplicate=0)
+
+env = root_env.Clone()
+env['variant_dir'] = 'build-test'
+env['LIBPATH'] = env['variant_dir']
+SConscript('SConscript.test', exports='env', variant_dir=env['variant_dir'], duplicate=0)
--- /dev/null
+/*
+ * Copyright (c) 2020 Tilman Sauerbeck (tilman at code-monkey de)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+extern crate common;