Merge pull request #59 from mdavidsaver/master
Really Fix qualified GCC version builds
This commit is contained in:
5
.github/workflows/build-and-test.yml
vendored
5
.github/workflows/build-and-test.yml
vendored
@@ -66,9 +66,12 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
- name: "apt-get install ${{ matrix.cmp }}"
|
||||
run: |
|
||||
export GCC_NAME="${{ matrix.cmp }}"
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install software-properties-common
|
||||
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||
sudo apt-get -y install ${{ matrix.cmp }}
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install g++-${GCC_NAME#gcc-}
|
||||
- name: Prepare and compile dependencies
|
||||
run: python cue.py prepare
|
||||
- name: Build main module (example app)
|
||||
|
||||
13
cue-test.py
13
cue-test.py
@@ -725,11 +725,7 @@ class TestSetupForBuild(unittest.TestCase):
|
||||
|
||||
@unittest.skipIf(ci_os != 'windows', 'HostArchConfiguration test only applies to windows')
|
||||
def test_HostArchConfiguration(self):
|
||||
# there is no combined static and debug EPICS_HOST_ARCH target,
|
||||
# so a combined debug and static target will appear to be just static
|
||||
# but debug will have been specified in CONFIG_SITE by prepare()
|
||||
cue.ci['compiler'] = 'vs2017'
|
||||
cue.ci['compiler-class'] = 'vs'
|
||||
for cue.ci['debug'] in [True, False]:
|
||||
for cue.ci['static'] in [True, False]:
|
||||
config_st = {True: 'static', False: 'shared'}
|
||||
@@ -739,15 +735,11 @@ class TestSetupForBuild(unittest.TestCase):
|
||||
self.assertTrue('EPICS_HOST_ARCH' in os.environ,
|
||||
'EPICS_HOST_ARCH is not set for Configuration={0}'.format(config))
|
||||
if cue.ci['static']:
|
||||
# static plus anything must be *-static and not *-debug
|
||||
self.assertTrue(re.search('-static$', os.environ['EPICS_HOST_ARCH']),
|
||||
'EPICS_HOST_ARCH (found {0}) is not -static for Configuration={1}'
|
||||
.format(os.environ['EPICS_HOST_ARCH'], config))
|
||||
'EPICS_HOST_ARCH is not -static for Configuration={0}'.format(config))
|
||||
self.assertFalse(re.search('debug', os.environ['EPICS_HOST_ARCH']),
|
||||
'EPICS_HOST_ARCH (found {0}) is -debug for Configuration={1}'
|
||||
.format(os.environ['EPICS_HOST_ARCH'], config))
|
||||
'EPICS_HOST_ARCH is -debug for Configuration={0}'.format(config))
|
||||
elif cue.ci['debug']:
|
||||
# debug (and not static) must be *-debug and not *-static
|
||||
self.assertFalse(re.search('static', os.environ['EPICS_HOST_ARCH']),
|
||||
'EPICS_HOST_ARCH (found {0}) is -static for Configuration={1}'
|
||||
.format(os.environ['EPICS_HOST_ARCH'], config))
|
||||
@@ -755,7 +747,6 @@ class TestSetupForBuild(unittest.TestCase):
|
||||
'EPICS_HOST_ARCH (found {0}) is not -debug for Configuration={1}'
|
||||
.format(os.environ['EPICS_HOST_ARCH'], config))
|
||||
else:
|
||||
# not debug and not static
|
||||
self.assertFalse(re.search('static', os.environ['EPICS_HOST_ARCH']),
|
||||
'EPICS_HOST_ARCH is -static for Configuration={0}'.format(config))
|
||||
self.assertFalse(re.search('debug', os.environ['EPICS_HOST_ARCH']),
|
||||
|
||||
56
cue.py
56
cue.py
@@ -98,9 +98,6 @@ def detect_context():
|
||||
if 'BCFG' in os.environ:
|
||||
buildconfig = os.environ['BCFG'].lower()
|
||||
|
||||
ci['compiler-suffix'] = re.sub(r'^.*?(-[0-9.]+|)$', r'\1', ci['compiler'])
|
||||
ci['compiler-class'] = re.sub(r'^([^0-9.-]*).*?$', r'\1', ci['compiler'])
|
||||
|
||||
if re.search('static', buildconfig):
|
||||
ci['static'] = True
|
||||
if re.search('debug', buildconfig):
|
||||
@@ -618,7 +615,7 @@ def add_dependency(dep):
|
||||
|
||||
def detect_epics_host_arch():
|
||||
if ci['os'] == 'windows':
|
||||
if ci['compiler-class'] == 'vs':
|
||||
if re.match(r'^vs', ci['compiler']):
|
||||
# there is no combined static and debug EPICS_HOST_ARCH target,
|
||||
# so a combined debug and static target will appear to be just static
|
||||
# but debug will have been specified in CONFIG_SITE by prepare()
|
||||
@@ -633,7 +630,7 @@ def detect_epics_host_arch():
|
||||
elif ci['platform'] == 'x64':
|
||||
os.environ['EPICS_HOST_ARCH'] = 'windows-x64' + hostarchsuffix
|
||||
|
||||
elif ci['compiler-class'] == 'gcc':
|
||||
elif ci['compiler'] == 'gcc':
|
||||
if ci['platform'] == 'x86':
|
||||
os.environ['EPICS_HOST_ARCH'] = 'win32-x86-mingw'
|
||||
elif ci['platform'] == 'x64':
|
||||
@@ -669,7 +666,7 @@ def setup_for_build(args):
|
||||
r'C:\Strawberry\perl\bin',
|
||||
os.environ['PATH']])
|
||||
|
||||
if ci['service'] == 'appveyor' and ci['compiler-class'] == 'gcc':
|
||||
if ci['service'] == 'appveyor' and ci['compiler'] == 'gcc':
|
||||
logger.debug('Adding AppVeyor MSYS2/MinGW installation to PATH and INCLUDE')
|
||||
if 'INCLUDE' not in os.environ:
|
||||
os.environ['INCLUDE'] = ''
|
||||
@@ -835,7 +832,7 @@ def prepare(args):
|
||||
.format(optitype, linktype))
|
||||
|
||||
# Enable/fix parallel build for VisualStudio compiler on older Base versions
|
||||
if ci['os'] == 'windows' and ci['compiler-class'] == 'vs':
|
||||
if ci['os'] == 'windows' and re.match(r'^vs', ci['compiler']):
|
||||
add_vs_fix = True
|
||||
config_win = os.path.join(places['EPICS_BASE'], 'configure', 'os', 'CONFIG.win32-x86.win32-x86')
|
||||
with open(config_win) as f:
|
||||
@@ -906,32 +903,35 @@ CROSS_COMPILER_TARGET_ARCHS += RTEMS-pc386{0}'''.format(qemu_suffix))
|
||||
|
||||
print('Host compiler', ci['compiler'])
|
||||
|
||||
if ci['compiler-class'] == 'clang':
|
||||
cxx = None
|
||||
if ci['compiler'].startswith('clang'):
|
||||
cxx = re.sub(r'clang', r'clang++', ci['compiler'])
|
||||
with open(os.path.join(places['EPICS_BASE'], 'configure', 'os',
|
||||
'CONFIG_SITE.{0}.{0}'.format(os.environ['EPICS_HOST_ARCH'])), 'a') as f:
|
||||
'CONFIG_SITE.Common.'+os.environ['EPICS_HOST_ARCH']), 'a') as f:
|
||||
f.write('''
|
||||
GNU = NO
|
||||
CMPLR_CLASS = clang
|
||||
CC = clang
|
||||
CCC = clang++''')
|
||||
if ci['compiler-suffix']:
|
||||
f.write('''
|
||||
CMPLR_SUFFIX = {0}'''.format(ci['compiler-suffix']))
|
||||
GNU = NO
|
||||
CMPLR_CLASS = clang
|
||||
CC = {0}
|
||||
CCC = {1}'''.format(ci['compiler'], cxx))
|
||||
|
||||
elif ci['compiler-class'] == 'gcc':
|
||||
# hack
|
||||
with open(os.path.join(places['EPICS_BASE'], 'configure', 'CONFIG.gnuCommon'), 'a') as f:
|
||||
f.write('''
|
||||
CMPLR_CLASS = clang''')
|
||||
|
||||
elif ci['compiler'].startswith('gcc'):
|
||||
cxx = re.sub(r'gcc', r'g++', ci['compiler'])
|
||||
with open(os.path.join(places['EPICS_BASE'], 'configure', 'os',
|
||||
'CONFIG_SITE.{0}.{0}'.format(os.environ['EPICS_HOST_ARCH'])), 'a') as f:
|
||||
'CONFIG_SITE.Common.' + os.environ['EPICS_HOST_ARCH']), 'a') as f:
|
||||
f.write('''
|
||||
CMPLR_CLASS = gcc''')
|
||||
if ci['compiler-suffix']:
|
||||
f.write('''
|
||||
CMPLR_SUFFIX = {0}'''.format(ci['compiler-suffix']))
|
||||
CC = {0}
|
||||
CCC = {1}'''.format(ci['compiler'], cxx))
|
||||
|
||||
elif ci['compiler-class'] =='vs':
|
||||
elif ci['compiler'].startswith('vs'):
|
||||
pass # nothing special
|
||||
|
||||
else:
|
||||
raise ValueError('Unknown compiler name {0}. Valid forms include: gcc, gcc-4.8, clang, vs2019'.format(ci['compiler']))
|
||||
raise ValueError('Unknown compiler name {0}. valid forms include: gcc, gcc-4.8, clang, vs2019'.format(ci['compiler']))
|
||||
|
||||
# Add additional settings to CONFIG_SITE
|
||||
extra_config = ''
|
||||
@@ -998,7 +998,7 @@ PERL = C:/Strawberry/perl/bin/perl -CSD'''
|
||||
sys.stdout.flush()
|
||||
sp.check_call(['perl', '--version'])
|
||||
|
||||
if ci['compiler-class'] == 'vs':
|
||||
if re.match(r'^vs', ci['compiler']):
|
||||
print('{0}$ cl{1}'.format(ANSI_CYAN, ANSI_RESET))
|
||||
sys.stdout.flush()
|
||||
sp.check_call(['cl'])
|
||||
@@ -1007,6 +1007,10 @@ PERL = C:/Strawberry/perl/bin/perl -CSD'''
|
||||
print('{0}$ {1} --version{2}'.format(ANSI_CYAN, cc, ANSI_RESET))
|
||||
sys.stdout.flush()
|
||||
sp.check_call([cc, '--version'])
|
||||
if cxx:
|
||||
print('{0}$ {1} --version{2}'.format(ANSI_CYAN, cxx, ANSI_RESET))
|
||||
sys.stdout.flush()
|
||||
sp.check_call([cxx, '--version'])
|
||||
|
||||
if logging.getLogger().isEnabledFor(logging.DEBUG):
|
||||
log_modified()
|
||||
@@ -1164,7 +1168,7 @@ def main(raw):
|
||||
prepare_env()
|
||||
detect_context()
|
||||
|
||||
if args.vcvars and ci['compiler-class'] == 'vs':
|
||||
if args.vcvars and ci['compiler'].startswith('vs'):
|
||||
# re-exec with MSVC in PATH
|
||||
with_vcvars(' '.join(['--no-vcvars'] + raw))
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user