Custom.cfg (#213)
Added custom configs. These are used for replacing some hardcoded strings inside bot code, currently custom cvar for parachute detection is available, as well as custom c4 model names. Added editorconfig, and fixed CRLF for files (was a mix between LF & CRLF). Fixed use-after-free sanitizer error with chatlib. Fixed configs files loaded with memory-loader does not process last line in config files.
This commit is contained in:
parent
ed46e3238d
commit
075bff2988
21 changed files with 533 additions and 404 deletions
333
meson.build
333
meson.build
|
|
@ -6,25 +6,25 @@
|
|||
#
|
||||
|
||||
project (
|
||||
'yapb',
|
||||
'cpp',
|
||||
'yapb',
|
||||
'cpp',
|
||||
|
||||
version: '4.1',
|
||||
license: 'MIT',
|
||||
version: '4.2',
|
||||
license: 'MIT',
|
||||
|
||||
default_options: [
|
||||
'buildtype=release',
|
||||
'b_ndebug=if-release',
|
||||
'cpp_std=c++14',
|
||||
'warning_level=3',
|
||||
'werror=true',
|
||||
'backend=ninja',
|
||||
'strip=true',
|
||||
'optimization=3',
|
||||
'default_library=static',
|
||||
'cpp_eh=none'
|
||||
],
|
||||
meson_version: '>=0.48.0')
|
||||
default_options: [
|
||||
'buildtype=release',
|
||||
'b_ndebug=if-release',
|
||||
'cpp_std=c++14',
|
||||
'warning_level=3',
|
||||
'werror=true',
|
||||
'backend=ninja',
|
||||
'strip=true',
|
||||
'optimization=3',
|
||||
'default_library=static',
|
||||
'cpp_eh=none'
|
||||
],
|
||||
meson_version: '>=0.48.0')
|
||||
|
||||
find_program ('ninja', required: true)
|
||||
find_program ('git', required: true)
|
||||
|
|
@ -53,9 +53,9 @@ ccflags = []
|
|||
cdata = configuration_data()
|
||||
|
||||
if isWindows
|
||||
cdata.set ('buildVersionWin', ','.join (buildVersion.split ('.')))
|
||||
cdata.set ('buildVersionWin', ','.join (buildVersion.split ('.')))
|
||||
else
|
||||
cdata.set ('buildVersionWin', buildVersion)
|
||||
cdata.set ('buildVersionWin', buildVersion)
|
||||
endif
|
||||
|
||||
cdata.set ('commitHash', run_command ('git', 'rev-parse', '--short', 'HEAD').stdout ().strip ())
|
||||
|
|
@ -71,199 +71,198 @@ configure_file (input: 'inc/version.h.in', output: 'version.build.h', configurat
|
|||
ccflags += '-DVERSION_GENERATED'
|
||||
|
||||
if isCLang or isGCC or (isIntel and not isWindows)
|
||||
ccflags += [
|
||||
'-m32',
|
||||
'-fno-threadsafe-statics',
|
||||
'-fno-exceptions',
|
||||
'-fno-rtti'
|
||||
]
|
||||
ccflags += [
|
||||
'-m32',
|
||||
'-fno-threadsafe-statics',
|
||||
'-fno-exceptions',
|
||||
'-fno-rtti'
|
||||
]
|
||||
|
||||
if not isDarwin
|
||||
ccflags += [
|
||||
'-pedantic',
|
||||
]
|
||||
endif
|
||||
if not isDarwin
|
||||
ccflags += [
|
||||
'-pedantic',
|
||||
]
|
||||
endif
|
||||
|
||||
if isOptimize
|
||||
ccflags += '-msse3'
|
||||
if isOptimize
|
||||
ccflags += '-msse3'
|
||||
|
||||
if (isCLang or isGCC) and not isDarwin
|
||||
ccflags += [
|
||||
'-flto',
|
||||
'-fdata-sections',
|
||||
'-ffunction-sections'
|
||||
]
|
||||
if (isCLang or isGCC) and not isDarwin
|
||||
ccflags += [
|
||||
'-flto',
|
||||
'-fdata-sections',
|
||||
'-ffunction-sections'
|
||||
]
|
||||
|
||||
if isGCC
|
||||
ccflags += '-fgraphite-identity'
|
||||
ldflags += '-flto-partition=none'
|
||||
endif
|
||||
if isGCC
|
||||
ccflags += '-fgraphite-identity'
|
||||
ldflags += '-flto-partition=none'
|
||||
endif
|
||||
|
||||
ldflags += [
|
||||
'-flto',
|
||||
'-Wl,--version-script=../version_script.lds',
|
||||
'-Wl,--gc-sections'
|
||||
]
|
||||
endif
|
||||
endif
|
||||
ldflags += [
|
||||
'-flto',
|
||||
'-Wl,--version-script=../version_script.lds',
|
||||
'-Wl,--gc-sections'
|
||||
]
|
||||
endif
|
||||
endif
|
||||
|
||||
if isLinux
|
||||
ldflags += [
|
||||
'-m32',
|
||||
'-lm',
|
||||
'-ldl'
|
||||
]
|
||||
endif
|
||||
if isLinux
|
||||
ldflags += [
|
||||
'-m32',
|
||||
'-lm',
|
||||
'-ldl'
|
||||
]
|
||||
endif
|
||||
endif
|
||||
|
||||
if isIntel and (isLinux or isDarwin)
|
||||
ldflags += [
|
||||
'-static-intel',
|
||||
'-no-intel-extensions'
|
||||
]
|
||||
ldflags += [
|
||||
'-static-intel',
|
||||
'-no-intel-extensions'
|
||||
]
|
||||
endif
|
||||
|
||||
if isLinux or isDarwin
|
||||
if isDarwin
|
||||
ccflags += '-mmacosx-version-min=10.9'
|
||||
ldflags += [
|
||||
'-dynamiclib',
|
||||
'-lstdc++',
|
||||
'-mmacosx-version-min=10.9'
|
||||
]
|
||||
else
|
||||
ldflags += '-static-libgcc'
|
||||
endif
|
||||
if isDarwin
|
||||
ccflags += '-mmacosx-version-min=10.9'
|
||||
ldflags += [
|
||||
'-dynamiclib',
|
||||
'-lstdc++',
|
||||
'-mmacosx-version-min=10.9'
|
||||
]
|
||||
else
|
||||
ldflags += '-static-libgcc'
|
||||
endif
|
||||
|
||||
if not isOptimize
|
||||
ccflags += [
|
||||
'-g3',
|
||||
'-ggdb',
|
||||
'-DCR_DEBUG'
|
||||
]
|
||||
else
|
||||
ccflags += [
|
||||
'-mtune=generic',
|
||||
'-msse3',
|
||||
'-mfpmath=sse',
|
||||
'-fno-builtin',
|
||||
'-funroll-loops',
|
||||
'-fomit-frame-pointer',
|
||||
'-fno-stack-protector',
|
||||
'-fvisibility=hidden',
|
||||
'-fvisibility-inlines-hidden'
|
||||
]
|
||||
if not isOptimize
|
||||
ccflags += [
|
||||
'-g3',
|
||||
'-ggdb',
|
||||
'-DCR_DEBUG'
|
||||
]
|
||||
else
|
||||
ccflags += [
|
||||
'-mtune=generic',
|
||||
'-msse3',
|
||||
'-mfpmath=sse',
|
||||
'-fno-builtin',
|
||||
'-funroll-loops',
|
||||
'-fomit-frame-pointer',
|
||||
'-fno-stack-protector',
|
||||
'-fvisibility=hidden',
|
||||
'-fvisibility-inlines-hidden'
|
||||
]
|
||||
|
||||
if isIntel
|
||||
ccflags += [
|
||||
'-ipo',
|
||||
'-wd11076',
|
||||
'-wd11074'
|
||||
]
|
||||
if isIntel
|
||||
ccflags += [
|
||||
'-ipo',
|
||||
'-wd11076',
|
||||
'-wd11074'
|
||||
]
|
||||
|
||||
ldflags += [
|
||||
'-cxxlib-nostd',
|
||||
'-Wl,--no-undefined,-z,notext,--gc-sections',
|
||||
'-ipo'
|
||||
]
|
||||
elif isCLang and not isDarwin
|
||||
llvmLinker = find_program ('lld', required: false)
|
||||
ldflags += [
|
||||
'-cxxlib-nostd',
|
||||
'-Wl,--no-undefined,-z,notext,--gc-sections',
|
||||
'-ipo'
|
||||
]
|
||||
elif isCLang and not isDarwin
|
||||
llvmLinker = find_program ('lld', required: false)
|
||||
|
||||
if llvmLinker.found() == true
|
||||
ldflags += '-fuse-ld=' + llvmLinker.path ().split ('/')[-1]
|
||||
ldflags += '-fuse-ld=' + llvmLinker.path ().split ('/')[-1]
|
||||
endif
|
||||
|
||||
ldflags += [
|
||||
'-nostdlib++',
|
||||
'-Wunused-command-line-argument',
|
||||
'-Wl,-z,notext',
|
||||
'--no-undefined'
|
||||
'-nostdlib++',
|
||||
'-Wunused-command-line-argument',
|
||||
'-Wl,-z,notext',
|
||||
'--no-undefined'
|
||||
]
|
||||
elif isGCC and not isDarwin
|
||||
elif isGCC and not isDarwin
|
||||
ldflags += '-Wl,--no-undefined'
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if isWindows and (isVC or isIntel)
|
||||
ldflags += [
|
||||
'/MACHINE:X86',
|
||||
'user32.lib',
|
||||
'ws2_32.lib'
|
||||
]
|
||||
ldflags += [
|
||||
'/MACHINE:X86',
|
||||
'user32.lib',
|
||||
'ws2_32.lib'
|
||||
]
|
||||
|
||||
ccflags += [
|
||||
'/TP'
|
||||
]
|
||||
ccflags += [
|
||||
'/TP'
|
||||
]
|
||||
|
||||
if isOptimize
|
||||
ccflags += [
|
||||
'/GL',
|
||||
'/arch:SSE2',
|
||||
'/GS-',
|
||||
'/Ob2',
|
||||
'/Oy',
|
||||
'/Oi'
|
||||
]
|
||||
|
||||
ldflags += '/LTCG'
|
||||
endif
|
||||
if isOptimize
|
||||
ccflags += [
|
||||
'/GL',
|
||||
'/arch:SSE2',
|
||||
'/GS-',
|
||||
'/Ob2',
|
||||
'/Oy',
|
||||
'/Oi'
|
||||
]
|
||||
ldflags += '/LTCG'
|
||||
endif
|
||||
|
||||
elif isWindows and (isCLang or isGCC)
|
||||
if isCLang
|
||||
ldflags += '-Wl,/MACHINE:X86'
|
||||
else
|
||||
ldflags += [
|
||||
'-static-libgcc',
|
||||
'-Wl,--kill-at'
|
||||
]
|
||||
endif
|
||||
if isCLang
|
||||
ldflags += '-Wl,/MACHINE:X86'
|
||||
else
|
||||
ldflags += [
|
||||
'-static-libgcc',
|
||||
'-Wl,--kill-at'
|
||||
]
|
||||
endif
|
||||
|
||||
ldflags += [
|
||||
'-luser32',
|
||||
'-lws2_32'
|
||||
]
|
||||
ldflags += [
|
||||
'-luser32',
|
||||
'-lws2_32'
|
||||
]
|
||||
endif
|
||||
|
||||
add_global_arguments (ccflags, language: 'cpp')
|
||||
add_global_link_arguments (ldflags, language: 'cpp')
|
||||
|
||||
sources = files (
|
||||
'src/android.cpp',
|
||||
'src/botlib.cpp',
|
||||
'src/chatlib.cpp',
|
||||
'src/combat.cpp',
|
||||
'src/config.cpp',
|
||||
'src/control.cpp',
|
||||
'src/engine.cpp',
|
||||
'src/graph.cpp',
|
||||
'src/linkage.cpp',
|
||||
'src/manager.cpp',
|
||||
'src/module.cpp',
|
||||
'src/message.cpp',
|
||||
'src/navigate.cpp',
|
||||
'src/support.cpp'
|
||||
'src/android.cpp',
|
||||
'src/botlib.cpp',
|
||||
'src/chatlib.cpp',
|
||||
'src/combat.cpp',
|
||||
'src/config.cpp',
|
||||
'src/control.cpp',
|
||||
'src/engine.cpp',
|
||||
'src/graph.cpp',
|
||||
'src/linkage.cpp',
|
||||
'src/manager.cpp',
|
||||
'src/module.cpp',
|
||||
'src/message.cpp',
|
||||
'src/navigate.cpp',
|
||||
'src/support.cpp'
|
||||
)
|
||||
|
||||
includes = include_directories ([
|
||||
'.', 'inc', 'ext',
|
||||
'.', 'inc', 'ext',
|
||||
], is_system: true)
|
||||
|
||||
if isWindows and not isCLang
|
||||
sources += import('windows').compile_resources (
|
||||
'vc/yapb.rc',
|
||||
include_directories: includes,
|
||||
args: ['-DVERSION_GENERATED']
|
||||
)
|
||||
sources += import('windows').compile_resources (
|
||||
'vc/yapb.rc',
|
||||
include_directories: includes,
|
||||
args: ['-DVERSION_GENERATED']
|
||||
)
|
||||
endif
|
||||
|
||||
shared_library (
|
||||
meson.project_name (),
|
||||
sources,
|
||||
include_directories: includes,
|
||||
|
||||
gnu_symbol_visibility: 'hidden',
|
||||
name_prefix: '')
|
||||
meson.project_name (),
|
||||
sources,
|
||||
include_directories: includes,
|
||||
|
||||
gnu_symbol_visibility: 'hidden',
|
||||
name_prefix: '')
|
||||
|
||||
run_target ('package',
|
||||
command : ['python', meson.source_root() + '/package.py', '@0@.@1@'.format (buildVersion, buildCount)])
|
||||
Loading…
Add table
Add a link
Reference in a new issue