mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-01 23:35:41 +00:00
add FreeBSD build target
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
This commit is contained in:
parent
23ea3311cf
commit
cd9f8e3056
10
README.md
10
README.md
@ -42,7 +42,7 @@ We only allow building unmodified (original) source code for public use. `master
|
||||
|
||||
## Supported Operating Systems
|
||||
|
||||
The code itself supports (latest stable) Linux and Windows. In terms of actual build support, for now we usually only distribute Windows binaries and Linux. For any other distro or OS, you just have to find the same libraries listed in [Runtime Dependencies](#runtime-dependencies) further down the page, and it should build fine.
|
||||
The code itself supports (latest stable) Linux, Windows andcurrently supported production releases of FreeBSD. In terms of actual build support, for now we usually only distribute Windows binaries and Linux. For any other distro or OS, you just have to find the same libraries listed in [Runtime Dependencies](#runtime-dependencies) further down the page, and it should build fine.
|
||||
|
||||
Recommended compilers: MSVC, GCC, CLANG.
|
||||
|
||||
@ -72,6 +72,14 @@ You can build on **Windows, Linux** or other platforms by following these steps:
|
||||
|
||||
When you make changes to the code, you only have to run step 4 again.
|
||||
|
||||
It's a similar situation on FreeBSD, although build dependencies can be universally installed from ports via pkg:
|
||||
```
|
||||
pkg install git cmake-core zip bash devel/ninja devel/pkgconf lua53
|
||||
```
|
||||
Then follow the linux build instructions beginning from step 3. **Note**: Running the initial cmake command will compile vcpkg from source, as vcpkg has no native FreeBSD port - this may take some time.
|
||||
|
||||
**Note**: On systems with a single logical CPU core, `make` may fail to build the server when using the `--parallel` option when calling CMake.
|
||||
|
||||
### Runtime Dependencies
|
||||
|
||||
These are needed to *run* the server.
|
||||
|
@ -9,7 +9,14 @@
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
char _getch();
|
||||
#endif // unix
|
||||
#endif // linux
|
||||
|
||||
#ifdef BEAMMP_FREEBSD
|
||||
#include <errno.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
char _getch();
|
||||
#endif // freebsd
|
||||
|
||||
// ======================= APPLE ========================
|
||||
|
||||
|
@ -3,11 +3,13 @@
|
||||
// one of BEAMMP_{WINDOWS,LINUX,APPLE} will be set at the end of this
|
||||
|
||||
// clang-format off
|
||||
#if !defined(BEAMMP_WINDOWS) && !defined(BEAMMP_UNIX) && !defined(BEAMMP_APPLE)
|
||||
#if !defined(BEAMMP_WINDOWS) && !defined(BEAMMP_UNIX) && !defined(BEAMMP_APPLE) && !defined(BEAMMP_FREEBSD)
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
#define BEAMMP_WINDOWS
|
||||
#elif defined(__linux__) || defined(__linux) || defined(linux) || defined(__unix__) || defined(__unix) || defined(unix)
|
||||
#elif defined(__linux__) || defined(__linux) || defined(linux)
|
||||
#define BEAMMP_LINUX
|
||||
#elif defined(__FreeBSD__)
|
||||
#define BEAMMP_FREEBSD
|
||||
#elif defined(__APPLE__) || defined(__MACH__)
|
||||
#define BEAMMP_APPLE
|
||||
#else
|
||||
|
@ -274,7 +274,9 @@ void RegisterThread(const std::string& str) {
|
||||
#elif defined(BEAMMP_APPLE)
|
||||
ThreadId = std::to_string(getpid()); // todo: research if 'getpid()' is a valid, posix compliant alternative to 'gettid()'
|
||||
#elif defined(BEAMMP_LINUX)
|
||||
ThreadId = std::to_string(gettid());
|
||||
ThreadId = std::to_string(gettid()); //todo: 'gettid()' may not produce the inted behavior, as tid's can be the same as pid's when the calling process only has one thread (according to this StackOverflow answer: https://stackoverflow.com/a/8787888). gettid is also a linux specific call (not in posix standard). consider to refactor this in a posix compliant way (maybe 'pthread_self()'?).
|
||||
#elif defined(BEAMMP_FREEBSD)
|
||||
ThreadId = std::to_string(getpid());
|
||||
#endif
|
||||
if (Application::Settings.DebugModeEnabled) {
|
||||
std::ofstream ThreadFile(".Threads.log", std::ios::app);
|
||||
@ -289,6 +291,11 @@ TEST_CASE("RegisterThread") {
|
||||
CHECK(threadNameMap.at(std::this_thread::get_id()) == "MyThread");
|
||||
}
|
||||
|
||||
#ifdef BEAMMP_FREEBSD
|
||||
#undef major
|
||||
#undef minor
|
||||
#endif
|
||||
|
||||
Version::Version(uint8_t major, uint8_t minor, uint8_t patch)
|
||||
: major(major)
|
||||
, minor(minor)
|
||||
|
Loading…
x
Reference in New Issue
Block a user