Skip to content

Commit adb6833

Browse files
committed
Fix json-c build on macOS and fix some warnings
Also fixes build warning for CObject.cpp. Removes need for `rt` on macOS.
1 parent 57fb6a1 commit adb6833

File tree

7 files changed

+23
-3
lines changed

7 files changed

+23
-3
lines changed

Server/mods/deathmatch/logic/CObject.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,12 @@ bool CObject::ReadSpecialData(const int iLine)
156156
m_ucInterior = static_cast<unsigned char>(iTemp);
157157

158158
if (GetCustomDataInt("dimension", iTemp, true))
159+
{
159160
if (iTemp == -1)
160161
m_bVisibleInAllDimensions = true;
161162
else
162163
m_usDimension = static_cast<unsigned short>(iTemp);
164+
}
163165

164166
if (!GetCustomDataBool("doublesided", m_bDoubleSided, true))
165167
m_bDoubleSided = false;

Server/mods/deathmatch/premake5.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,11 @@ project "Deathmatch"
6161

6262
filter "system:not windows"
6363
buildoptions { "-Wno-narrowing" } -- We should fix the warnings at some point
64-
links { "rt" }
6564
buildoptions { "-pthread" }
6665
linkoptions { "-pthread" }
6766

67+
filter "system:linux"
68+
links { "rt" }
69+
6870
filter "platforms:x64"
6971
targetdir(buildpath("server/x64"))

Shared/XML/premake5.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ project "XML"
3535
copy "mta"
3636
}
3737

38-
filter "system:not windows"
38+
filter "system:linux"
3939
links { "rt" }
4040

4141
filter "platforms:x64"

vendor/cryptopp/premake5.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ project "cryptopp"
144144
"keccak_core.cpp"
145145
}
146146

147+
filter "system:macosx"
148+
defines {"CRYPTOPP_DISABLE_ASM"}
149+
147150
filter "platforms:x64"
148151
files {
149152
"x64dll.asm",

vendor/json-c/linkhash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ static uint32_t hashlittle( const void *key, size_t length, uint32_t initval)
439439
/* a simple hash function similiar to what perl does for strings.
440440
* for good results, the string should not be excessivly large.
441441
*/
442-
static unsigned long lh_perllike_str_hash(const void *k)
442+
static unsigned long lh_perllike_str_hash(const void *k)
443443
{
444444
const char *rkey = (const char *)k;
445445
unsigned hashval = 1;

vendor/json-c/premake5.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,14 @@ project "json-c"
2424

2525
filter "system:not windows"
2626
includedirs { "shipped_for_mta_linux" }
27+
28+
filter "system:macosx"
29+
defines {"HAVE_XLOCALE_H"}
30+
31+
-- `#include <machine/endian.h>` works fine but `#include <endian.h>` does not
32+
-- see linkhash.c line 23 (introduced in b95bda01e80359e)
33+
--
34+
-- This line should fix this, but it doesn't work because `/usr/local/include`
35+
-- doesn't exist on macOS. If you want to fix this include, modify
36+
-- shipped_for_mta_linux to re-enable inclusion of `endian.h` on macOS.
37+
-- includedirs {"/usr/local/include/machine"}

vendor/json-c/shipped_for_mta_linux/config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@
4343
/* #undef HAVE_DOPRNT */
4444

4545
/* Define to 1 if you have the <endian.h> header file. */
46+
#ifndef __APPLE__
4647
#define HAVE_ENDIAN_H 1
48+
#endif
4749

4850
/* Define to 1 if you have the <fcntl.h> header file. */
4951
#define HAVE_FCNTL_H 1

0 commit comments

Comments
 (0)