Add mariadbpp as a submodule.

This has been added as a submodule for convenience of use, since mariadbpp isn't included in any repositories (linux distros, vcpkg, etc) aside from an Arch AUR.
This commit is contained in:
pentarctagon 2020-07-23 16:56:21 -05:00 committed by Pentarctagon
parent 388e4c00d9
commit 7f9eebdf49
6 changed files with 29 additions and 10 deletions

1
.gitignore vendored
View File

@ -216,3 +216,4 @@ config.h
.kdev*
callgrind.out.*
data/dist
clean.sh

4
.gitmodules vendored Normal file
View File

@ -0,0 +1,4 @@
[submodule "src/modules/mariadbpp"]
path = src/modules/mariadbpp
url = https://github.com/viaduck/mariadbpp.git
ignore = untracked

View File

@ -429,7 +429,7 @@ if env["prereqs"]:
for sql_config in ["mariadb_config", "mysql_config"]:
try:
mysql_config = check_output([sql_config, "--libs", "--cflags"]).decode("utf-8").replace("\n", " ").replace("-DNDEBUG", "")
mysql_flags = env.ParseFlags(mysql_config)
mysql_flags = env.ParseFlags(mysql_config+"-Imodules/mariadbpp/include/")
env.Append(CPPDEFINES = ["HAVE_MYSQLPP"])
env.MergeFlags(mysql_flags)
found_connector = True

View File

@ -12,7 +12,7 @@ if(ENABLE_MYSQL)
string(REGEX REPLACE "-I" "" MYSQL_CFLAGS "${MYSQL_CFLAGS}")
string(REGEX REPLACE "-DNDEBUG" "" MYSQL_CFLAGS "${MYSQL_CFLAGS}")
execute_process(COMMAND mysql_config --libs OUTPUT_VARIABLE MYSQL_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
find_package(mariadbclientpp)
add_subdirectory("modules/mariadbpp/")
endif(ENABLE_MYSQL)
## some includes ##
@ -344,7 +344,7 @@ if(ENABLE_SERVER)
if(ENABLE_MYSQL)
target_include_directories(wesnothd SYSTEM PRIVATE ${MYSQL_CFLAGS})
target_compile_definitions(wesnothd PRIVATE HAVE_MYSQLPP)
target_link_libraries(wesnothd mariadbclientpp::mariadbclientpp)
target_link_libraries(wesnothd mariadbclientpp)
endif(ENABLE_MYSQL)
target_link_libraries(wesnothd
@ -368,7 +368,7 @@ if(ENABLE_CAMPAIGN_SERVER)
if(ENABLE_MYSQL)
target_include_directories(campaignd SYSTEM PRIVATE ${MYSQL_CFLAGS})
target_compile_definitions(campaignd PRIVATE HAVE_MYSQLPP)
target_link_libraries(wesnothd mariadbclientpp::mariadbclientpp)
target_link_libraries(wesnothd mariadbclientpp)
endif(ENABLE_MYSQL)
target_link_libraries(campaignd

View File

@ -7,13 +7,22 @@ from glob import glob
Import("*")
#
# load list of sources from the file in source_lists/
# load list of sources from the file in source_lists/ or from a submodule
#
def GetSources(filename):
def GetSources(src_location):
sources = []
with open(File("#/source_lists/" + filename).rfile().abspath) as file:
for line in file.readlines():
sources.append(line.strip())
source_list = File("#/source_lists/" + src_location)
module_dir = Dir("#/src/modules/"+src_location+"/src/")
if source_list.exists():
with open(source_list.rfile().abspath) as file:
for line in file.readlines():
sources.append(line.strip())
elif module_dir.exists():
for cpp in module_dir.glob("*.cpp", strings=True):
sources.append("modules/"+src_location+"/src/"+cpp)
else:
print("Unable to find source files for: "+src_location)
return sources
#
@ -126,6 +135,10 @@ for obj in objs_lua:
liblua = env_lua.Library("lua", objs_lua)
#---mariadbpp submodule---
mariadbpp_sources = GetSources("mariadbpp")
libmariadbpp = env.Library("mariadbpp", mariadbpp_sources)
#
# Target declarations
#
@ -176,7 +189,7 @@ wesnothd_sources = GetSources("wesnothd")
if env["PLATFORM"] == 'win32':
env.WesnothProgram("wesnothd", wesnothd_sources + libwesnoth_core + env["wesnothd_res"], have_server_prereqs)
elif env["forum_user_handler"]:
env.WesnothProgram("wesnothd", wesnothd_sources + libwesnoth_core + ["/usr/local/lib/libmariadbclientpp.a"], have_server_prereqs)
env.WesnothProgram("wesnothd", wesnothd_sources + libwesnoth_core + libmariadbpp, have_server_prereqs)
else:
env.WesnothProgram("wesnothd", wesnothd_sources + libwesnoth_core, have_server_prereqs)

1
src/modules/mariadbpp Submodule

@ -0,0 +1 @@
Subproject commit 114d7ea8cc871252fd6609fd12522cdcfa632f79