Compare commits

...

9 Commits

Author SHA1 Message Date
Lucca Jiménez Könings 6f02ff92c2 fix typos and phrasing in README.md
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-01-19 14:14:09 +01:00
Lucca Jiménez Könings 3ddc2d8f8b remove unecessary comment
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-01-19 14:10:14 +01:00
Lucca Jiménez Könings 4d0864790a move undef macros into Compat.h
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-01-19 14:09:56 +01:00
Lucca Jiménez Könings a22ad66d2b update README.md
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-01-19 14:09:09 +01:00
Lucca Jiménez Könings b17c72f56e document FreeBSD specific undefs
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-01-19 12:42:51 +01:00
Lucca Jiménez Könings 1bd8b024b8 fix typo
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-01-19 12:38:12 +01:00
Lucca Jiménez Könings df524097fb update README.md
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-01-19 12:35:19 +01:00
Lucca Jiménez Könings 38532babd3 fix tests on FreeBSD
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-01-19 10:51:04 +01:00
Lucca Jiménez Könings 924efe4331 add FreeBSD build target
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-01-19 09:46:27 +01:00
5 changed files with 28 additions and 4 deletions
+9 -1
View File
@@ -42,7 +42,7 @@ We only allow building unmodified (original) source code for public use. `master
## Supported Operating Systems ## 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 and 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. Recommended compilers: MSVC, GCC, CLANG.
@@ -71,6 +71,14 @@ You can build on **Windows, Linux** or other platforms by following these steps:
5. Your executable can be found in `bin/`. 5. Your executable can be found in `bin/`.
When you make changes to the code, you only have to run step 4 again. When you make changes to the code, you only have to run step 4 again.
### Building for FreeBSD
Building is only supported for major release branches of FreeBSD that are currently not EOL. The build process is the same as on Linux, although build dependencies can be universally installed from ports via pkg:
```
pkg install git cmake-core zip bash devel/ninja devel/pkgconf lua53
```
After installing the necessary build dependencies, follow the Linux build instructions beginning from step 3. Beware that running the initial cmake command will compile vcpkg from source, as vcpkg has no native FreeBSD port - this may take some time.
On systems with a single logical CPU core, `make` may fail to build the server when using the `--parallel` option when calling CMake. If you see error messages related to make, simply omit the `--parallel` from the command: `cmake --build bin --config Release -t BeamMP-Server`.
### Runtime Dependencies ### Runtime Dependencies
+11 -1
View File
@@ -9,7 +9,17 @@
#include <termios.h> #include <termios.h>
#include <unistd.h> #include <unistd.h>
char _getch(); char _getch();
#endif // unix #endif // linux
#ifdef BEAMMP_FREEBSD
#include <errno.h>
#include <termios.h>
#include <unistd.h>
char _getch();
// macros 'major' and 'minor' need to be undefined on FreeBSD to avoid naming collision with system headers
#undef major
#undef minor
#endif // freebsd
// ======================= APPLE ======================== // ======================= APPLE ========================
+4 -2
View File
@@ -3,11 +3,13 @@
// one of BEAMMP_{WINDOWS,LINUX,APPLE} will be set at the end of this // one of BEAMMP_{WINDOWS,LINUX,APPLE} will be set at the end of this
// clang-format off // 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__) #if defined(_WIN32) || defined(__CYGWIN__)
#define BEAMMP_WINDOWS #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 #define BEAMMP_LINUX
#elif defined(__FreeBSD__)
#define BEAMMP_FREEBSD
#elif defined(__APPLE__) || defined(__MACH__) #elif defined(__APPLE__) || defined(__MACH__)
#define BEAMMP_APPLE #define BEAMMP_APPLE
#else #else
+2
View File
@@ -275,6 +275,8 @@ void RegisterThread(const std::string& str) {
ThreadId = std::to_string(getpid()); // todo: research if 'getpid()' is a valid, posix compliant alternative to 'gettid()' ThreadId = std::to_string(getpid()); // todo: research if 'getpid()' is a valid, posix compliant alternative to 'gettid()'
#elif defined(BEAMMP_LINUX) #elif defined(BEAMMP_LINUX)
ThreadId = std::to_string(gettid()); ThreadId = std::to_string(gettid());
#elif defined(BEAMMP_FREEBSD)
ThreadId = std::to_string(getpid());
#endif #endif
if (Application::Settings.DebugModeEnabled) { if (Application::Settings.DebugModeEnabled) {
std::ofstream ThreadFile(".Threads.log", std::ios::app); std::ofstream ThreadFile(".Threads.log", std::ios::app);
+2
View File
@@ -41,7 +41,9 @@ TEST_CASE("init and reset termios") {
CHECK_EQ(current.c_iflag, original.c_iflag); CHECK_EQ(current.c_iflag, original.c_iflag);
CHECK_EQ(current.c_ispeed, original.c_ispeed); CHECK_EQ(current.c_ispeed, original.c_ispeed);
CHECK_EQ(current.c_lflag, original.c_lflag); CHECK_EQ(current.c_lflag, original.c_lflag);
#ifndef BEAMMP_FREEBSD // The 'c_line' attribute seems to only exist on Linux, so we need to omit it on other platforms
CHECK_EQ(current.c_line, original.c_line); CHECK_EQ(current.c_line, original.c_line);
#endif
CHECK_EQ(current.c_oflag, original.c_oflag); CHECK_EQ(current.c_oflag, original.c_oflag);
CHECK_EQ(current.c_ospeed, original.c_ospeed); CHECK_EQ(current.c_ospeed, original.c_ospeed);
} }