Skip to content

Commit db33880

Browse files
committed
macOS: make dbconmy compile
`brew install mysql` required
1 parent e4eff82 commit db33880

File tree

4 files changed

+51
-46
lines changed

4 files changed

+51
-46
lines changed

Server/core/premake5.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ project "Core"
4949

5050
filter "system:macosx"
5151
links { "ncurses", "breakpad", "CoreFoundation.framework" }
52+
buildoptions { "-pthread" }
53+
linkoptions { "-pthread" }
5254

5355
-- This makes ncurses `get_wch` work
5456
defines { "_XOPEN_SOURCE_EXTENDED=1" }

Server/dbconmy/CDatabaseConnectionMySql.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ CDatabaseConnectionMySql::CDatabaseConnectionMySql(CDatabaseType* pManager, cons
105105
m_handle = mysql_init(NULL);
106106
if (m_handle)
107107
{
108-
my_bool reconnect = m_bAutomaticReconnect;
108+
bool reconnect = m_bAutomaticReconnect;
109109
mysql_options(m_handle, MYSQL_OPT_RECONNECT, &reconnect);
110110
if (!strCharset.empty())
111111
mysql_options(m_handle, MYSQL_SET_CHARSET_NAME, strCharset);

Server/dbconmy/premake5.lua

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,57 +3,60 @@ project "Dbconmy"
33
kind "SharedLib"
44
targetname "dbconmy"
55
targetdir(buildpath("server/mods/deathmatch"))
6-
6+
77
filter "system:windows"
8-
includedirs {
8+
includedirs {
99
"../../vendor/mysql/include",
1010
"../../vendor/sparsehash/src/windows"
1111
}
12-
12+
1313
filter {}
14-
includedirs {
15-
"../sdk",
14+
includedirs {
15+
"../sdk",
1616
"../../vendor/google-breakpad/src",
1717
"../../vendor/sparsehash/src/"
1818
}
19-
19+
2020
pchheader "StdInc.h"
2121
pchsource "StdInc.cpp"
22-
23-
vpaths {
22+
23+
vpaths {
2424
["Headers/*"] = "**.h",
2525
["Sources"] = "*.c",
2626
["*"] = "premake5.lua"
2727
}
28-
28+
2929
files {
3030
"premake5.lua",
3131
"*.h",
3232
"*.cpp"
3333
}
34-
34+
3535
filter "system:linux"
3636
includedirs { "/usr/include/mysql" }
3737
links { "rt" }
3838

39-
if GLIBC_COMPAT then
39+
filter "system:macosx"
40+
includedirs { "/usr/local/opt/mysql/include/mysql/" }
41+
42+
if GLIBC_COMPAT then
4043
filter { "system:linux" }
4144
buildoptions { "-pthread" }
4245
linkoptions { "-l:libmysqlclient.a", "-pthread" }
4346
links { "z", "dl", "m" }
44-
else
45-
filter "system:linux"
47+
else
48+
filter "system:linux or macosx"
4649
links { "mysqlclient" }
4750
filter {"system:linux", "platforms:x86"}
4851
libdirs { "/usr/lib32/mysql" }
4952
filter {"system:linux", "platforms:x64"}
5053
libdirs { "/usr/lib64/mysql" }
51-
end
52-
54+
end
55+
5356
filter { "system:windows", "platforms:x64" }
5457
links { "../../vendor/mysql/lib/x64/libmysql.lib" }
5558
filter { "system:windows", "platforms:x86" }
5659
links { "../../vendor/mysql/lib/x86/libmysql.lib" }
57-
60+
5861
filter "platforms:x64"
5962
targetdir(buildpath("server/x64"))

premake5.lua

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ require "install_cef"
77

88
-- Set CI Build global
99
local ci = os.getenv("CI")
10-
if ci and ci:lower() == "true" then
11-
CI_BUILD = true
12-
else
10+
if ci and ci:lower() == "true" then
11+
CI_BUILD = true
12+
else
1313
CI_BUILD = false
14-
end
14+
end
1515
GLIBC_COMPAT = os.getenv("GLIBC_COMPAT") == "true"
1616

1717
workspace "MTASA"
@@ -26,31 +26,31 @@ workspace "MTASA"
2626

2727
location "Build"
2828
startproject "Client Launcher"
29-
29+
3030
cppdialect "C++17"
3131
characterset "MBCS"
3232
pic "On"
3333
symbols "On"
34-
34+
3535
dxdir = os.getenv("DXSDK_DIR") or ""
36-
includedirs {
36+
includedirs {
3737
"vendor",
38-
"Shared/sdk",
38+
"Shared/sdk",
3939
}
4040

41-
defines {
41+
defines {
4242
"_CRT_SECURE_NO_WARNINGS",
4343
"_SCL_SECURE_NO_WARNINGS",
4444
"_CRT_NONSTDC_NO_DEPRECATE",
4545
"NOMINMAX",
4646
"_TIMESPEC_DEFINED"
4747
}
48-
49-
-- Helper function for output path
48+
49+
-- Helper function for output path
5050
buildpath = function(p) return "%{wks.location}/../Bin/"..p.."/" end
51-
copy = function(p) return "{COPY} %{cfg.buildtarget.abspath} \"%{wks.location}../Bin/"..p.."/\"" end
51+
copy = function(p) return "{COPY} %{cfg.buildtarget.abspath} \"%{wks.location}../Bin/"..p.."/\"" end
5252

53-
if GLIBC_COMPAT then
53+
if GLIBC_COMPAT then
5454
filter { "system:linux" }
5555
includedirs "/compat"
5656
linkoptions "-static-libstdc++ -static-libgcc"
@@ -60,53 +60,53 @@ workspace "MTASA"
6060
filter { "system:linux", "platforms:x64" }
6161
libdirs { "/compat/x64" }
6262
end
63-
63+
6464
filter "platforms:x86"
6565
architecture "x86"
6666
filter "platforms:x64"
6767
architecture "x86_64"
68-
68+
6969
filter "configurations:Debug"
7070
defines { "MTA_DEBUG" }
7171
targetsuffix "_d"
72-
72+
7373
filter "configurations:Release or configurations:Nightly"
7474
optimize "Speed" -- "On"=MS:/Ox GCC:/O2 "Speed"=MS:/O2 GCC:/O3 "Full"=MS:/Ox GCC:/O3
75-
75+
7676
if CI_BUILD then
7777
filter {}
7878
defines { "CI_BUILD=1" }
79-
79+
8080
filter { "system:linux" }
8181
linkoptions { "-s" }
82-
end
83-
82+
end
83+
8484
filter {"system:windows", "configurations:Nightly", "kind:not StaticLib"}
8585
os.mkdir("Build/Symbols")
8686
linkoptions "/PDB:\"Symbols\\$(ProjectName).pdb\""
87-
87+
8888
filter {"system:windows", "toolset:*_xp*"}
8989
buildoptions { "/Zc:threadSafeInit-" } -- Fix Windows XP not initialising TLS early
90-
90+
9191
filter "system:windows"
9292
toolset "v141"
9393
staticruntime "On"
9494
defines { "WIN32", "_WIN32" }
95-
includedirs {
95+
includedirs {
9696
path.join(dxdir, "Include")
9797
}
9898
libdirs {
9999
path.join(dxdir, "Lib/x86")
100100
}
101-
101+
102102
filter {"system:windows", "configurations:Debug"}
103103
buildoptions { "/MT" } -- Don't use debug runtime when static linking
104104
defines { "DEBUG" } -- Using DEBUG as _DEBUG is not available with /MT
105105

106106
filter "system:linux"
107107
vectorextensions "SSE2"
108108
buildoptions { "-fvisibility=hidden" }
109-
109+
110110
-- Only build the client on Windows
111111
if os.target() == "windows" then
112112
group "Client"
@@ -121,12 +121,12 @@ workspace "MTASA"
121121
include "Client/loader"
122122
include "Client/multiplayer_sa"
123123
include "Client/mods/deathmatch"
124-
124+
125125
group "Client/CEGUI"
126126
include "vendor/cegui-0.4.0-custom/src/renderers/directx9GUIRenderer"
127127
include "vendor/cegui-0.4.0-custom/WidgetSets/Falagard"
128128
include "vendor/cegui-0.4.0-custom"
129-
129+
130130
group "Vendor"
131131
include "vendor/portaudio"
132132
include "vendor/cef3"
@@ -137,7 +137,7 @@ workspace "MTASA"
137137
include "vendor/pthreads"
138138
include "vendor/libspeex"
139139
end
140-
140+
141141
filter {}
142142
group "Server"
143143
include "Server/core"
@@ -149,7 +149,7 @@ workspace "MTASA"
149149
group "Shared"
150150
include "Shared"
151151
include "Shared/XML"
152-
152+
153153
group "Vendor"
154154
include "vendor/bcrypt"
155155
include "vendor/cryptopp"

0 commit comments

Comments
 (0)