Skip to content

Commit

Permalink
Merge commit 'd2cdf6d3d6384b12df6b00bb13160b459fb65433' into sync_ext…
Browse files Browse the repository at this point in the history
…ernals
  • Loading branch information
JonathanMeans committed Feb 14, 2020
2 parents 89e4f43 + d2cdf6d commit d2d1dad
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 21 deletions.
31 changes: 31 additions & 0 deletions externals/coda-oss/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
BasedOnStyle: Google
AccessModifierOffset: '0'
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: 'false'
AlignConsecutiveDeclarations: 'false'
AlignOperands: 'false'
AlignTrailingComments: 'false'
AllowShortBlocksOnASingleLine: 'false'
AllowShortCaseLabelsOnASingleLine: 'false'
AllowShortIfStatementsOnASingleLine: 'false'
AllowShortLoopsOnASingleLine: 'false'
AllowShortFunctionsOnASingleLine: 'false'
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: 'false'
BinPackArguments: 'false'
BinPackParameters: 'false'
BreakConstructorInitializers: AfterColon
BreakBeforeBraces: Allman
PenaltyBreakBeforeFirstCallParameter: '100'
ColumnLimit: '80'
ContinuationIndentWidth: '8'
DerivePointerAlignment: 'false'
FixNamespaceComments: 'false'
IndentCaseLabels: 'false'
IndentWidth: '4'
Language: Cpp
PointerAlignment: Left
SpacesInAngles: 'false'
Standard: Cpp11
UseTab: Never
25 changes: 24 additions & 1 deletion externals/coda-oss/build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,29 @@ def options(opt):
opt.add_option('--disable-swig-silent-leak', action='store_false', dest='swig_silent_leak',
default=True, help='Allow swig to print memory leaks it detects')


def ensureCpp11Support(self):
# Visual Studio 2013 has nullptr but not constexpr. Need to check for
# both in here to make sure we have full C++11 support... otherwise,
# long-term we may need multiple separate configure checks and
# corresponding defines

cpp11_str = '''
int main()
{
constexpr void* FOO = nullptr;
}
'''
self.check_cxx(fragment=cpp11_str,
execute=0,
msg='Checking for C++11 support',
mandatory=True)

# DEPRECATED.
# Keeping for now in case downstream code is still looking for it
self.env['cpp11support'] = True


def configureCompilerOptions(self):
sys_platform = getPlatform(default=Options.platform)
appleRegex = r'i.86-apple-.*'
Expand Down Expand Up @@ -1277,8 +1300,8 @@ def configure(self):
env.append_unique('LINKFLAGS', Options.options.linkflags.split())
if Options.options._defs:
env.append_unique('DEFINES', Options.options._defs.split(','))
env['cpp11support'] = True
configureCompilerOptions(self)
ensureCpp11Support(self)

env['PLATFORM'] = sys_platform

Expand Down
30 changes: 10 additions & 20 deletions externals/coda-oss/modules/c++/config/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ def configure(conf):
conf.check_cc(function_name='setenv', header_name="stdlib.h", mandatory=False)
conf.check_cc(function_name='posix_memalign', header_name="stdlib.h", mandatory=False)
conf.check_cc(function_name='memalign', header_name="stdlib.h", mandatory=False)

#find out the size of some types, etc.
# TODO: This is not using the 32 vs. 64 bit linker flags, so if you're
# building with --enable-32bit on 64 bit Linux, sizeof(size_t) will
# erroneously be 8 here.
types_str = '''
#include <stdio.h>
int isBigEndian()
Expand All @@ -41,21 +46,6 @@ def configure(conf):
return 0;
}
'''

# Visual Studio 2013 has nullptr but not constexpr. Need to check for
# both in here to make sure we have full C++11 support... otherwise,
# long-term we may need multiple separate configure checks and
# corresponding defines
cpp11_str = '''
int main()
{
constexpr void* FOO = nullptr;
}
'''
#find out the size of some types, etc.
# TODO: This is not using the 32 vs. 64 bit linker flags, so if you're
# building with --enable-32bit on 64 bit Linux, sizeof(size_t) will
# erroneously be 8 here.
output = conf.check(fragment=types_str, execute=1, msg='Checking system type sizes', define_ret=True)
t = Utils.str_to_dict(output or '')
for k, v in t.items():
Expand All @@ -68,11 +58,6 @@ def configure(conf):
elif v == 'False':
v = False
conf.define(k.upper(), v)
conf.check_cxx(fragment=cpp11_str,
execute=1,
msg='Checking for C++11 support',
define_name='__CODA_CPP11',
mandatory=True)
attribute_noinline_str = '''
int __attribute__((noinline)) fn() { return 0; }
int main()
Expand All @@ -99,6 +84,11 @@ def configure(conf):

conf.define('CODA_EXPORT', conf.env['declspec_decoration'], quote=False)

# DEPRECATED.
# C++11 is required and will always be enabled.
# Continuing to define this in case downstream code is looking for it
conf.define('__CODA_CPP11', 1)

writeConfig(conf, sys_callback, 'coda_oss',
path=os.path.join('include', 'config'),
outfile='coda_oss_config.h')
Expand Down

0 comments on commit d2d1dad

Please sign in to comment.