From af326d1bc29c2bcc88a4136970e04ed30affa156 Mon Sep 17 00:00:00 2001 From: dwg Date: Tue, 16 Sep 2025 19:30:11 +0200 Subject: [PATCH 1/2] Fix gitignore --- .gitignore | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index 3da0df71..c9eba60a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,4 @@ -/** -!/bin/** -!/cmake/** -!/etc/** -!/include/** -!/media/** -!/resources/** -!/sql/** -!/src/** -!/test/** -!/.idea/** -!.gitignore -!.CMakeLists.txt -!COPYING -!Doxyfile -!README.md -!todo_1.4.md -!uid_fix_concept.md + +/out +/bin +/build From f8b98f3b6c250317bebb667015c3d3c719611694 Mon Sep 17 00:00:00 2001 From: dwg Date: Tue, 16 Sep 2025 20:03:36 +0200 Subject: [PATCH 2/2] Make configuring the build more straight-forward by allowing the user to just specify the base path to the mysql libraries. These two new cmake variables where added: MYSQL_ROOT - Points to something like "C:\Program Files\MySQL\MySQL Server 8.0" MYSQLCPPCONN_ROOT - Points to something like "C:\Program Files\MySQL\mysql-connector-c++-8.1.0-winx64" This will also make copying the required dlls easier, but that's outside the scope of this commit --- .gitignore | 3 +++ CMakeLists.txt | 20 ++++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index c9eba60a..57a29c1f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ /out /bin /build +/.vs +/CMakePresets.json +/CMakeUserPresets.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 96a6d69a..455c0c89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,13 +117,25 @@ FetchContent_MakeAvailable(FastNoise2) FIND_PACKAGE(Sol2 REQUIRED) FIND_PACKAGE(Qt5 COMPONENTS Widgets OpenGLExtensions Gui Network Xml Multimedia REQUIRED) +set(MYSQL_HINTS "${CMAKE_SOURCE_DIR}/../Noggit3libs/mysql") +if(MYSQL_ROOT) + set(MYSQL_HINTS "${MYSQL_ROOT}/lib" "${MYSQL_HINTS}") +endif() + +set(MYSQLCPPCONN_HINTS "${CMAKE_SOURCE_DIR}/../Noggit3libs/mysql/connector") +set(MYSQLCPPCONN_INCLUDE_HINTS "${CMAKE_SOURCE_DIR}/../Noggit3libs/mysql/connector") +if(MYSQLCPPCONN_ROOT) + set(MYSQLCPPCONN_HINTS "${MYSQLCPPCONN_ROOT}/lib64/vs14/debug" "${MYSQLCPPCONN_HINTS}") + set(MYSQLCPPCONN_INCLUDE_HINTS "${MYSQLCPPCONN_ROOT}/include/jdbc" "${MYSQLCPPCONN_INCLUDE_HINTS}") +endif() + # IF(USE_SQL) FIND_LIBRARY(MYSQL_LIBRARY NAMES libmysql - HINTS "${CMAKE_SOURCE_DIR}/../Noggit3libs/mysql") + HINTS "${MYSQL_HINTS}") FIND_LIBRARY(MYSQLCPPCONN_LIBRARY NAMES mysqlcppconn - HINTS "${CMAKE_SOURCE_DIR}/../Noggit3libs/mysql/connector") + HINTS "${MYSQLCPPCONN_HINTS}") FIND_PATH(MYSQLCPPCONN_INCLUDE NAMES cppconn/driver.h - HINTS "${CMAKE_SOURCE_DIR}/../Noggit3libs/mysql/connector") + HINTS "${MYSQLCPPCONN_INCLUDE_HINTS}") # Ensure we always include the parent of 'cppconn' folder if(EXISTS "${MYSQLCPPCONN_INCLUDE}/cppconn") @@ -138,7 +150,7 @@ FIND_PACKAGE(Qt5 COMPONENTS Widgets OpenGLExtensions Gui Network Xml Multimedia SET (mysql_headers src/mysql/mysql.h) SOURCE_GROUP("mysql" FILES ${mysql_sources} ${mysql_headers}) ELSE() - MESSAGE(FATAL_ERROR "MySQL lib or connector not found") + MESSAGE(FATAL_ERROR "MySQL lib or connector not found ${MYSQL_LIBRARY} ${MYSQLCPPCONN_LIBRARY} ${MYSQLCPPCONN_INCLUDE}") ENDIF() # ENDIF()