-
Notifications
You must be signed in to change notification settings - Fork 0
/
SConstruct
executable file
·70 lines (54 loc) · 2.3 KB
/
SConstruct
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python
import sys
import importlib
import os
import platform
# Nuclex SCons libraries
sys.path.append('../BuildSystem/scons')
nuclex = importlib.import_module('nuclex')
# ----------------------------------------------------------------------------------------------- #
use_gcc10 = False
use_clang = False
# ----------------------------------------------------------------------------------------------- #
# Standard C/C++ build environment with Nuclex extension methods
common_environment = nuclex.create_cplusplus_environment()
if platform.system() != 'Windows':
common_environment.add_library('pthread')
if use_gcc10:
common_environment['CXX'] = 'g++-10.2.0'
common_environment['CC'] = 'gcc-10.2.0'
if use_clang:
common_environment['ENV'] = os.environ
common_environment['CXX'] = 'clang++-11'
common_environment['CC'] = 'clang-11'
#common_environment.Append(LINKFLAGS='-flto')
#common_environment.Append(LINKFLAGS='-fuse-ld=gold')
# Compile the main library
library_environment = common_environment.Clone()
library_binaries = library_environment.build_library('Nuclex.Platform.Native')
# Compile the unit test executable
unit_test_environment = common_environment.Clone()
unit_test_environment.add_preprocessor_constant('NUCLEX_SUPPORT_EXECUTABLE')
#unit_test_environment.add_preprocessor_constant('NUCLEX_SUPPORT_ENABLE_BENCHMARKS')
unit_test_binaries = unit_test_environment.build_unit_tests(
'Nuclex.Platform.Native.Tests'
)
# ----------------------------------------------------------------------------------------------- #
artifact_directory = os.path.join(
unit_test_environment['ARTIFACT_DIRECTORY'],
unit_test_environment.get_build_directory_name()
)
unit_test_results = unit_test_environment.Command(
source = unit_test_binaries,
action = '-$SOURCE --gtest_color=yes --gtest_output=xml:$TARGET',
target = os.path.join(artifact_directory, 'gtest-results.xml')
)
# ----------------------------------------------------------------------------------------------- #
AlwaysBuild(unit_test_results)
#if platform.system() != 'Windows':
# list_exported_symbols = common_environment.Command(
# source = library_binaries,
# action = 'nm --demangle --extern-only $SOURCE | grep Nuclex',
# target = None
# )
# On Windows, use dumpbin