Skip to content

Commit

Permalink
Requested Changes by Kenzzer
Browse files Browse the repository at this point in the history
  • Loading branch information
caxanga334 committed Oct 21, 2024
1 parent 3248a92 commit 9da7e65
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 102 deletions.
74 changes: 10 additions & 64 deletions public/sample_ext/AMBuildScript
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ class ExtensionConfig(object):
if builder.options.targets:
target_archs = builder.options.targets.split(',')
else:
target_archs = ['x86']
if builder.backend != 'amb2':
target_archs.append('x86_64')
target_archs = ['x86', 'x86_64']

for arch in target_archs:
try:
Expand Down Expand Up @@ -157,8 +155,8 @@ class ExtensionConfig(object):
if cxx.version < 1914 and builder.options.generator != 'vs':
raise Exception(f'Only MSVC 2017 15.7 and later are supported, full C++17 support is required. ({str(cxx.version)} < 1914)')
elif cxx.family == 'gcc':
if cxx.version < 'gcc-9':
raise Exception('Only GCC versions 9 or later are supported, full C++17 support is required.')
if cxx.version < 'gcc-8':
raise Exception('Only GCC versions 8 or later are supported, full C++17 support is required.')
elif cxx.family == 'clang':
if cxx.version < 'clang-5':
raise Exception('Only clang versions 5 or later are supported, full C++17 support is required.')
Expand All @@ -168,7 +166,7 @@ class ExtensionConfig(object):
elif cxx.family == 'msvc':
self.configure_msvc(cxx)

# Optimizaiton
# Optimization
if builder.options.opt == '1':
cxx.defines += ['NDEBUG']

Expand All @@ -184,10 +182,6 @@ class ExtensionConfig(object):
elif cxx.target.platform == 'windows':
self.configure_windows(cxx)

cxx.includes += [
os.path.join(builder.sourcePath, 'public'),
]

def configure_gcc(self, cxx):
cxx.defines += [
'stricmp=strcasecmp',
Expand All @@ -207,44 +201,26 @@ class ExtensionConfig(object):
'-Wno-array-bounds',
'-fvisibility=hidden',
]

if cxx.target.arch in ['x86', 'x86_64']:
cxx.cflags += ['-msse']

cxx.cxxflags += ['-std=c++17']

cxx.cxxflags += [
'-fno-threadsafe-statics',
'-Wno-non-virtual-dtor',
'-Wno-overloaded-virtual',
'-Wno-register',
'-fvisibility-inlines-hidden',
'-std=c++17',
]


have_gcc = cxx.family == 'gcc'
have_clang = cxx.family == 'clang'
if cxx.version >= 'clang-3.9' or cxx.version == 'clang-3.4' or cxx.version > 'apple-clang-6.0':
cxx.cxxflags += ['-Wno-expansion-to-defined']
if cxx.version == 'clang-3.9' or cxx.version == 'apple-clang-8.0':
cxx.cflags += ['-Wno-varargs']
if cxx.version >= 'clang-3.4' or cxx.version >= 'apple-clang-7.0':
cxx.cxxflags += ['-Wno-inconsistent-missing-override']
if cxx.version >= 'clang-2.9' or cxx.version >= 'apple-clang-3.0':
cxx.cxxflags += ['-Wno-null-dereference']
if have_clang or (cxx.version >= 'gcc-4.6'):
cxx.cflags += ['-Wno-narrowing']
if have_clang or (cxx.version >= 'gcc-4.7'):
cxx.cxxflags += ['-Wno-delete-non-virtual-dtor']
if cxx.version >= 'gcc-4.8':
cxx.cflags += ['-Wno-unused-result']
if cxx.version >= 'gcc-9.0':
cxx.cxxflags += ['-Wno-class-memaccess', '-Wno-packed-not-aligned']

# Work around errors from smsdk_ext.cpp
if have_clang:
cxx.cxxflags += ['-Wno-implicit-exception-spec-mismatch']
if cxx.version >= 'apple-clang-5.1' or cxx.version >= 'clang-3.4':
cxx.cxxflags += ['-Wno-deprecated-register']
else:
cxx.cxxflags += ['-Wno-deprecated']
cxx.cflags += ['-Wno-sometimes-uninitialized']

# Work around SDK warnings.
if cxx.version >= 'clang-10.0' or cxx.version >= 'apple-clang-12.0':
Expand Down Expand Up @@ -341,37 +317,11 @@ class ExtensionConfig(object):
self.AddCxxCompat(binary)
return binary

def ProgramBuilder(self, compiler, name):
binary = compiler.Program(name)
self.AddVersioning(binary)
if '-static-libgcc' in binary.compiler.linkflags:
binary.compiler.linkflags.remove('-static-libgcc')
if '-lgcc_eh' in binary.compiler.linkflags:
binary.compiler.linkflags.remove('-lgcc_eh')
if binary.compiler.like('gcc'):
binary.compiler.linkflags += ['-lstdc++', '-lpthread']
if binary.compiler.like('msvc'):
binary.compiler.linkflags += ['/SUBSYSTEM:CONSOLE']
return binary

def StaticLibraryBuilder(self, compiler, name):
return compiler.StaticLibrary(name)

def Library(self, context, compiler, name):
compiler = compiler.clone()
SetArchFlags(compiler)
return self.LibraryBuilder(compiler, name)

