From 4819f7be4dbe05c0f7a104e082524f27f32845e3 Mon Sep 17 00:00:00 2001 From: iyanma Date: Wed, 15 Jul 2026 19:48:49 +0200 Subject: [PATCH 1/2] fix: pass the path to the function --- src/db.c | 2 +- src/db.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/db.c b/src/db.c index cd883a858..9ff5eaa48 100644 --- a/src/db.c +++ b/src/db.c @@ -146,7 +146,7 @@ int db_init(char *path) { rc = sqlite3_prepare_v2(db, set_key_query, -1, &set_key_stmt, NULL); if (rc) return rc; sqlite3_exec(db, "begin;", NULL, NULL, NULL); - db_worker_start(); + db_worker_start(path); return 0; } diff --git a/src/db.h b/src/db.h index 0d1c3ce98..25c8373f0 100644 --- a/src/db.h +++ b/src/db.h @@ -33,7 +33,7 @@ void db_load_lights(Map *map, int p, int q); void db_load_signs(SignList *list, int p, int q); int db_get_key(int p, int q); void db_set_key(int p, int q, int key); -void db_worker_start(); +void db_worker_start(char *path); void db_worker_stop(); int db_worker_run(void *arg); From 313fc8f884cbe221a0057e6c1528ec1b30778bfb Mon Sep 17 00:00:00 2001 From: iyanma Date: Wed, 15 Jul 2026 19:49:16 +0200 Subject: [PATCH 2/2] fix: update CMake files to work with modern versions --- CMakeLists.txt | 86 ++++++++++++++++++++++++++-------------- deps/glfw/CMakeLists.txt | 23 ++++++----- 2 files changed, 69 insertions(+), 40 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 851ae3ad7..8bad8712c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,49 +1,75 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.5) -project(craft) +project(craft C) -FILE(GLOB SOURCE_FILES src/*.c) +file(GLOB SOURCE_FILES CONFIGURE_DEPENDS src/*.c) -add_executable( - craft +add_executable(craft ${SOURCE_FILES} deps/glew/src/glew.c deps/lodepng/lodepng.c deps/noise/noise.c deps/sqlite/sqlite3.c - deps/tinycthread/tinycthread.c) + deps/tinycthread/tinycthread.c +) -add_definitions(-std=c99 -O3) +set(CMAKE_C_STANDARD 99) +set(CMAKE_C_STANDARD_REQUIRED ON) + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() + +add_compile_options(-O3) add_subdirectory(deps/glfw) -include_directories(deps/glew/include) -include_directories(deps/glfw/include) -include_directories(deps/lodepng) -include_directories(deps/noise) -include_directories(deps/sqlite) -include_directories(deps/tinycthread) + +include_directories( + deps/glew/include + deps/glfw/include + deps/lodepng + deps/noise + deps/sqlite + deps/tinycthread +) if(MINGW) - set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} - "C:/Program Files/CURL/lib" "C:/Program Files (x86)/CURL/lib") - set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} - "C:/Program Files/CURL/include" "C:/Program Files (x86)/CURL/include") + list(APPEND CMAKE_LIBRARY_PATH + "C:/Program Files/CURL/lib" + "C:/Program Files (x86)/CURL/lib" + ) + list(APPEND CMAKE_INCLUDE_PATH + "C:/Program Files/CURL/include" + "C:/Program Files (x86)/CURL/include" + ) endif() find_package(CURL REQUIRED) -include_directories(${CURL_INCLUDE_DIR}) - -if(APPLE) - target_link_libraries(craft glfw - ${GLFW_LIBRARIES} ${CURL_LIBRARIES}) -endif() +include_directories(${CURL_INCLUDE_DIRS}) -if(UNIX) - target_link_libraries(craft dl glfw - ${GLFW_LIBRARIES} ${CURL_LIBRARIES}) -endif() +find_package(OpenGL REQUIRED) +set(OpenGL_GL_PREFERENCE "LEGACY") -if(MINGW) - target_link_libraries(craft ws2_32.lib glfw - ${GLFW_LIBRARIES} ${CURL_LIBRARIES}) +if(APPLE) + target_link_libraries(craft + glfw + OpenGL::GL + ${GLFW_LIBRARIES} + ${CURL_LIBRARIES} + ) +elseif(UNIX) + target_link_libraries(craft + dl + glfw + OpenGL::GL + ${GLFW_LIBRARIES} + ${CURL_LIBRARIES} + ) +elseif(MINGW) + target_link_libraries(craft + ws2_32 + glfw + ${GLFW_LIBRARIES} + ${CURL_LIBRARIES} + ) endif() diff --git a/deps/glfw/CMakeLists.txt b/deps/glfw/CMakeLists.txt index 8f0d66509..4925103d1 100644 --- a/deps/glfw/CMakeLists.txt +++ b/deps/glfw/CMakeLists.txt @@ -1,11 +1,14 @@ +cmake_minimum_required(VERSION 3.10) + project(GLFW C) -cmake_minimum_required(VERSION 2.8.12) +# Modern CMake policy compatibility +if(POLICY CMP0042) + cmake_policy(SET CMP0042 NEW) +endif() -if (NOT CMAKE_VERSION VERSION_LESS "3.0") - # Until all major package systems have moved to CMake 3, - # we stick with the older INSTALL_NAME_DIR mechanism - cmake_policy(SET CMP0042 OLD) +if(POLICY CMP0072) + cmake_policy(SET CMP0072 NEW) endif() set(GLFW_VERSION_MAJOR "3") @@ -19,9 +22,9 @@ set(LIB_SUFFIX "" CACHE STRING "Takes an empty string or 64. Directory where lib set_property(GLOBAL PROPERTY USE_FOLDERS ON) option(BUILD_SHARED_LIBS "Build shared libraries" OFF) -option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ON) -option(GLFW_BUILD_TESTS "Build the GLFW test programs" ON) -option(GLFW_BUILD_DOCS "Build the GLFW documentation" ON) +option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF) +option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF) +option(GLFW_BUILD_DOCS "Build the GLFW documentation" OFF) option(GLFW_INSTALL "Generate installation target" ON) option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF) @@ -85,6 +88,7 @@ else() endif() if (_GLFW_USE_OPENGL) + set(OpenGL_GL_PREFERENCE GLVND) find_package(OpenGL REQUIRED) elseif (_GLFW_USE_GLESV1) find_package(GLESv1 REQUIRED) @@ -490,7 +494,7 @@ configure_package_config_file("${GLFW_SOURCE_DIR}/src/glfw3Config.cmake.in" PATH_VARS CMAKE_INSTALL_PREFIX NO_CHECK_REQUIRED_COMPONENTS_MACRO) -write_basic_package_version_file("${GLFW_BINARY_DIR}/src/glfw3ConfigVersion.cmake" +write_basic_package_version_file("${GLFW_BINARY_DIR}/src/glfw3ConfigVersion.cmake" VERSION ${GLFW_VERSION_FULL} COMPATIBILITY SameMajorVersion) @@ -548,4 +552,3 @@ if (GLFW_INSTALL) "${GLFW_BINARY_DIR}/cmake_uninstall.cmake") endif() endif() -