Commit Graph

228 Commits

Author SHA1 Message Date
David Anderson
785c6aa1cf Update to AMBuild 2.2.
This is a pretty big diff because SourceMod had lots of multi-arch
workarounds that can now go away. I've also changed 'x64' to 'x86_64' in
many places since this is how AMBuild normalizes it, and it's far too
late to pick the shorter string, so we might as well suck it up.

The --target-archs parameter has been replaced with --targets. It works
the same way.

The default behavior for SDK inclusion is now "present" instead of
"all" since this lowers the burden of storing many SDKs. Official builds
will still be made with --sdks=all.
2020-08-18 23:09:43 -07:00
peace-maker
510bd261f8
core: Add Insurgency support for amd64 Windows (#1295)
* Add basic Insurgency support on Windows x64

This allows SourceMod to load on x64 Insurgency. There are still a lot of variable truncation warnings that have to be dealt with.

* Fix 32bit builds

* Compile MySQL extension as well

The hack for __iob_func being removed from the core runtime, but required by the old mysql we're building against can be simplified a lot due to the `_ReturnAddress` intrinsic available since MSVC 2015.

* Don't include the offset we want to extract in the signature
2020-08-06 19:53:06 -07:00
David Anderson
e5ddbd9886 Introduce a pbproxy library to solve macOS linker issues.
On SDKs which use protobufs, the engine has objects compiled against a specific
version of protobuf. Normally this is fine, we take care on Linux to use the
same C++ ABI. On macOS however, we use libc++ to enable C++11 functionality,
whereas the protobuf library has been compiled with libstc++. These ABIs are
not compatible.

To address the problem, we introduce PbHandle. PbHandle is a wrapper around
protobuf::Message with two added pieces of state: whether or not the handle
"owns" the message (and can free it in its destructor), and whether or not
the handle was created by the engine (private) or created by SourceMod
(local).

Whenever we transfer a protobuf::Message pointer to SourceMod, we must take
care to convert it to a Local version first. Whenever we transfer a protobuf
pointer to the engine, we must convert it to a Private handle.

For platforms with no ABI differences (almost all of them), the handle is a
no-op. The private and local localities are compatible and no translation
takes place.

On macOS, CS:GO does require translation. SourceMod loads a tiny shim
library that contains a copy of the protobuf sources compiled against the
game's ABI. It then provides serialization and deserialization methods.
SourceMod must not interact with the game's protobuf objects without first
going through this proxy library.

Note that PbHandle is not quite like unique_ptr. It can be converted into a
PbHandle that does not destroy the underlying object. This is mainly because
UserMessages.cpp has rather complex state, so it is useful to track locality
without destroying an object. An unowned PbHandle must not outlive the
owning PbHandle.
2020-05-30 22:13:07 -07:00
David Anderson
d525b466ec Use C++11 for macOS and CS:GO. 2020-05-30 22:13:07 -07:00
David Anderson
49669f6585 Revert "Fix linking on Linux."
This reverts commit acf8782786.
2020-05-26 20:04:55 -07:00
David Anderson
acf8782786 Fix linking on Linux. 2020-05-25 21:35:50 -07:00
David Anderson
c9f574c27b Fix mac build. 2020-05-20 22:50:41 -07:00
David Anderson
7a3e4054c7 Enable exception handling in C++ code.
It turns out this was already enabled on MSVC (due to /EHsc), but let's
enable it on other platforms as well.

Exception handling comes with a huge caveat: SourceMod and SourcePawn
are not exception safe. Not only do they predate usable STL (C++11),
they often predate C++03, and sometimes even C++ itself. There are many
places we do not use RAII, or where we accumulate state in a way that
cannot be interrupted.

By enabling exceptions, we are NOT inviting general try/catch. We are
still assuming that a `throw` anywhere within SourceMod will ultimately
result in a crash.

However, as we enable more and more STL, we are losing the ability to
gracefully handle constructor failures and malloc failures. So try-catch
is now enabled. It should only be used in the narrowest of
circumstances:

 - When an exception can be thrown by a library call, and
 - There is no way "a priori" to tell if an exception will be thrown
(for example, std::bad_alloc or std::system_error), and
 - Handling the exception is meaningful.

Generally malloc failures should not be considered meaningful. Once
memory is exhausted, the program will crash or be OOM-killed, so there's
no point in handling the failure. However, cases where the allocation
amount is variable may be meaningful to handle. A simple example would
be CDataPack, where if a plugin leaks entries, it's better to handle
this gracefully given that vector growth is geometric. Another example
might be reads of a massive file or network request into a buffer.

These cases should be rare, given that memory pressure is usually
fatal to srcds anyway. But if you've decided to handle an exception,
the try-catch block should be as narrow as possible. For example,
the following is erroneous:

    ke::Maybe<SomeGiganticThing> object;
    try {
        object.init();
    } catch (const std::bad_alloc&) {
    }

`ke::Maybe` is not threadsafe, and this can leak. Basically, do as
little as possible in try blocks, and use them sparingly, because
they're very difficult to audit.

We are also not inviting use of `throw`, as auditing it is even more
complex than try/catch. It is better to abort(), or use boolean
returns and two-stage object initialization.
2020-05-19 12:21:57 -07:00
David Anderson
ff018a9a5d Improve Travis coverage.
Our official builds use clang-3.4 (for macOS) and clang-3.8 for Linux.
Linux uses libstdc++-4.9. Make sure these two compilers are being tested
and that libstdc++-4.9 is being used for STL.

Add a macOS builder to get coverage there. This will use a newer
clang than we actually use, but as opposed to the linux builder will
test the platform-specific bits.

Finally, use the latest GCC and clang versions from a bionic image, so
we have some coverage of a popular distribution.
2020-05-13 19:09:20 -07:00
David Anderson
f76cb94511 Pare down ThreadSupport and remove ancient thread code.
This patch removes almost all of the existing platform-specific
ThreadSupport code, as well as code derived from it. It is now
implemented on top of C++11 threads and is much simpler.

This is the first inclusion of STL in SourceMod. Mac and Windows are
allowed to dynamically link to their respective implementations. On
Linux, libstdc++ is statically linked, except in the cases where it was
already dynamically linked (csgo, blade).

IEventSignal has been retained because sourcemod-curl-extension relies
on it. As written, it is impossible to use as a condition variable,
because the caller does not have access to the underlying mutex. There
is no way to make this API safe or non-racy, so extensions relying on
it should switch to C++11 threads.

ThreadWorker is now pared down and does not interact or inherit from
BaseWorker in any way. Basic functionality has been tested. Since it is
not used anywhere in SourceMod, or seemingly in any repository on
GitHub, it's unclear whether it should even exist. But it has been
tested in this patch.

This change bumps the minimum macOS version to OS X 10.7, and the
minimum C++ standard level to C++14.
2020-05-13 00:35:29 -07:00
David Anderson
87cc42d348 Fix build failures with clang 10. 2020-05-12 23:04:55 -07:00
Asher Baker
6465bd83a4 Update for latest Blade Symphony SDK 2020-03-11 22:36:25 +00:00
Asher Baker
bff8585411
Add an option to build against no SDKs (#1201) 2020-03-04 21:52:07 +00:00
Asher Baker
6a307bfcee
Restore the frame pointer on Linux (#1200)
Looks like the default here changed when we upgraded the Linux build server.

This is causing issues when debugging crash dumps.
2020-03-04 21:43:13 +00:00
Nicholas Hastings
1000d419fc Throw configuration error on unsupported compilers (#1029) 2019-11-15 16:40:39 -08:00
David Anderson
7ab3a3cfd9 Update SourcePawn to master.
This turns on the new expression parser by default.
2019-10-28 21:19:22 -07:00
Asher Baker
8ce99e0540 Link pthread library for Linux binaries 2019-07-24 14:47:13 +01:00
Headline
2164f5191e
Fix GCC 9 Builds (#1024) 2019-05-28 17:57:40 -07:00
Asher Baker
1ca4517f46 Revert "Remove arch loops from build scripts. (#889)"
This reverts commit 7ed329c11f.
2018-10-04 17:59:40 +00:00
David Anderson
7ed329c11f
Remove arch loops from build scripts. (#889)
This simplifies non-sdk build scripts by removing their loops over SM.archs. Instead the top-level
build script will re-evaluate them for each architecture.
2018-09-30 09:59:28 -07:00
peace-maker
9cc518e408 Fix MySQL extension build using vs2015 (#824)
MySQL defines its own timespec_t. Official mysql builds are built using VS2013, so you still need to compile the client library yourself to be able to link it, but this change makes the dbi extension compatible with future versions already.
2018-06-05 09:29:11 -04:00
Nicholas Hastings
4637cf9221
Use MySQL 5.5 for MySQL extension. (#786) 2018-03-20 17:12:30 -04:00
Scott Ehlert
ce1a4dcac0
64-bit support for CSGO on Linux and macOS (#705) 2017-12-20 01:56:23 -06:00
Nicholas Hastings
4007ec8cf8 Temp fix for load issues on Linux. 2017-12-05 20:44:53 -05:00
Nicholas Hastings
95afe72307
Separate out DOI build. (#718) 2017-11-03 15:45:16 -04:00
Scott Ehlert
27b69559a3 Really fix macOS build. 2017-10-26 20:38:25 -05:00
Kyle Sanderson
65bf85fcbe (Re-)Add support for gcc and clang3.9, 4.0, and 5.0. 2017-10-09 16:53:19 -07:00
Scott Ehlert
bbdecceb4b Switch to AMBuild 2.1 API. (#694) 2017-10-02 07:18:57 -05:00
peace-maker
8840ce905d Update to latest SourcePawn (#639) 2017-07-18 12:48:39 +01:00
Nicholas Hastings
ad3588d0aa Use newer MM:S api for Ep1/Original engine. (#548)
* Use newer MM:S api for Ep1/Original engine.

* Remove doubled FILENAME_1_6_EP1 define.
2017-01-11 21:25:00 -05:00
Nicholas Hastings
7fda6e412a Don't build for CS:GO on Mac anymore. (Game is 64-bit-only there now). 2016-10-13 20:54:54 -04:00
Nicholas Hastings
f668b3fe6c 🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍 2016-06-11 12:43:04 -04:00
Nicholas Hastings
f12924458f Merge branch 'vs2015' 2016-06-11 12:14:12 -04:00
Nicholas Hastings
40f2512317 Remove support for Source 1 Dota 2. (#496) 2016-04-26 23:18:47 -04:00
Nicholas Hastings
29a5daab98 Allow support for running on filesystems that use 64-bit inodes on Linux. (#502)
Most supported games don't even support this case, but at least CS:GO does. WIthout
this fix, some filesystem calls can fail, or in the case of readdir, fail to return all/any files.
This was first observed when using an XFS-formatted volume on CentOS 7 x64.
2016-04-26 23:17:36 -04:00
Nicholas Hastings
416abd81a1 Add support for compiling with VS2015. 2016-03-30 08:56:27 -04:00
Nicholas Hastings
3c24ce4d7b Change --exclude-libs to be for Linux only. Apple's linker does not support it. 2016-01-09 11:50:13 -05:00
Nicholas Hastings
05c7bd4be9 Don't export (all) symbols from included static lib on Linux/Mac. 2016-01-09 10:26:12 -05:00
Nicholas Hastings
529d7e2659 Fix Insurgency build on Linux for SDK changes. 2015-10-27 18:17:26 -07:00
David Anderson
6c5ab80418 Refactor and cleanup the AMBuildScript a bit. 2015-10-08 14:55:53 -07:00
Nicholas Hastings
292df5010f Stop building Source 1 Dota 2 build. 2015-09-18 15:36:46 -04:00
David Anderson
e30b57cb4a Update build scripts for new AMTL folder structure. 2015-08-26 15:54:55 -04:00
Nicholas Hastings
4dd641287d Fix typo in last commit. 2015-08-15 11:56:36 -04:00
Nicholas Hastings
199d1b8eeb Fix Mac build. 2015-08-14 22:00:43 -04:00
Nicholas Hastings
620cb405b1 Fix build on Clang 3.6. 2015-08-14 08:25:40 -04:00
Nicholas Hastings
4152e05dcd Fix indentation. 2015-05-12 06:21:32 -07:00
Nicholas Hastings
b3efc36487 Link libm in all bin, not just engine-specific ones.
This fixes the "undefined symbol: floorf" error that some people were getting in sourcemod.logic.so.
2015-05-11 18:59:12 -04:00
Nicholas Hastings
64f9aedebc Add basic support for Black Mesa.
(Basically a copy of SDK 2013's support, but against BMS SDK).
2015-05-06 21:12:13 -04:00
David Anderson
7fc993e079 Fix build. 2015-03-15 19:27:44 -07:00
David Anderson
2ab3498ab0 Use upstream SourcePawn as a submodule. 2015-03-15 16:38:38 -07:00
David Anderson
eaea3c927d Update upstream AMTL as a submodule. 2015-03-08 00:24:03 -08:00
David Anderson
561004c4bf Move SourcePawn headers out of public/ into sourcepawn/include. 2015-03-07 11:13:32 -08:00
David Anderson
d459ebee41 Rename jit/ to vm/. 2015-03-07 10:50:35 -08:00
Nicholas Hastings
aff2551942 Remove conditionals in ambuild scripts for using msvc <2013 (not supported). 2015-01-21 11:04:52 -05:00
Nicholas Hastings
7e8473b61a Remove /Zo on debug builds and add on release builds. 2014-12-14 16:03:42 -05:00
Nicholas Hastings
03abafce3d Change /d2Zi+ flag on msvc builds to /Zo.
http://msdn.microsoft.com/en-us/library/dn785163.aspx
2014-12-14 14:59:16 -05:00
Nicholas Hastings
f0fe427fee Link libstdc++ on linux for CS:GO. 2014-09-11 19:23:10 -04:00
Nicholas Hastings
96f8d635c3 Re-enable -Wformat and -Wformat-security in builds 2014-09-09 22:05:07 -04:00
Nicholas Hastings
892edd9650 Allow BindIdentity and FindAdminByIdentity to take more SteamID formats for steam auth type 2014-09-04 15:26:12 -07:00
David Anderson
666b6b97ee Fix Mac build on apple-clang 5.0. 2014-08-22 20:30:35 -07:00
David Anderson
a7342f3fa2 Fix AMBuildScript compatibility issue with older objdirs. 2014-07-05 13:28:55 -07:00
David Anderson
68ab7f0a12 Merge pull request #61 from VoiDeD/ambuild-disable-auto-versioning
Add an ambuild configure option to disable auto versioning.
2014-07-05 09:39:35 -07:00
David Anderson
9a2bdd3792 Add -Wno-sometimes-uninitialized. 2014-07-04 23:10:23 -07:00
David Anderson
79d9a49d28 Fix compiler bug. 2014-07-04 22:46:55 -07:00
Ryan Stecker
d4f4a7eed0 Add an ambuild configure option to disable auto versioning. 2014-07-02 13:29:59 -05:00
Scott Ehlert
415b6ea174 Use -Wno-deprecated-register on clang 3.4+ or Apple clang 5.1+ only (bug 6164). 2014-07-01 16:13:22 -05:00
David Anderson
6a5da160ad Fix build. 2014-06-25 01:06:48 -07:00
David Anderson
ec61d4d188 Add a general profiling abstraction layer. 2014-06-24 01:04:13 -07:00
Nicholas Hastings
8b7ce5eed2 Enable C++ support on "like" gcc builds. 2014-06-19 20:59:15 -04:00
David Anderson
897aa42135 Remove tag(). 2014-05-31 19:59:02 -07:00
David Anderson
abdf7d5b07 Port build scripts to the new project API. 2014-05-31 19:56:42 -07:00
David Anderson
9f8f879590 Fix typo. 2014-05-31 18:12:49 -07:00
David Anderson
db14d2d00a Factor out versioning. 2014-05-31 17:57:53 -07:00
David Anderson
4f7b0ff487 Update the build script to the latest AMBuild API. 2014-05-30 22:50:35 -07:00
David Anderson
1e6843f8db Add support for the preliminary IDE project file generator. 2014-05-30 19:07:56 -07:00
David Anderson
b4144d2cff Find metamod-source over mmsource-central. 2014-05-26 21:38:08 -07:00
David Anderson
5bbcc7322c Add path configuration options. 2014-05-26 21:30:43 -07:00
David Anderson
fbaa3a804f Make SDK keys consistent. 2014-05-25 02:14:05 -07:00
David Anderson
2e89d91a86 Switch build infrastructure to Git. 2014-05-25 01:53:58 -07:00
Ruben Gonzalez
8ed66980c0 Update for hl2sdk-l4d changes. 2014-05-21 00:09:53 -04:00
David Anderson
29ff05bd62 Fix compiler bug with multidimensional array variable release (bug 6100, r=fyren).
--HG--
extra : rebase_source : 3f3c366fd8c47268ecd0df5907b68d3c879a5e60
2014-05-09 23:17:14 -04:00
Nicholas Hastings
63451b7b6b Update for hl2sdk-nd changes. 2014-04-20 12:00:04 -04:00
Nicholas Hastings
2b015a1d5b Add support for Contagion (bug 6007, r=asherkin). 2014-03-29 14:14:00 -04:00
Nicholas Hastings
8c513faad5 Fix non-msvc build. 2014-03-21 12:08:17 -04:00
Nicholas Hastings
6e8d9ff788 Record inline function debug info in PDB files (r=asherkin). 2014-03-21 12:04:41 -04:00
Scott Ehlert
f8f4cebe9e Add support for Dota 2 on Linux and Mac OS X (bug 6068, r=psychonic). 2014-03-03 05:20:38 -06:00
Nicholas Hastings
5b96047ce8 Enable SDK "COMPILER_*" defines for all builds (nobug, r=asherkin). 2014-02-28 20:43:07 -05:00
Scott Ehlert
9be71eea2f Fix ___strlcat_chk symbol error on OS X 10.8 and earlier (bug 6046, r=dvander). 2014-02-13 01:28:13 -06:00
Nicholas Hastings
c5f496670d Define NETWORK_VARS_ENABLED for SDKs that require it. 2014-02-10 21:04:01 -05:00
Scott Ehlert
e00e879af5 Use == instead of is operator for checking string equality in AMBuild scripts (bug 6043, r=dvander). 2014-02-09 22:50:20 -06:00
Scott Ehlert
40d03f78cf Hopefully fixed clang build on Linux. 2014-01-08 17:37:55 -06:00
Scott Ehlert
3f3343e945 Changes to pushbuild.txt now trigger a reconfigure. 2014-01-08 17:09:50 -06:00
David Anderson
cfad3b26ca Port breakpad symbol uploading to AMBuild 2 (bug 5997 part 16, r=ds). 2013-12-30 17:51:02 -05:00
David Anderson
b69b0de234 Various build fixes (bug 5997 part 14, r=ds). 2013-12-30 17:51:01 -05:00
David Anderson
6d320163a1 Various Windows build fixes (bug 5997 part 13, r=ds).
--HG--
rename : sourcepawn/compiler/libpawnc.rc => sourcepawn/compiler/version.rc
2013-12-30 17:51:00 -05:00
David Anderson
ae21f29ad9 Port the PDB log to AMBuild 2 (bug 5997 part 11, r=ds). 2013-12-30 17:51:00 -05:00
David Anderson
f82224eba0 Move versioning to a static library to improve trivial build speed (bug 5997 part 9, r=ds). 2013-12-30 17:51:00 -05:00
David Anderson
c2cfe60102 Port versioning to AMBuild 2 (bug 5997 part 8, r=ds). 2013-12-30 17:50:59 -05:00
David Anderson
75e622e879 Port packaging to AMBuild 2 (bug 5997 part 6, r=ds). 2013-12-30 17:50:59 -05:00
David Anderson
9c19f6efb7 Port plugin build scripts to AMBuild 2 (bug 5997 part 5, r=ds). 2013-12-30 17:50:58 -05:00