- update cmake to 3.11 for compatibility with latest cmake
- make mysql required to build, simplify linking a bit
This commit is contained in:
2
src/external/NodeEditor/CMakeLists.txt
vendored
2
src/external/NodeEditor/CMakeLists.txt
vendored
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
# version 3.4 is required as other do not work with C++14 and clang
|
||||
|
||||
project(NodeEditor CXX)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
|
||||
include(GetGitRevisionDescription)
|
||||
git_describe(GitTagVersion --tags)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
project(QtAdvancedDockingSystem LANGUAGES CXX VERSION ${VERSION_SHORT})
|
||||
find_package(Qt5 5.5 COMPONENTS Core Gui Widgets REQUIRED)
|
||||
if (UNIX AND NOT APPLE)
|
||||
|
||||
2
src/external/libnoise/CMakeLists.txt
vendored
2
src/external/libnoise/CMakeLists.txt
vendored
@@ -1,6 +1,6 @@
|
||||
# http://www.linux-magazin.de/Heft-Abo/Ausgaben/2007/02/Mal-ausspannen
|
||||
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
|
||||
set ( LIBNOISE_VERSION "1.0.0-cmake" )
|
||||
|
||||
|
||||
7
src/external/qt-color-widgets/CMakeLists.txt
vendored
7
src/external/qt-color-widgets/CMakeLists.txt
vendored
@@ -32,7 +32,7 @@ src/color_preview.cpp
|
||||
src/color_selector.cpp
|
||||
src/color_utils.cpp
|
||||
src/color_wheel.cpp
|
||||
src/color_widgets.qrc
|
||||
# src/color_widgets.qrc
|
||||
src/gradient_slider.cpp
|
||||
src/hue_slider.cpp
|
||||
src/swatch.cpp
|
||||
@@ -59,10 +59,11 @@ qt-color-widgets/swatch.hpp
|
||||
|
||||
qt5_wrap_cpp(SOURCES ${HEADERS})
|
||||
qt5_wrap_ui(SOURCES src/color_dialog.ui src/color_palette_widget.ui)
|
||||
qt5_add_resources(SOURCES src/color_widgets.qrc)
|
||||
# qt5_add_resources(SOURCES src/color_widgets.qrc)
|
||||
qt5_add_resources(QRC_SOURCES src/color_widgets.qrc)
|
||||
|
||||
# Library
|
||||
add_library(ColorWidgets-qt5 ${SOURCES})
|
||||
add_library(ColorWidgets-qt5 ${SOURCES} ${QRC_SOURCES})
|
||||
target_link_libraries(ColorWidgets-qt5 Qt5::Widgets)
|
||||
target_include_directories (ColorWidgets-qt5 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_include_directories (ColorWidgets-qt5 PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
2
src/external/rapidfuzz-cpp/CMakeLists.txt
vendored
2
src/external/rapidfuzz-cpp/CMakeLists.txt
vendored
@@ -1,5 +1,5 @@
|
||||
# Cmake config largely taken from catch2
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
|
||||
cmake_policy(SET CMP0135 NEW)
|
||||
|
||||
@@ -5,50 +5,54 @@
|
||||
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
#include <driver.h>
|
||||
#include <prepared_statement.h>
|
||||
// #include <cppconn/driver.h>
|
||||
// #include <cppconn/prepared_statement.h>
|
||||
#include <cppconn/driver.h>
|
||||
#include <cppconn/prepared_statement.h>
|
||||
#include <cppconn/exception.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
std::unique_ptr<sql::Connection> connect()
|
||||
{
|
||||
QSettings settings;
|
||||
QSettings settings;
|
||||
|
||||
// if using release SQL binaries in debug mode it will crash https://bugs.mysql.com/bug.php?id=91238 unless using sql strings
|
||||
// tcp://127.0.0.1:3306
|
||||
sql::SQLString hostname = "tcp://" + settings.value("project/mysql/server").toString().toStdString() + ":" + settings.value("project/mysql/port", "3306").toString().toStdString();
|
||||
sql::SQLString userName = settings.value("project/mysql/user").toString().toStdString();
|
||||
sql::SQLString password = settings.value("project/mysql/pwd").toString().toStdString();
|
||||
sql::SQLString schema = settings.value("project/mysql/db").toString().toStdString();
|
||||
// if using release SQL binaries in debug mode it will crash https://bugs.mysql.com/bug.php?id=91238 unless using sql strings
|
||||
// tcp://127.0.0.1:3306
|
||||
const sql::SQLString hostname = "tcp://" + settings.value("project/mysql/server").toString().toStdString() + ":" + settings.value("project/mysql/port", "3306").toString().toStdString();
|
||||
const sql::SQLString userName = settings.value("project/mysql/user").toString().toStdString();
|
||||
const sql::SQLString password = settings.value("project/mysql/pwd").toString().toStdString();
|
||||
const sql::SQLString schema = settings.value("project/mysql/db").toString().toStdString();
|
||||
|
||||
try
|
||||
{
|
||||
std::unique_ptr<sql::Connection> Con(get_driver_instance()->connect(hostname, userName, password));
|
||||
try
|
||||
{
|
||||
std::unique_ptr<sql::Connection> Con(get_driver_instance()->connect(hostname, userName, password));
|
||||
|
||||
// crete database if it doesn't exist
|
||||
std::string createdb_statement = "CREATE DATABASE IF NOT EXISTS " + schema;
|
||||
std::unique_ptr<sql::PreparedStatement> dbpstmt(Con->prepareStatement(createdb_statement));
|
||||
std::unique_ptr<sql::ResultSet> res(dbpstmt->executeQuery());
|
||||
|
||||
Con->setSchema(schema);
|
||||
// crete database if it doesn't exist
|
||||
std::string createdb_statement = "CREATE DATABASE IF NOT EXISTS " + schema;
|
||||
std::unique_ptr<sql::PreparedStatement> dbpstmt(Con->prepareStatement(createdb_statement));
|
||||
std::unique_ptr<sql::ResultSet> res(dbpstmt->executeQuery());
|
||||
|
||||
Con->setSchema(schema);
|
||||
|
||||
// create table if it doesn't exist, querries from src/sql
|
||||
std::unique_ptr<sql::PreparedStatement> tablepstmt(Con->prepareStatement("CREATE TABLE IF NOT EXISTS `UIDs` ("
|
||||
"`_map_id` int(11) NOT NULL,"
|
||||
"`UID` int(11) NOT NULL,"
|
||||
"PRIMARY KEY(`_map_id`)"
|
||||
") ENGINE = InnoDB DEFAULT CHARSET = latin1;"));
|
||||
std::unique_ptr<sql::ResultSet> tableres(tablepstmt->executeQuery());
|
||||
// create table if it doesn't exist, querries from src/sql
|
||||
std::unique_ptr<sql::PreparedStatement> tablepstmt(Con->prepareStatement("CREATE TABLE IF NOT EXISTS `UIDs` ("
|
||||
"`_map_id` int(11) NOT NULL,"
|
||||
"`UID` int(11) NOT NULL,"
|
||||
"PRIMARY KEY(`_map_id`)"
|
||||
") ENGINE = InnoDB DEFAULT CHARSET = latin1;"));
|
||||
std::unique_ptr<sql::ResultSet> tableres(tablepstmt->executeQuery());
|
||||
|
||||
return Con;
|
||||
}
|
||||
catch (sql::SQLException& e)
|
||||
{
|
||||
return Con;
|
||||
}
|
||||
catch (sql::SQLException& e)
|
||||
{
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
std::cerr << "SQL Other exception: " << e.what() << std::endl;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,17 +62,17 @@ namespace mysql
|
||||
{
|
||||
QSettings settings;
|
||||
// if using release SQL binaries in debug mode it will crash https://bugs.mysql.com/bug.php?id=91238 unless using sql strings
|
||||
sql::SQLString hostname = "tcp://" + settings.value("project/mysql/server").toString().toStdString() + ":" + settings.value("project/mysql/port", "3306").toString().toStdString();
|
||||
sql::SQLString userName = settings.value("project/mysql/user").toString().toStdString();
|
||||
sql::SQLString password = settings.value("project/mysql/pwd").toString().toStdString();
|
||||
sql::SQLString schema = settings.value("project/mysql/db").toString().toStdString();
|
||||
|
||||
const sql::SQLString hostname = "tcp://" + settings.value("project/mysql/server").toString().toStdString() + ":" + settings.value("project/mysql/port", "3306").toString().toStdString();
|
||||
const sql::SQLString userName = settings.value("project/mysql/user").toString().toStdString();
|
||||
const sql::SQLString password = settings.value("project/mysql/pwd").toString().toStdString();
|
||||
|
||||
QMessageBox prompt;
|
||||
prompt.setWindowFlag(Qt::WindowStaysOnTopHint);
|
||||
try
|
||||
{
|
||||
std::unique_ptr<sql::Connection> Con(get_driver_instance()->connect(hostname, userName, password));
|
||||
sql::Driver* driver = get_driver_instance();
|
||||
sql::Connection* connection = driver->connect(hostname, userName, password);
|
||||
std::unique_ptr<sql::Connection> Con(connection);
|
||||
|
||||
prompt.setIcon(QMessageBox::Information);
|
||||
prompt.setText("Succesfully connected to MySQL database.");
|
||||
@@ -97,6 +101,11 @@ namespace mysql
|
||||
|
||||
return false;
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
std::cerr << "SQL Other exception: " << e.what() << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool hasMaxUIDStoredDB(std::size_t mapID)
|
||||
|
||||
Reference in New Issue
Block a user