From 780e17a348b6eea8e0b7a2ae57ea523eb6de7df1 Mon Sep 17 00:00:00 2001 From: tschumann Date: Sun, 14 Apr 2024 16:41:54 +1000 Subject: [PATCH 1/3] Update s1_sample_mm build instructions. --- samples/s1_sample_mm/README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/samples/s1_sample_mm/README.md b/samples/s1_sample_mm/README.md index aa8cbc13..20d4a70e 100644 --- a/samples/s1_sample_mm/README.md +++ b/samples/s1_sample_mm/README.md @@ -2,3 +2,19 @@ For more information on compiling and reading the plugin's source code, see: http://wiki.alliedmods.net/Category:Metamod:Source_Development +Build instructions +------------------ + +Make sure ambuild2 is installed: https://github.com/alliedmodders/ambuild + +Configure the build (where `--hl2sdk-root` specifies the path to the desired SDK installed by `support/checkout-deps.sh`): +``` +mkdir build +cd build +python ../configure.py --hl2sdk-root C:/Users/user/Documents/GitHub/hl2sdk-episode1 +``` + +Build: +``` +ambuild +``` \ No newline at end of file From 2c6b4c26f78b8687d3a94df8cfd0d062e9e1da41 Mon Sep 17 00:00:00 2001 From: tschumann Date: Sun, 14 Apr 2024 20:02:30 +1000 Subject: [PATCH 2/3] Fix s1_sample_mm compilation on Windows and for Episode 1 and document build process. --- samples/s1_sample_mm/AMBuildScript | 32 +++++--------------------- samples/s1_sample_mm/README.md | 11 +++++++-- samples/s1_sample_mm/engine_wrappers.h | 4 ---- 3 files changed, 15 insertions(+), 32 deletions(-) diff --git a/samples/s1_sample_mm/AMBuildScript b/samples/s1_sample_mm/AMBuildScript index aa1b055a..13b6c314 100644 --- a/samples/s1_sample_mm/AMBuildScript +++ b/samples/s1_sample_mm/AMBuildScript @@ -191,9 +191,6 @@ class MMSConfig(object): cxx = builder.DetectCxx() - if cxx.like('msvc') and len(self.archs) > 1: - raise Exception('Building multiple archs with MSVC is not currently supported') - if cxx.behavior == 'gcc': cxx.defines += [ 'stricmp=strcasecmp', @@ -229,9 +226,6 @@ class MMSConfig(object): if cxx.version >= 'clang-3.9' or cxx.version >= 'apple-clang-10.0': cxx.cxxflags += ['-Wno-expansion-to-defined'] - elif cxx.like('msvc'): - raise Exception('MSVC builds should use the Visual Studio projects until somebody implements support') # todo: implement MSVC support - # Optimization if builder.options.opt == '1': if cxx.behavior == 'gcc': @@ -275,17 +269,10 @@ class MMSConfig(object): def HL2Compiler(self, context, sdk, arch): compiler = context.cxx.clone() - if sdk.name == 'episode1' or sdk.name == 'darkm': - compiler.cxxincludes += [ - os.path.join(context.currentSourcePath), - os.path.join(self.mms_root, 'core-legacy'), - os.path.join(self.mms_root, 'core-legacy', 'sourcehook'), - ] - else: - compiler.cxxincludes += [ - os.path.join(context.currentSourcePath), - os.path.join(self.mms_root, 'core'), - os.path.join(self.mms_root, 'core', 'sourcehook'), + compiler.cxxincludes += [ + os.path.join(context.currentSourcePath), + os.path.join(self.mms_root, 'core'), + os.path.join(self.mms_root, 'core', 'sourcehook'), ] defines = ['SE_' + PossibleSDKs[i].define + '=' + PossibleSDKs[i].code for i in PossibleSDKs] @@ -332,18 +319,11 @@ class MMSConfig(object): return compiler def AddVersioning(self, binary, arch): - if builder.target.platform == 'windows': - # todo: verify this for MSVC support - binary.sources += ['version.rc'] - binary.compiler.rcdefines += [ - 'BINARY_NAME="{0}"'.format(binary.outputFile), - 'RC_COMPILE' - ] - elif builder.target.platform == 'mac' and binary.type == 'library': + if builder.target.platform == 'mac' and binary.type == 'library': binary.compiler.postlink += [ '-compatibility_version', '1.0.0', '-current_version', self.productVersion - ] + ] return binary diff --git a/samples/s1_sample_mm/README.md b/samples/s1_sample_mm/README.md index 20d4a70e..66c15123 100644 --- a/samples/s1_sample_mm/README.md +++ b/samples/s1_sample_mm/README.md @@ -7,11 +7,18 @@ Build instructions Make sure ambuild2 is installed: https://github.com/alliedmodders/ambuild -Configure the build (where `--hl2sdk-root` specifies the path to the desired SDK installed by `support/checkout-deps.sh`): +Configure the build (`--hl2sdk-root` specifies the path where the all SDKs have been installed by `support/checkout-deps.sh` and `--mms_path` is the path to Metamod: Source). + +If you only want to compile using a specific SDK you can hack around the requirement to build for all SDKs by modifying the calls to the SDK constructor in the assignment to `PossibleSDKs` in `AMBuildScript` and setting the `platforms` parameter to \[\] for all SDKs that you don't want to compile for. + +### Windows + +Use Command Prompt as Gitbash doesn't handle the path arguments correctly. + ``` mkdir build cd build -python ../configure.py --hl2sdk-root C:/Users/user/Documents/GitHub/hl2sdk-episode1 +python ../configure.py --hl2sdk-root C:\Users\user\Documents\GitHub --mms_path C:\Users\user\Documents\GitHub\metamod-source ``` Build: diff --git a/samples/s1_sample_mm/engine_wrappers.h b/samples/s1_sample_mm/engine_wrappers.h index 1f883e1c..800174cf 100644 --- a/samples/s1_sample_mm/engine_wrappers.h +++ b/samples/s1_sample_mm/engine_wrappers.h @@ -20,10 +20,6 @@ extern IVEngineServer *engine; extern CGlobalVars *gpGlobals; -#if SOURCE_ENGINE == SE_EPISODEONE && defined METAMOD_PLAPI_VERSION -#error "Metamod:Source 1.6 API is not supported on the old engine." -#endif - #define ENGINE_CALL(func) SH_CALL(engine, &IVEngineServer::func) /** From 438121f009946bc890acdf1eea595a0a29a4ae2b Mon Sep 17 00:00:00 2001 From: tschumann Date: Sun, 14 Apr 2024 20:03:57 +1000 Subject: [PATCH 3/3] Fix brace alignment. --- samples/s1_sample_mm/AMBuildScript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/s1_sample_mm/AMBuildScript b/samples/s1_sample_mm/AMBuildScript index 13b6c314..0c3ac7d7 100644 --- a/samples/s1_sample_mm/AMBuildScript +++ b/samples/s1_sample_mm/AMBuildScript @@ -323,7 +323,7 @@ class MMSConfig(object): binary.compiler.postlink += [ '-compatibility_version', '1.0.0', '-current_version', self.productVersion - ] + ] return binary