dev-osrose/osIROSE-new

Add support for MariaDB on windows

Closed this issue · 0 comments

Is your feature request related to a problem? Please describe.
On windows, currently the server only supports MySQL and does not directly support MariaDB. Since MariaDB is compatible with MySQL it should be easy enough to substitute one for the other, however the build system only supports MySQL paths so it is not possible to do this without using additional CMake flags to manually specify the MariaDB paths.

On linux, MariaDB is automatically detected since it uses the same paths as MySQL.

Describe the solution you'd like
Ideally it would be great to update the CMake scripts to search for MariaDB in addition to MySQL as they are interchangeable (for the most part).

Additional context
On linux, no change is required. On windows the FindMYSQL.cmake file needs to be updated or a similar one needs to created to search in these paths:

  • C:\Program Files\MariaDB 10.3\lib
  • C:\Program Files\MariaDB 10.3\include\mysql
  • C:\Program Files\MariaDB\MariaDB Connector C 64-bit\include
  • C:\Program Files\MariaDB\MariaDB Connector C 64-bit\lib

Workarounds
For now MariaDB should be able to beused on windows by setting the following flags:

  • -DMYSQL_LIBRARY
  • -DMYSQL_LIBRARY_PATH
  • -DMYSQL_INCLUDE_DIR

Example:

cmake -G "Ninja" .. -DMYSQL_INCLUDE_DIR="C:\Program Files\MariaDB 10.3\include\mysql" -DMYSQL_LIBRARY_PATH="C:\Program Files\MariaDB 10.3\lib" -DMYSQL_LIBRARY="C:\Program Files\MariaDB 10.3\lib\libmariadb.lib" 

Except these flags don't get set correctly later and the build will fail when compiling sqlpp11:

[280/571] Performing configure step for 'sqlpp11-connector-mysql'
FAILED: sqlpp11-connector-mysql-prefix/src/sqlpp11-connector-mysql-stamp/sqlpp11-connector-mysql-configure
cmd.exe /C "cd /D C:\dev\osIROSE-new\build\sqlpp11-connector-mysql-prefix\src\sqlpp11-connector-mysql-build && "C:\Program Files\CMake\bin\cmake.exe" -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=C:/dev/osIROSE-new/build/3rdparty -DCMAKE_MODULE_PATH=C:/dev/osIROSE-new/cmake/modules -DSQLPP11_INCLUDE_DIR=C:/dev/osIROSE-new/build/3rdparty/include -DDATE_INCLUDE_DIR=C:/dev/osIROSE-new/build/3rdparty/include -DENABLE_TESTS=OFF -GNinja C:/dev/osIROSE-new/build/sqlpp11-connector-mysql-prefix/src/sqlpp11-connector-mysql && "C:\Program Files\CMake\bin\cmake.exe" -E touch C:/dev/osIROSE-new/build/sqlpp11-connector-mysql-prefix/src/sqlpp11-connector-mysql-stamp/sqlpp11-connector-mysql-configure"
-- The C compiler identification is MSVC 19.16.27032.1
-- The CXX compiler identification is MSVC 19.16.27032.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- MySQL Library: MYSQL_LIBRARY-NOTFOUND
-- MySQL Library Path: MYSQL_LIBRARY_PATH-NOTFOUND
-- MySQL Include Path: MYSQL_INCLUDE_DIR-NOTFOUND
-- Could NOT find MYSQL (missing: MYSQL_LIBRARY MYSQL_LIBRARY_PATH MYSQL_INCLUDE_DIR)
-- Using C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe (compiler id: MSVC)
including date from C:/dev/osIROSE-new/build/3rdparty/include
including sqlpp11 from C:/dev/osIROSE-new/build/3rdparty/include
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
MYSQL_INCLUDE_DIR (ADVANCED)
   used as include directory in directory C:/dev/osIROSE-new/build/sqlpp11-connector-mysql-prefix/src/sqlpp11-connector-mysql
   used as include directory in directory C:/dev/osIROSE-new/build/sqlpp11-connector-mysql-prefix/src/sqlpp11-connector-mysql
   used as include directory in directory C:/dev/osIROSE-new/build/sqlpp11-connector-mysql-prefix/src/sqlpp11-connector-mysql
   used as include directory in directory C:/dev/osIROSE-new/build/sqlpp11-connector-mysql-prefix/src/sqlpp11-connector-mysql
   used as include directory in directory C:/dev/osIROSE-new/build/sqlpp11-connector-mysql-prefix/src/sqlpp11-connector-mysql
   used as include directory in directory C:/dev/osIROSE-new/build/sqlpp11-connector-mysql-prefix/src/sqlpp11-connector-mysql
   used as include directory in directory C:/dev/osIROSE-new/build/sqlpp11-connector-mysql-prefix/src/sqlpp11-connector-mysql/src
   used as include directory in directory C:/dev/osIROSE-new/build/sqlpp11-connector-mysql-prefix/src/sqlpp11-connector-mysql/src
   used as include directory in directory C:/dev/osIROSE-new/build/sqlpp11-connector-mysql-prefix/src/sqlpp11-connector-mysql/src
   used as include directory in directory C:/dev/osIROSE-new/build/sqlpp11-connector-mysql-prefix/src/sqlpp11-connector-mysql/src
   used as include directory in directory C:/dev/osIROSE-new/build/sqlpp11-connector-mysql-prefix/src/sqlpp11-connector-mysql/src
   used as include directory in directory C:/dev/osIROSE-new/build/sqlpp11-connector-mysql-prefix/src/sqlpp11-connector-mysql/src
   used as include directory in directory C:/dev/osIROSE-new/build/sqlpp11-connector-mysql-prefix/src/sqlpp11-connector-mysql/src

-- Configuring incomplete, errors occurred!
See also "C:/dev/osIROSE-new/build/sqlpp11-connector-mysql-prefix/src/sqlpp11-connector-mysql-build/CMakeFiles/CMakeOutput.log".
See also "C:/dev/osIROSE-new/build/sqlpp11-connector-mysql-prefix/src/sqlpp11-connector-mysql-build/CMakeFiles/CMakeError.log".
[281/571] Performing build step for 'sqlpp11-connector-sqlite3'
[1/5] Building CXX object src\CMakeFiles\sqlpp11-connector-sqlite3.dir\detail\connection_handle.cpp.obj
[2/5] Building CXX object src\CMakeFiles\sqlpp11-connector-sqlite3.dir\bind_result.cpp.obj
[3/5] Building CXX object src\CMakeFiles\sqlpp11-connector-sqlite3.dir\prepared_statement.cpp.obj
[4/5] Building CXX object src\CMakeFiles\sqlpp11-connector-sqlite3.dir\connection.cpp.obj
[5/5] Linking CXX static library src\sqlpp11-connector-sqlite3.lib
ninja: build stopped: subcommand failed.