Skip to content

Commit

Permalink
Merge pull request #4601 from LandSandBoat/update_mariadb_win_libs
Browse files Browse the repository at this point in the history
[core, SQL] Refactor to use mariadb-connector-cpp and introduce new db namespace
  • Loading branch information
zach2good authored Apr 1, 2024
2 parents 8c1d4f5 + 4b71970 commit 3af99f7
Show file tree
Hide file tree
Showing 147 changed files with 6,609 additions and 3,619 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -277,30 +277,6 @@ jobs:
run: |
cmake --build build -j4
Windows_32bit:
needs: Sanity_Checks
runs-on: windows-latest
env:
MSBUILD_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Cache 'build' folder
uses: actions/cache@v3
with:
path: build
key: ${{ runner.os }}-msvc32
- name: Configure CMake
shell: cmd
run: |
mkdir -p build
cmake -S . -B build -A Win32
- name: Build
shell: cmd
run: |
cmake --build build -j4
Windows_64bit_Debug:
needs: Sanity_Checks
runs-on: windows-latest
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@

# Build results
build/
build*/
lbuild/
build_mariadb_32/
build_mariadb_64/
out/
[Dd]ebug/
[Rr]elease/
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@
"*.ipp": "cpp",
"ranges": "cpp",
"span": "cpp",
"expected": "cpp"
"expected": "cpp",
"string_view": "cpp"
},
}
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ link_libraries(${CMAKE_THREAD_LIBS_INIT})

# Find MariaDB
find_package(MariaDB REQUIRED)
find_package(MariaDBCPP REQUIRED)

# Find ZMQ
find_package(ZeroMQ REQUIRED)
Expand Down
24 changes: 0 additions & 24 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,30 +47,6 @@
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": []
},
{
"name": "x86-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\build\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x86" ],
"variables": []
},
{
"name": "x86-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\build\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x86" ],
"variables": []
}
]
}
34 changes: 31 additions & 3 deletions cmake/FindMariaDB.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
if(WIN32)
# How to build MariaDB Libs:
#
# <Clear your cache>
# It's easier to do this in two fresh build folders, so create build_mariadb_32 and build_mariadb_64 folders
# in your project root
#
# cd to build_mariadb_32
#
# cmake -A Win32 -DCMAKE_BUILD_TYPE=Release -DBUILD_MARIADB_FROM_SOURCE=ON ..
# cmake --build . --config Release --target libmariadb
# cmake --build . --config Release --target copy_mariadb_dll_to_ext
#
# <Clear your cache>
# cd to build_mariadb_64
#
# cmake -A x64 -DCMAKE_BUILD_TYPE=Release -DBUILD_MARIADB_FROM_SOURCE=ON ..
# cmake --build . --config Release --target libmariadb
Expand All @@ -16,13 +19,38 @@ if(WIN32)
# Remove any non-".h" files from the include folder
#
# Use tools/rename_dll.py to properly rename the x64 dll and lib to libmariadb64.lib/.dll
# From repo root in a vsvars/MSVC developer command prompt:
# .\tools\rename_dll.py .\ext\mariadb\lib64\libmariadb.dll libmariadb64.dll x64
# Rename libmariadb.dll to libmariadb64.dll (the previous step only handles the .lib)
#
# Move the x86 and x64 dlls into the repo root
#
# TEST AND MAKE SURE THAT EVERYTHING STILL WORKS!
#
# You can now delete build_mariadb_32 and build_mariadb_64

if(BUILD_MARIADB_FROM_SOURCE)
message(STATUS "BUILDING MARIADB FROM SOURCE!")

add_definitions(-DBUILD_STATIC_CURL)
CPMAddPackage(
NAME curl
GITHUB_REPOSITORY curl/curl
GIT_TAG 1f7d8cd478f024bc16cad204a9b62feb6e92a0c5
)

add_definitions(-DZSTD_BUILD_STATIC)
CPMAddPackage(
NAME ZSTD
GITHUB_REPOSITORY facebook/zstd
GIT_TAG c692b8d12d08eb3e460f99b43a7568ebbcb27acb
SOURCE_SUBDIR build/cmake
OPTIONS
"ZSTD_LEGACY_SUPPORT OFF"
)
link_libraries(libzstd_static)

message(STATUS "Adding mariadb")
CPMAddPackage(
NAME mariadb
GITHUB_REPOSITORY mariadb-corporation/mariadb-connector-c
Expand Down Expand Up @@ -57,7 +85,7 @@ endif()

find_library(MARIADB_LIBRARY
NAMES
libmariadb mariadb libmysql mysql libmariadb64 mariadb64 libmysql64 mysql64
libmariadb64 mariadb64 libmysql64 mysql64 libmariadb mariadb libmysql mysql
PATHS
${PROJECT_SOURCE_DIR}/ext/mariadb/${lib_dir}/
/usr/
Expand Down
Loading

0 comments on commit 3af99f7

Please sign in to comment.