diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml deleted file mode 100644 index bd15101..0000000 --- a/.github/workflows/c-cpp.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: SteamWorks.ext Build - -on: - push: - branches: [ master, windows98 ] - pull_request: - branches: [ master, windows98 ] - -jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - matrix: - python-version: [2.7, 3.3, 3.8] - os: [ubuntu-18.04, macos-latest, windows-2019] - exclude: - - os: macos-latest - python-version: 3.3 - - os: windows-2019 - python-version: 3.3 - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install Deps - if: runner.os == 'Linux' - run: | - sudo dpkg --add-architecture i386 - sudo apt-get install lib32stdc++-7-dev lib32z1-dev libc6-dev-i386 - sudo apt-get install g++-multilib - - name: install AMBuild - run: | - mkdir assets - cd assets - git clone --depth 1 --recurse-submodules -j8 --shallow-submodules -b fix-deps https://github.com/alliedmodders/ambuild.git - pip install ./ambuild - - name: Clone Dependencies - run: | - git clone --depth 1 --recurse-submodules -j8 --shallow-submodules https://$OAUTH@github.com/SteamDatabase/SteamworksSDK.git SteamworksSDK - git clone --depth 1 --recurse-submodules -j8 --shallow-submodules -b sdk2013 https://github.com/alliedmodders/hl2sdk.git hl2sdk-sdk2013 - git clone --depth 1 --recurse-submodules -j8 --shallow-submodules -b 1.10-dev https://github.com/alliedmodders/metamod-source.git mmsource-central - git clone --depth 1 --recurse-submodules -j8 --shallow-submodules -b 1.7-dev https://github.com/alliedmodders/sourcemod.git sourcemod-central - - name: Run Build - run: | - mkdir build - cd build - cp ../AMBuildScript ../../ - python ../configure.py -s sdk2013 --hl2sdk-root ../assets --sm-path ../assets/sourcemod-central --mms-path ../assets/mmsource-central --steamworks-path ../assets/SteamworksSD - ambuild diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..b635b02 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,111 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + tags: + - 'v*' + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: [3.8] + os: [ ubuntu-18.04, windows-latest, macos-latest ] + include: + - os: ubuntu-18.04 + asset_name: 'package-linux' + zip_cmd: 'zip -r package.zip build/package' + CC: 'clang' + CXX: 'clang' + + - os: windows-latest + asset_name: 'package-windows' + zip_cmd: 'powershell Compress-Archive build/package package.zip' + + - os: macos-latest + asset_name: 'package-macos' + zip_cmd: 'zip -r package.zip build/package' + CC: 'clang' + CXX: 'clang' + steps: + - uses: actions/checkout@v2 + with: + path: 'sm-environment' + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install Linux Deps + if: runner.os == 'Linux' + run: | + sudo apt update + sudo apt install -y gcc-multilib g++-multilib + - name: Install Windows Deps + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x86 + - name: Checkout AMBuild + uses: actions/checkout@v2 + with: + repository: 'alliedmodders/ambuild' + path: 'ambuild' + - name: Install AMBuild + run: | + cd ambuild + python setup.py build + python setup.py install + - name: Checkout SourceMod + uses: actions/checkout@v2 + with: + repository: 'alliedmodders/sourcemod' + ref: '1.10-dev' + path: 'sourcemod' + submodules: 'recursive' + - name: Checkout HL2 SDK + uses: actions/checkout@v2 + with: + repository: 'alliedmodders/hl2sdk' + ref: 'sdk2013' + path: 'hl2sdk-sdk2013' + - name: Checkout MM Source + uses: actions/checkout@v2 + with: + repository: 'alliedmodders/metamod-source' + ref: '1.10-dev' + path: 'mmsource' + - name: Checkout Steam Works + uses: actions/checkout@v2 + with: + ssh-key: ${{ secrets.STEAMWORKS_PULL_KEY }} + repository: 'hexa-core-eu/SteamWorksSDK' + ref: '1.49' + path: 'steamworks-sdk' + - name: Run Build + shell: bash + working-directory: ./sm-environment + run: | + mkdir build + cd build + python ../configure.py --hl2sdk-root=$GITHUB_WORKSPACE --mms-path=$GITHUB_WORKSPACE/mmsource --sm-path=$GITHUB_WORKSPACE/sourcemod --steamworks-path=$GITHUB_WORKSPACE/steamworks-sdk --sdks=sdk2013 --enable-optimize + ambuild + - name: Zip Release + working-directory: ./sm-environment + run: ${{ matrix.zip_cmd }} + - name: Release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ github.workspace }}/sm-environment/package.zip + asset_name: ${{ matrix.asset_name }}.zip + tag: ${{ github.ref }} \ No newline at end of file diff --git a/AMBuildScript b/AMBuildScript index db084e2..0e31619 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -1,5 +1,6 @@ # vim: set sts=2 ts=8 sw=2 tw=99 et ft=python: -import os, sys +import os +import sys class SDK(object): def __init__(self, sdk, ext, aDef, name, platform, dir): @@ -10,14 +11,34 @@ class SDK(object): self.define = name self.platform = platform self.name = dir - self.path = None # Actual path + self.path = None # Actual path WinOnly = ['windows'] WinLinux = ['windows', 'linux'] WinLinuxMac = ['windows', 'linux', 'mac'] PossibleSDKs = { + 'episode1': SDK('HL2SDK', '1.ep1', '1', 'EPISODEONE', WinLinux, 'episode1'), + 'ep2': SDK('HL2SDKOB', '2.ep2', '3', 'ORANGEBOX', WinLinux, 'orangebox'), + 'css': SDK('HL2SDKCSS', '2.css', '6', 'CSS', WinLinuxMac, 'css'), + 'hl2dm': SDK('HL2SDKHL2DM', '2.hl2dm', '7', 'HL2DM', WinLinuxMac, 'hl2dm'), + 'dods': SDK('HL2SDKDODS', '2.dods', '8', 'DODS', WinLinuxMac, 'dods'), 'sdk2013': SDK('HL2SDK2013', '2.sdk2013', '9', 'SDK2013', WinLinuxMac, 'sdk2013'), + 'tf2': SDK('HL2SDKTF2', '2.tf2', '11', 'TF2', WinLinuxMac, 'tf2'), + 'l4d': SDK('HL2SDKL4D', '2.l4d', '12', 'LEFT4DEAD', WinLinuxMac, 'l4d'), + 'nucleardawn': SDK('HL2SDKND', '2.nd', '13', 'NUCLEARDAWN', WinLinuxMac, 'nucleardawn'), + 'l4d2': SDK('HL2SDKL4D2', '2.l4d2', '15', 'LEFT4DEAD2', WinLinuxMac, 'l4d2'), + 'darkm': SDK('HL2SDK-DARKM', '2.darkm', '2', 'DARKMESSIAH', WinOnly, 'darkm'), + 'swarm': SDK('HL2SDK-SWARM', '2.swarm', '16', 'ALIENSWARM', WinOnly, 'swarm'), + 'bgt': SDK('HL2SDK-BGT', '2.bgt', '4', 'BLOODYGOODTIME', WinOnly, 'bgt'), + 'eye': SDK('HL2SDK-EYE', '2.eye', '5', 'EYE', WinOnly, 'eye'), + 'csgo': SDK('HL2SDKCSGO', '2.csgo', '21', 'CSGO', WinLinuxMac, 'csgo'), + 'portal2': SDK('HL2SDKPORTAL2', '2.portal2', '17', 'PORTAL2', [], 'portal2'), + 'blade': SDK('HL2SDKBLADE', '2.blade', '18', 'BLADE', WinLinux, 'blade'), + 'insurgency': SDK('HL2SDKINSURGENCY', '2.insurgency', '19', 'INSURGENCY', WinLinuxMac, 'insurgency'), + 'contagion': SDK('HL2SDKCONTAGION', '2.contagion', '14', 'CONTAGION', WinOnly, 'contagion'), + 'bms': SDK('HL2SDKBMS', '2.bms', '10', 'BMS', WinLinux, 'bms'), + 'doi': SDK('HL2SDKDOI', '2.doi', '20', 'DOI', WinLinuxMac, 'doi'), } def ResolveEnvPath(env, folder): @@ -45,16 +66,16 @@ class SteamWorksConfig(object): def __init__(self): self.sdks = {} self.binaries = [] + self.extensions = [] self.mms_root = None self.sm_root = None self.steamworks_root = None - self.extensions = [] # Note: only one architecture supported per build right now. if builder.options.target: - builder.cxx = builder.DetectCxx(target_arch = builder.options.target) + builder.cxx = builder.DetectCxx(target_arch=builder.options.target) else: - builder.cxx = builder.DetectCxx(target_arch = 'x86') + builder.cxx = builder.DetectCxx() @property def tag(self): @@ -71,12 +92,14 @@ class SteamWorksConfig(object): sdk = PossibleSDKs[sdk_name] if builder.cxx.target.platform in sdk.platform: if builder.options.hl2sdk_root: - sdk_path = os.path.join(builder.options.hl2sdk_root, sdk.folder) + sdk_path = os.path.join( + builder.options.hl2sdk_root, sdk.folder) else: sdk_path = ResolveEnvPath(sdk.envvar, sdk.folder) if sdk_path is None or not os.path.isdir(sdk_path): if use_all or sdk_name in sdk_list: - raise Exception('Could not find a valid path for {0}'.format(sdk.envvar)) + raise Exception( + 'Could not find a valid path for {0}'.format(sdk.envvar)) continue if use_all or use_present or sdk_name in sdk_list: sdk.path = Normalize(sdk_path) @@ -85,43 +108,49 @@ class SteamWorksConfig(object): if len(self.sdks) < 1: raise Exception('At least one SDK must be available.') - #METAMOD:SOURCE + # SOURCEMOD + if builder.options.sm_path: + self.sm_root = builder.options.sm_path + else: + self.sm_root = ResolveEnvPath('SOURCEMOD18', 'sourcemod-1.8') + if not self.sm_root: + self.sm_root = ResolveEnvPath('SOURCEMOD', 'sourcemod') + if not self.sm_root: + self.sm_root = ResolveEnvPath( + 'SOURCEMOD_DEV', 'sourcemod-central') + + if not self.sm_root or not os.path.isdir(self.sm_root): + raise Exception('Could not find a source copy of SourceMod') + self.sm_root = Normalize(self.sm_root) + + # METAMOD if builder.options.mms_path: self.mms_root = builder.options.mms_path else: self.mms_root = ResolveEnvPath('MMSOURCE110', 'mmsource-1.10') if not self.mms_root: - self.mms_root = ResolveEnvPath('MMSOURCE10', 'metamod-1.10') + self.mms_root = ResolveEnvPath( + 'MMSOURCE_DEV', 'metamod-source') if not self.mms_root: - self.mms_root = ResolveEnvPath('MMSOURCE_DEV', 'mmsource-central') + self.mms_root = ResolveEnvPath( + 'MMSOURCE_DEV', 'mmsource-central') if not self.mms_root or not os.path.isdir(self.mms_root): raise Exception('Could not find a source copy of Metamod:Source') self.mms_root = Normalize(self.mms_root) - - #SOURCEMOD - if builder.options.sm_path: - self.sm_root = builder.options.sm_path - else: - self.sm_root = ResolveEnvPath('SOURCEMOD16', 'sourcemod-1.6') - if not self.sm_root: - self.sm_root = ResolveEnvPath('SOURCEMOD', 'sourcemod-1.6') - if not self.sm_root: - self.sm_root = ResolveEnvPath('SMCENTRAL', 'sourcemod-central') - if not self.sm_root or not os.path.isdir(self.sm_root): - raise Exception('Could not find a source copy of Sourcemod') - self.sm_root = Normalize(self.sm_root) - - #STEAMWORKS + # STEAMWORKS if builder.options.steamworks_path: self.steamworks_root = builder.options.steamworks_path else: - self.steamworks_root = ResolveEnvPath('STEAMWORKS', 'steamworks-sdk') + self.steamworks_root = ResolveEnvPath( + 'STEAMWORKS', 'steamworks-sdk') if not self.steamworks_root: - self.steamworks_root = ResolveEnvPath('STEAMWORKS', 'steamworks') + self.steamworks_root = ResolveEnvPath( + 'STEAMWORKS', 'steamworks') if not self.steamworks_root: - self.steamworks_root = ResolveEnvPath('STEAMWORKS', 'opensteamworks') + self.steamworks_root = ResolveEnvPath( + 'STEAMWORKS', 'opensteamworks') if not self.steamworks_root or not os.path.isdir(self.steamworks_root): raise Exception('Could not find a source copy of SteamWorks') @@ -129,155 +158,172 @@ class SteamWorksConfig(object): def configure(self): builder.AddConfigureFile('pushbuild.txt') + cxx = builder.cxx - # Only one compiler to configure. - self.configure_cxx(builder.cxx) - - def configure_cxx(self, cxx): if cxx.like('gcc'): - cxx.defines += [ - 'stricmp=strcasecmp', - '_stricmp=strcasecmp', - '_snprintf=snprintf', - '_vsnprintf=vsnprintf', - 'HAVE_STDINT_H', - 'GNUC', - ] - cxx.cflags += [ - '-pipe', - '-fno-strict-aliasing', - '-Wall', - '-Werror', - '-Wno-unused', - '-Wno-switch', - '-Wno-format', - '-Wno-format-security', - '-Wno-array-bounds', - '-msse', - '-m32', - ] - cxx.cxxflags += [ - '-std=c++11', - ] - - have_gcc = cxx.vendor == 'gcc' - have_clang = cxx.vendor == 'clang' - if have_clang or (have_gcc and cxx.version >= '4'): - cxx.cflags += ['-fvisibility=hidden'] - cxx.cxxflags += ['-fvisibility-inlines-hidden'] - if have_clang or (have_gcc and cxx.version >= '4.6'): - cxx.cflags += ['-Wno-narrowing'] - if (have_gcc and cxx.version >= '4.7') or (have_clang and cxx.version >= '3'): - cxx.cxxflags += ['-Wno-delete-non-virtual-dtor'] - if have_gcc and cxx.version >= '4.8': - cxx.cflags += ['-Wno-unused-result'] - if have_clang: - cxx.cxxflags += ['-Wno-implicit-exception-spec-mismatch'] - if (cxx.target.platform == 'mac' and cxx.version >= '5.1') or cxx.version >= '3.4': - cxx.cxxflags += ['-Wno-deprecated-register'] - else: - cxx.cxxflags += ['-Wno-deprecated'] - cxx.cflags += ['-Wno-sometimes-uninitialized'] - - cxx.linkflags += ['-m32'] - cxx.cxxflags += [ - '-fno-exceptions', - '-fno-threadsafe-statics', - '-Wno-non-virtual-dtor', - '-Wno-overloaded-virtual', - ] - - if have_gcc: - cxx.cflags += ['-mfpmath=sse'] + self.configure_gcc(builder.cxx) elif cxx.vendor == 'msvc': - if builder.options.debug == '1': - cxx.cflags += ['/MTd'] - cxx.linkflags += ['/NODEFAULTLIB:libcmt'] - else: - cxx.cflags += ['/MT'] - cxx.defines += [ - '_CRT_SECURE_NO_DEPRECATE', - '_CRT_SECURE_NO_WARNINGS', - '_CRT_NONSTDC_NO_DEPRECATE', - '_ITERATOR_DEBUG_LEVEL=0', - ] - cxx.cflags += [ - '/W3', - ] - cxx.cxxflags += [ - '/EHsc', - '/GR-', - '/TP', - ] - cxx.linkflags += [ - '/MACHINE:X86', - '/SUBSYSTEM:WINDOWS', - 'kernel32.lib', - 'user32.lib', - 'gdi32.lib', - 'winspool.lib', - 'comdlg32.lib', - 'advapi32.lib', - 'shell32.lib', - 'ole32.lib', - 'oleaut32.lib', - 'uuid.lib', - 'odbc32.lib', - 'odbccp32.lib', - ] - - # Optimization + self.configure_msvc(builder.cxx) + + # Optimizaiton if builder.options.opt == '1': cxx.defines += ['NDEBUG'] - if cxx.like('gcc'): - cxx.cflags += ['-O3'] - elif cxx.like('msvc'): - cxx.cflags += ['/Ox'] - cxx.linkflags += ['/OPT:ICF', '/OPT:REF'] # Debugging if builder.options.debug == '1': cxx.defines += ['DEBUG', '_DEBUG'] - if cxx.like('msvc'): - cxx.cflags += ['/Od', '/RTC1'] - if cxx.version >= 1600: - cxx.cflags += ['/d2Zi+'] - - # This needs to be after our optimization flags which could otherwise disable it. - if cxx.vendor == 'msvc': - # Don't omit the frame pointer. - cxx.cflags += ['/Oy-'] # Platform-specifics if cxx.target.platform == 'linux': - cxx.defines += ['_LINUX', 'POSIX'] - if cxx.vendor == 'gcc': - cxx.linkflags += ['-static-libgcc'] - elif cxx.vendor == 'clang': - cxx.linkflags += ['-lgcc_eh'] + self.configure_linux(builder.cxx) elif cxx.target.platform == 'mac': - cxx.defines += ['OSX', '_OSX', 'POSIX'] - cxx.cflags += ['-mmacosx-version-min=10.5'] - cxx.linkflags += [ - '-mmacosx-version-min=10.5', - '-arch', 'i386', - '-static', - '-stdlib=libc++' - ] - cxx.cxxflags += ['-stdlib=libstdc++'] + self.configure_mac(builder.cxx) elif cxx.target.platform == 'windows': - cxx.defines += ['WIN32', '_WINDOWS'] - + self.configure_windows(builder.cxx) + + # Finish up. + cxx.includes += [ + os.path.join(self.sm_root, 'public'), + ] + + def configure_gcc(self, cxx): + cxx.defines += [ + 'stricmp=strcasecmp', + '_stricmp=strcasecmp', + '_snprintf=snprintf', + '_vsnprintf=vsnprintf', + 'HAVE_STDINT_H', + 'GNUC', + ] + cxx.cflags += [ + '-pipe', + '-fno-strict-aliasing', + '-Wall', + '-Werror', + '-Wno-unused', + '-Wno-switch', + '-Wno-array-bounds', + '-msse', + '-m32', + '-fvisibility=hidden', + ] + cxx.cxxflags += [ + '-std=c++11', + '-fno-exceptions', + '-fno-threadsafe-statics', + '-Wno-non-virtual-dtor', + '-Wno-delete-non-virtual-dtor', + '-Wno-overloaded-virtual', + '-fvisibility-inlines-hidden', + ] + cxx.linkflags += ['-m32'] + + have_gcc = cxx.vendor == 'gcc' + have_clang = cxx.vendor == 'clang' + if cxx.version >= 'clang-3.6': + cxx.cxxflags += ['-Wno-inconsistent-missing-override'] + 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 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'] + + if have_gcc: + cxx.cflags += ['-mfpmath=sse'] + + if builder.options.opt == '1': + cxx.cflags += ['-O3'] + + def configure_msvc(self, cxx): + if builder.options.debug == '1': + cxx.cflags += ['/MTd'] + cxx.linkflags += ['/NODEFAULTLIB:libcmt'] + else: + cxx.cflags += ['/MT'] + cxx.defines += [ + '_CRT_SECURE_NO_DEPRECATE', + '_CRT_SECURE_NO_WARNINGS', + '_CRT_NONSTDC_NO_DEPRECATE', + '_ITERATOR_DEBUG_LEVEL=0', + ] + cxx.cflags += [ + '/W3', + ] + cxx.cxxflags += [ + '/EHsc', + '/GR-', + '/TP', + ] + cxx.linkflags += [ + '/MACHINE:X86', + 'kernel32.lib', + 'user32.lib', + 'gdi32.lib', + 'winspool.lib', + 'comdlg32.lib', + 'advapi32.lib', + 'shell32.lib', + 'ole32.lib', + 'oleaut32.lib', + 'uuid.lib', + 'odbc32.lib', + 'odbccp32.lib', + ] + + if builder.options.opt == '1': + cxx.cflags += ['/Ox', '/Zo'] + cxx.linkflags += ['/OPT:ICF', '/OPT:REF'] + + if builder.options.debug == '1': + cxx.cflags += ['/Od', '/RTC1'] + + # This needs to be after our optimization flags which could otherwise disable it. + # Don't omit the frame pointer. + cxx.cflags += ['/Oy-'] + + def configure_linux(self, cxx): + cxx.defines += ['_LINUX', 'POSIX'] + cxx.linkflags += ['-Wl,--exclude-libs,ALL', '-lm'] + if cxx.vendor == 'gcc': + cxx.linkflags += ['-static-libgcc'] + elif cxx.vendor == 'clang': + cxx.linkflags += ['-lgcc_eh'] + + def configure_mac(self, cxx): + cxx.defines += ['OSX', '_OSX', 'POSIX'] + cxx.cflags += ['-mmacosx-version-min=10.15'] + cxx.linkflags += [ + '-mmacosx-version-min=10.15', + '-arch', 'i386', + '-lstdc++', + '-stdlib=libc++', + ] + cxx.cxxflags += ['-stdlib=libc++'] + + def configure_windows(self, cxx): + cxx.defines += ['WIN32', '_WINDOWS'] + def ConfigureForExtension(self, context, compiler): compiler.cxxincludes += [ os.path.join(context.currentSourcePath), os.path.join(context.currentSourcePath, 'sdk'), os.path.join(self.sm_root, 'public'), os.path.join(self.sm_root, 'public', 'extensions'), - os.path.join(self.sm_root, 'public', 'sourcepawn'), + os.path.join(self.sm_root, 'sourcepawn', 'include'), + os.path.join(self.sm_root, 'public', 'amtl', 'amtl'), + os.path.join(self.sm_root, 'public', 'amtl'), ] return compiler - + def ConfigureForHL2(self, binary, sdk): compiler = binary.compiler @@ -291,28 +337,72 @@ class SteamWorksConfig(object): os.path.join(mms_path, 'sourcehook'), ] - defines = ['SE_' + PossibleSDKs[i].define + '=' + PossibleSDKs[i].code for i in PossibleSDKs] + defines = ['SE_' + PossibleSDKs[i].define + '=' + + PossibleSDKs[i].code for i in PossibleSDKs] compiler.defines += defines + paths = [ + ['public'], + ['public', 'engine'], + ['public', 'mathlib'], + ['public', 'vstdlib'], + ['public', 'tier0'], + ['public', 'tier1'] + ] + if sdk.name == 'episode1' or sdk.name == 'darkm': + paths.append(['public', 'dlls']) + paths.append(['game_shared']) + else: + paths.append(['public', 'game', 'server']) + paths.append(['public', 'toolframework']) + paths.append(['game', 'shared']) + paths.append(['common']) + + compiler.defines += ['SOURCE_ENGINE=' + sdk.code] + + if sdk.name in ['sdk2013', 'bms'] and compiler.like('gcc'): + # The 2013 SDK already has these in public/tier0/basetypes.h + compiler.defines.remove('stricmp=strcasecmp') + compiler.defines.remove('_stricmp=strcasecmp') + compiler.defines.remove('_snprintf=snprintf') + compiler.defines.remove('_vsnprintf=vsnprintf') + if compiler.like('msvc'): compiler.defines += ['COMPILER_MSVC', 'COMPILER_MSVC32'] + compiler.linkflags += ['legacy_stdio_definitions.lib'] else: compiler.defines += ['COMPILER_GCC'] + # For everything after Swarm, this needs to be defined for entity networking + # to work properly with sendprop value changes. + if sdk.name in ['blade', 'insurgency', 'doi', 'csgo']: + compiler.defines += ['NETWORK_VARS_ENABLED'] + + if sdk.name in ['css', 'hl2dm', 'dods', 'sdk2013', 'bms', 'tf2', 'l4d', 'nucleardawn', 'l4d2']: + if builder.host.platform in ['linux', 'mac']: + compiler.defines += ['NO_HOOK_MALLOC', 'NO_MALLOC_OVERRIDE'] + + if sdk.name == 'csgo' and builder.host.platform == 'linux': + compiler.linkflags += ['-lstdc++'] + + for path in paths: + compiler.cxxincludes += [os.path.join(sdk.path, *path)] + return binary def HL2Library(self, context, name, sdk): binary = context.compiler.Library(name) self.ConfigureForExtension(context, binary.compiler) return self.ConfigureForHL2(binary, sdk) - + def HL2Project(self, context, name): project = context.LibraryProject(name) self.ConfigureForExtension(context, context.cxx) return project def HL2Config(self, project, cxx, name, sdk): - binary = project.Configure(cxx, name, '{0} - {1}'.format(self.tag, sdk.name)) + binary = project.Configure( + cxx, name, '{0} - {1}'.format(self.tag, sdk.name)) return self.ConfigureForHL2(binary, sdk) SteamWorks = SteamWorksConfig() @@ -322,4 +412,4 @@ SteamWorks.configure() BuildScripts = ['Extension/AMBuilder'] builder.Build(BuildScripts, { 'SteamWorks': SteamWorks }) -builder.Build('buildbot/PackageScript', { 'SteamWorks': SteamWorks }) +builder.Build('buildbot/PackageScript', { 'SteamWorks': SteamWorks }) \ No newline at end of file diff --git a/configure.py b/configure.py index d27f552..3cb5e2e 100644 --- a/configure.py +++ b/configure.py @@ -18,21 +18,22 @@ sys.stderr.write("AMBuild 2.2 or higher is required; please update\n") sys.exit(1) -run = run.BuildParser(sourcePath=sys.path[0], api='2.2') -run.options.add_argument('--hl2sdk-root', type=str, dest='hl2sdk_root', default=None, +parser = run.BuildParser(sourcePath=sys.path[0], api='2.2') +parser.options.add_argument('--hl2sdk-root', type=str, dest='hl2sdk_root', default=None, help='Root search folder for HL2SDKs') -run.options.add_argument('--mms-path', type=str, dest='mms_path', default=None, +parser.options.add_argument('--mms-path', type=str, dest='mms_path', default=None, help='Path to Metamod:Source') -run.options.add_argument('--sm-path', type=str, dest='sm_path', default=None, +parser.options.add_argument('--sm-path', type=str, dest='sm_path', default=None, help='Path to Sourcemod') -run.options.add_argument('--steamworks-path', type=str, dest='steamworks_path', default=None, +parser.options.add_argument('--steamworks-path', type=str, dest='steamworks_path', default=None, help='Path to SteamWorks') -run.options.add_argument('--enable-debug', action='store_const', const='1', dest='debug', +parser.options.add_argument('--enable-debug', action='store_const', const='1', dest='debug', help='Enable debugging symbols') -run.options.add_argument('--enable-optimize', action='store_const', const='1', dest='opt', +parser.options.add_argument('--enable-optimize', action='store_const', const='1', dest='opt', help='Enable optimization') -run.options.add_argument('-s', '--sdks', default='all', dest='sdks', +parser.options.add_argument('-s', '--sdks', default='all', dest='sdks', help='Build against specified SDKs; valid args are "all", "present", or ' 'comma-delimited list of engine names') -run.options.add_argument('--target', default=None, help='Override the default build target') -run.Configure() +parser.options.add_argument('--target', default=None, help='Override the default build target') + +parser.Configure() \ No newline at end of file