def Program(self, context, compiler, name):
compiler = compiler.clone()
SetArchFlags(compiler)
return self.ProgramBuilder(compiler, name)

def StaticLibrary(self, context, compiler, name):
compiler = compiler.clone()
SetArchFlags(compiler)
return self.StaticLibraryBuilder(compiler, name)

def ConfigureForExtension(self, context, compiler):
compiler.cxxincludes += [
os.path.join(context.currentSourcePath),
Expand Down Expand Up @@ -441,12 +391,8 @@ builder.targets = builder.CloneableList(Extension.all_targets)

BuildScripts = [
'AMBuilder',
'PackageScript',
]

if builder.backend == 'amb2':
BuildScripts += [
'PackageScript',
]

builder.Build(BuildScripts, { 'Extension': Extension })

47 changes: 9 additions & 38 deletions public/sample_ext_nosdk/AMBuildScript
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ class ExtensionConfig(object):
if builder.options.targets:
target_archs = builder.options.targets.split(',')
else:
target_archs = ['x86']
if builder.backend != 'amb2':
target_archs.append('x86_64')
target_archs = ['x86', 'x86_64']

for arch in target_archs:
try:
Expand Down Expand Up @@ -112,8 +110,8 @@ class ExtensionConfig(object):
if cxx.version < 1914 and builder.options.generator != 'vs':
raise Exception(f'Only MSVC 2017 15.7 and later are supported, full C++17 support is required. ({str(cxx.version)} < 1914)')
elif cxx.family == 'gcc':
if cxx.version < 'gcc-9':
raise Exception('Only GCC versions 9 or later are supported, full C++17 support is required.')
if cxx.version < 'gcc-8':
raise Exception('Only GCC versions 8 or later are supported, full C++17 support is required.')
elif cxx.family == 'clang':
if cxx.version < 'clang-5':
raise Exception('Only clang versions 5 or later are supported, full C++17 support is required.')
Expand All @@ -123,7 +121,7 @@ class ExtensionConfig(object):
elif cxx.family == 'msvc':
self.configure_msvc(cxx)

# Optimizaiton
# Optimization
if builder.options.opt == '1':
cxx.defines += ['NDEBUG']

Expand All @@ -139,10 +137,6 @@ class ExtensionConfig(object):
elif cxx.target.platform == 'windows':
self.configure_windows(cxx)

cxx.includes += [
os.path.join(builder.sourcePath, 'public'),
]

def configure_gcc(self, cxx):
cxx.defines += [
'stricmp=strcasecmp',
Expand All @@ -162,44 +156,25 @@ class ExtensionConfig(object):
'-Wno-array-bounds',
'-fvisibility=hidden',
]

if cxx.target.arch in ['x86', 'x86_64']:
cxx.cflags += ['-msse']

cxx.cxxflags += ['-std=c++17']

cxx.cxxflags += [
'-fno-threadsafe-statics',
'-Wno-non-virtual-dtor',
'-Wno-overloaded-virtual',
'-Wno-register',
'-fvisibility-inlines-hidden',
'-std=c++17',
]

have_gcc = cxx.family == 'gcc'
have_clang = cxx.family == 'clang'
if cxx.version >= 'clang-3.9' or cxx.version == 'clang-3.4' or cxx.version > 'apple-clang-6.0':
cxx.cxxflags += ['-Wno-expansion-to-defined']
if cxx.version == 'clang-3.9' or cxx.version == 'apple-clang-8.0':
cxx.cflags += ['-Wno-varargs']
if cxx.version >= 'clang-3.4' or cxx.version >= 'apple-clang-7.0':
cxx.cxxflags += ['-Wno-inconsistent-missing-override']
if cxx.version >= 'clang-2.9' or cxx.version >= 'apple-clang-3.0':
cxx.cxxflags += ['-Wno-null-dereference']
if have_clang or (cxx.version >= 'gcc-4.6'):
cxx.cflags += ['-Wno-narrowing']
if have_clang or (cxx.version >= 'gcc-4.7'):
cxx.cxxflags += ['-Wno-delete-non-virtual-dtor']
if cxx.version >= 'gcc-4.8':
cxx.cflags += ['-Wno-unused-result']
if cxx.version >= 'gcc-9.0':
cxx.cxxflags += ['-Wno-class-memaccess', '-Wno-packed-not-aligned']

# Work around errors from smsdk_ext.cpp
if have_clang:
cxx.cxxflags += ['-Wno-implicit-exception-spec-mismatch']
if cxx.version >= 'apple-clang-5.1' or cxx.version >= 'clang-3.4':
cxx.cxxflags += ['-Wno-deprecated-register']
else:
cxx.cxxflags += ['-Wno-deprecated']
cxx.cflags += ['-Wno-sometimes-uninitialized']

# Work around SDK warnings.
if cxx.version >= 'clang-10.0' or cxx.version >= 'apple-clang-12.0':
Expand Down Expand Up @@ -337,11 +312,7 @@ builder.targets = builder.CloneableList(Extension.all_targets)
# Add additional buildscripts here
BuildScripts = [
'AMBuilder',
'PackageScript',
]

if builder.backend == 'amb2':
BuildScripts += [
'PackageScript',
]

builder.Build(BuildScripts, { 'Extension': Extension })

0 comments on commit 9da7e65

Please sign in to comment.