From dcb30a593dafed89ef52e712533b0706bddbd36e Mon Sep 17 00:00:00 2001 From: sfan5 Date: Fri, 5 Mar 2021 16:11:55 +0100 Subject: Set ENABLE_SYSTEM_JSONCPP to TRUE by default --- cmake/Modules/FindGMP.cmake | 2 -- cmake/Modules/FindJson.cmake | 23 +++++++++++------------ 2 files changed, 11 insertions(+), 14 deletions(-) (limited to 'cmake/Modules') diff --git a/cmake/Modules/FindGMP.cmake b/cmake/Modules/FindGMP.cmake index 7b45f16c7..190b7c548 100644 --- a/cmake/Modules/FindGMP.cmake +++ b/cmake/Modules/FindGMP.cmake @@ -12,8 +12,6 @@ if(ENABLE_SYSTEM_GMP) else() message (STATUS "Detecting GMP from system failed.") endif() -else() - message (STATUS "Detecting GMP from system disabled! (ENABLE_SYSTEM_GMP=0)") endif() if(NOT USE_SYSTEM_GMP) diff --git a/cmake/Modules/FindJson.cmake b/cmake/Modules/FindJson.cmake index a5e9098f8..cce2d387f 100644 --- a/cmake/Modules/FindJson.cmake +++ b/cmake/Modules/FindJson.cmake @@ -1,26 +1,25 @@ -# Look for JSONCPP if asked to. -# We use a bundled version by default because some distros ship versions of -# JSONCPP that cause segfaults and other memory errors when we link with them. -# See https://github.com/minetest/minetest/issues/1793 +# Look for JsonCpp, with fallback to bundeled version mark_as_advanced(JSON_LIBRARY JSON_INCLUDE_DIR) -option(ENABLE_SYSTEM_JSONCPP "Enable using a system-wide JSONCPP. May cause segfaults and other memory errors!" FALSE) +option(ENABLE_SYSTEM_JSONCPP "Enable using a system-wide JsonCpp" TRUE) +set(USE_SYSTEM_JSONCPP FALSE) if(ENABLE_SYSTEM_JSONCPP) find_library(JSON_LIBRARY NAMES jsoncpp) find_path(JSON_INCLUDE_DIR json/allocator.h PATH_SUFFIXES jsoncpp) - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Json DEFAULT_MSG JSON_LIBRARY JSON_INCLUDE_DIR) - - if(JSON_FOUND) - message(STATUS "Using system JSONCPP library.") + if(JSON_LIBRARY AND JSON_INCLUDE_DIR) + message(STATUS "Using JsonCpp provided by system.") + set(USE_SYSTEM_JSONCPP TRUE) endif() endif() -if(NOT JSON_FOUND) - message(STATUS "Using bundled JSONCPP library.") +if(NOT USE_SYSTEM_JSONCPP) + message(STATUS "Using bundled JsonCpp library.") set(JSON_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/jsoncpp) set(JSON_LIBRARY jsoncpp) add_subdirectory(lib/jsoncpp) endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Json DEFAULT_MSG JSON_LIBRARY JSON_INCLUDE_DIR) -- cgit v1.2.3 From 91c9313c87bfec8b44e5adb91b06aba9f343dd53 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Thu, 18 Feb 2021 14:50:47 +0100 Subject: Switch Irrlicht dependency to our own fork -> https://github.com/minetest/irrlicht --- CMakeLists.txt | 23 ++++++++++++++++++ README.md | 20 +++++++--------- cmake/Modules/FindIrrlicht.cmake | 51 ++++++---------------------------------- src/CMakeLists.txt | 1 - 4 files changed, 39 insertions(+), 56 deletions(-) (limited to 'cmake/Modules') diff --git a/CMakeLists.txt b/CMakeLists.txt index 31e914c76..67a35fda9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,6 +61,29 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") # This is done here so that relative search paths are more reasonable find_package(Irrlicht) +if(BUILD_CLIENT AND NOT IRRLICHT_FOUND) + message(FATAL_ERROR "Irrlicht is required to build the client, but it was not found.") +elseif(IRRLICHT_INCLUDE_DIR STREQUAL "") + message(FATAL_ERROR "Irrlicht headers are required to build the server, but none found.") +endif() + +include(CheckSymbolExists) +set(CMAKE_REQUIRED_INCLUDES ${IRRLICHT_INCLUDE_DIR}) +unset(HAS_FORKED_IRRLICHT CACHE) +check_symbol_exists(IRRLICHT_VERSION_MT "IrrCompileConfig.h" HAS_FORKED_IRRLICHT) +if(NOT HAS_FORKED_IRRLICHT) + string(CONCAT EXPLANATION_MSG + "Irrlicht found, but it is not Minetest's Irrlicht fork. " + "The Minetest team has forked Irrlicht to make their own customizations. " + "It can be found here: https://github.com/minetest/irrlicht") + if(BUILD_CLIENT) + message(FATAL_ERROR "${EXPLANATION_MSG}\n" + "Building the client with upstream Irrlicht is no longer possible.") + else() + message(WARNING "${EXPLANATION_MSG}\n" + "The server can still be built with upstream Irrlicht but this is DISCOURAGED.") + endif() +endif() # Installation diff --git a/README.md b/README.md index 1d8f754fe..8e2f1be57 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,7 @@ Compiling |------------|---------|------------| | GCC | 4.9+ | Can be replaced with Clang 3.4+ | | CMake | 2.6+ | | -| Irrlicht | 1.7.3+ | | +| Irrlicht | - | Custom version required, see https://github.com/minetest/irrlicht | | SQLite3 | 3.0+ | | | LuaJIT | 2.0+ | Bundled Lua 5.1 is used if not present | | GMP | 5.0.0+ | Bundled mini-GMP is used if not present | @@ -142,19 +142,19 @@ Compiling For Debian/Ubuntu users: - sudo apt install g++ make libc6-dev libirrlicht-dev cmake libbz2-dev libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev + sudo apt install g++ make libc6-dev cmake libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev For Fedora users: - sudo dnf install make automake gcc gcc-c++ kernel-devel cmake libcurl-devel openal-soft-devel libvorbis-devel libXxf86vm-devel libogg-devel freetype-devel mesa-libGL-devel zlib-devel jsoncpp-devel irrlicht-devel bzip2-libs gmp-devel sqlite-devel luajit-devel leveldb-devel ncurses-devel doxygen spatialindex-devel bzip2-devel + sudo dnf install make automake gcc gcc-c++ kernel-devel cmake libcurl-devel openal-soft-devel libvorbis-devel libXxf86vm-devel libogg-devel freetype-devel mesa-libGL-devel zlib-devel jsoncpp-devel gmp-devel sqlite-devel luajit-devel leveldb-devel ncurses-devel spatialindex-devel For Arch users: - sudo pacman -S base-devel libcurl-gnutls cmake libxxf86vm irrlicht libpng sqlite libogg libvorbis openal freetype2 jsoncpp gmp luajit leveldb ncurses + sudo pacman -S base-devel libcurl-gnutls cmake libxxf86vm libpng sqlite libogg libvorbis openal freetype2 jsoncpp gmp luajit leveldb ncurses For Alpine users: - sudo apk add build-base irrlicht-dev cmake bzip2-dev libpng-dev jpeg-dev libxxf86vm-dev mesa-dev sqlite-dev libogg-dev libvorbis-dev openal-soft-dev curl-dev freetype-dev zlib-dev gmp-dev jsoncpp-dev luajit-dev + sudo apk add build-base cmake libpng-dev jpeg-dev libxxf86vm-dev mesa-dev sqlite-dev libogg-dev libvorbis-dev openal-soft-dev curl-dev freetype-dev zlib-dev gmp-dev jsoncpp-dev luajit-dev #### Download @@ -209,8 +209,8 @@ Run it: - You can disable the client build by specifying `-DBUILD_CLIENT=FALSE`. - You can select between Release and Debug build by `-DCMAKE_BUILD_TYPE=`. - Debug build is slower, but gives much more useful output in a debugger. -- If you build a bare server you don't need to have Irrlicht installed. - - In that case use `-DIRRLICHT_SOURCE_DIR=/the/irrlicht/source`. +- If you build a bare server you don't need to have the Irrlicht library installed. + - In that case use `-DIRRLICHT_INCLUDE_DIR=/some/where/irrlicht/include`. ### CMake options @@ -246,8 +246,6 @@ General options and their default values: Library specific options: - BZIP2_INCLUDE_DIR - Linux only; directory where bzlib.h is located - BZIP2_LIBRARY - Linux only; path to libbz2.a/libbz2.so CURL_DLL - Only if building with cURL on Windows; path to libcurl.dll CURL_INCLUDE_DIR - Only if building with cURL; directory where curl.h is located CURL_LIBRARY - Only if building with cURL; path to libcurl.a/libcurl.so/libcurl.lib @@ -276,7 +274,6 @@ Library specific options: SPATIAL_LIBRARY - Only when building with LibSpatial; path to libspatialindex_c.so/spatialindex-32.lib LUA_INCLUDE_DIR - Only if you want to use LuaJIT; directory where luajit.h is located LUA_LIBRARY - Only if you want to use LuaJIT; path to libluajit.a/libluajit.so - MINGWM10_DLL - Only if compiling with MinGW; path to mingwm10.dll OGG_DLL - Only if building with sound on Windows; path to libogg.dll OGG_INCLUDE_DIR - Only if building with sound; directory that contains an ogg directory which contains ogg.h OGG_LIBRARY - Only if building with sound; path to libogg.a/libogg.so/libogg.dll.a @@ -314,9 +311,10 @@ It is highly recommended to use vcpkg as package manager. After you successfully built vcpkg you can easily install the required libraries: ```powershell -vcpkg install irrlicht zlib curl[winssl] openal-soft libvorbis libogg sqlite3 freetype luajit gmp jsoncpp --triplet x64-windows +vcpkg install zlib curl[winssl] openal-soft libvorbis libogg sqlite3 freetype luajit gmp jsoncpp --triplet x64-windows ``` +- **Note that you currently need to build irrlicht on your own** - `curl` is optional, but required to read the serverlist, `curl[winssl]` is required to use the content store. - `openal-soft`, `libvorbis` and `libogg` are optional, but required to use sound. - `freetype` is optional, it allows true-type font rendering. diff --git a/cmake/Modules/FindIrrlicht.cmake b/cmake/Modules/FindIrrlicht.cmake index 6f361e829..8296de685 100644 --- a/cmake/Modules/FindIrrlicht.cmake +++ b/cmake/Modules/FindIrrlicht.cmake @@ -1,44 +1,11 @@ mark_as_advanced(IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR IRRLICHT_DLL) -set(IRRLICHT_SOURCE_DIR "" CACHE PATH "Path to irrlicht source directory (optional)") +# Find include directory and libraries -# Find include directory - -if(NOT IRRLICHT_SOURCE_DIR STREQUAL "") - set(IRRLICHT_SOURCE_DIR_INCLUDE - "${IRRLICHT_SOURCE_DIR}/include" - ) - - set(IRRLICHT_LIBRARY_NAMES libIrrlicht.a Irrlicht Irrlicht.lib) - - if(WIN32) - if(MSVC) - set(IRRLICHT_SOURCE_DIR_LIBS "${IRRLICHT_SOURCE_DIR}/lib/Win32-visualstudio") - set(IRRLICHT_LIBRARY_NAMES Irrlicht.lib) - else() - set(IRRLICHT_SOURCE_DIR_LIBS "${IRRLICHT_SOURCE_DIR}/lib/Win32-gcc") - set(IRRLICHT_LIBRARY_NAMES libIrrlicht.a libIrrlicht.dll.a) - endif() - else() - set(IRRLICHT_SOURCE_DIR_LIBS "${IRRLICHT_SOURCE_DIR}/lib/Linux") - set(IRRLICHT_LIBRARY_NAMES libIrrlicht.a) - endif() - - find_path(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h - PATHS - ${IRRLICHT_SOURCE_DIR_INCLUDE} - NO_DEFAULT_PATH - ) - - find_library(IRRLICHT_LIBRARY NAMES ${IRRLICHT_LIBRARY_NAMES} - PATHS - ${IRRLICHT_SOURCE_DIR_LIBS} - NO_DEFAULT_PATH - ) - -else() +if(TRUE) find_path(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h + DOC "Path to the directory with Irrlicht includes" PATHS /usr/local/include/irrlicht /usr/include/irrlicht @@ -46,7 +13,8 @@ else() PATH_SUFFIXES "include/irrlicht" ) - find_library(IRRLICHT_LIBRARY NAMES libIrrlicht.so libIrrlicht.a Irrlicht + find_library(IRRLICHT_LIBRARY NAMES libIrrlicht Irrlicht + DOC "Path to the Irrlicht library file" PATHS /usr/local/lib /usr/lib @@ -54,19 +22,14 @@ else() ) endif() +# Users will likely need to edit these +mark_as_advanced(CLEAR IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR) # On Windows, find the DLL for installation if(WIN32) # If VCPKG_APPLOCAL_DEPS is ON, dll's are automatically handled by VCPKG if(NOT VCPKG_APPLOCAL_DEPS) - if(MSVC) - set(IRRLICHT_COMPILER "VisualStudio") - else() - set(IRRLICHT_COMPILER "gcc") - endif() find_file(IRRLICHT_DLL NAMES Irrlicht.dll - PATHS - "${IRRLICHT_SOURCE_DIR}/bin/Win32-${IRRLICHT_COMPILER}" DOC "Path of the Irrlicht dll (for installation)" ) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7bcf8d6c7..62d604820 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -295,7 +295,6 @@ else() endif(NOT HAIKU AND NOT APPLE) find_package(JPEG REQUIRED) - find_package(BZip2 REQUIRED) find_package(PNG REQUIRED) if(APPLE) find_library(CARBON_LIB Carbon REQUIRED) -- cgit v1.2.3 From bb1c4badfbd1a81922fcb56cbe6c8427a868f0f8 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Wed, 10 Mar 2021 14:48:53 +0100 Subject: Clean up cmake DLL installation and other minor things --- CMakeLists.txt | 5 +--- README.md | 6 ++--- cmake/Modules/FindGettextLib.cmake | 9 -------- src/CMakeLists.txt | 47 +++++++++++++++----------------------- util/buildbot/buildwin32.sh | 8 +++---- util/buildbot/buildwin64.sh | 8 +++---- 6 files changed, 29 insertions(+), 54 deletions(-) (limited to 'cmake/Modules') diff --git a/CMakeLists.txt b/CMakeLists.txt index 67a35fda9..e4bda3afb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,5 @@ cmake_minimum_required(VERSION 3.5) -cmake_policy(SET CMP0025 OLD) - # This can be read from ${PROJECT_NAME} after project() is called project(minetest) set(PROJECT_NAME_CAPITALIZED "Minetest") @@ -192,7 +190,6 @@ install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games/devtest" DESTINATION "${SHA if(BUILD_CLIENT) install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/client/shaders" DESTINATION "${SHAREDIR}/client") install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/textures/base/pack" DESTINATION "${SHAREDIR}/textures/base") - install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/fonts" DESTINATION "${SHAREDIR}") if(RUN_IN_PLACE) install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/clientmods" DESTINATION "${SHAREDIR}") install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/client/serverlist" DESTINATION "${SHAREDIR}/client") @@ -237,7 +234,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") message(FATAL_ERROR "Insufficient gcc version, found ${CMAKE_CXX_COMPILER_VERSION}. " "Version ${GCC_MINIMUM_VERSION} or higher is required.") endif() -elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") +elseif(CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?Clang") if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "${CLANG_MINIMUM_VERSION}") message(FATAL_ERROR "Insufficient clang version, found ${CMAKE_CXX_COMPILER_VERSION}. " "Version ${CLANG_MINIMUM_VERSION} or higher is required.") diff --git a/README.md b/README.md index 8e2f1be57..e767f1fe3 100644 --- a/README.md +++ b/README.md @@ -255,8 +255,7 @@ Library specific options: FREETYPE_INCLUDE_DIR_ft2build - Only if building with FreeType 2; directory that contains ft2build.h FREETYPE_LIBRARY - Only if building with FreeType 2; path to libfreetype.a/libfreetype.so/freetype.lib FREETYPE_DLL - Only if building with FreeType 2 on Windows; path to libfreetype.dll - GETTEXT_DLL - Only when building with gettext on Windows; path to libintl3.dll - GETTEXT_ICONV_DLL - Only when building with gettext on Windows; path to libiconv2.dll + GETTEXT_DLL - Only when building with gettext on Windows; paths to libintl + libiconv DLLs GETTEXT_INCLUDE_DIR - Only when building with gettext; directory that contains iconv.h GETTEXT_LIBRARY - Only when building with gettext on Windows; path to libintl.dll.a GETTEXT_MSGFMT - Only when building with gettext; path to msgfmt/msgfmt.exe @@ -284,9 +283,8 @@ Library specific options: OPENGLES2_LIBRARY - Only if building with GLES; path to libGLESv2.a/libGLESv2.so SQLITE3_INCLUDE_DIR - Directory that contains sqlite3.h SQLITE3_LIBRARY - Path to libsqlite3.a/libsqlite3.so/sqlite3.lib - VORBISFILE_DLL - Only if building with sound on Windows; path to libvorbisfile-3.dll VORBISFILE_LIBRARY - Only if building with sound; path to libvorbisfile.a/libvorbisfile.so/libvorbisfile.dll.a - VORBIS_DLL - Only if building with sound on Windows; path to libvorbis-0.dll + VORBIS_DLL - Only if building with sound on Windows; paths to vorbis DLLs VORBIS_INCLUDE_DIR - Only if building with sound; directory that contains a directory vorbis with vorbisenc.h inside VORBIS_LIBRARY - Only if building with sound; path to libvorbis.a/libvorbis.so/libvorbis.dll.a XXF86VM_LIBRARY - Only on Linux; path to libXXf86vm.a/libXXf86vm.so diff --git a/cmake/Modules/FindGettextLib.cmake b/cmake/Modules/FindGettextLib.cmake index 529452a4a..b7681827c 100644 --- a/cmake/Modules/FindGettextLib.cmake +++ b/cmake/Modules/FindGettextLib.cmake @@ -42,15 +42,6 @@ if(WIN32) NAMES ${GETTEXT_LIB_NAMES} PATHS "${CUSTOM_GETTEXT_PATH}/lib" DOC "GetText library") - find_file(GETTEXT_DLL - NAMES libintl.dll intl.dll libintl3.dll intl3.dll - PATHS "${CUSTOM_GETTEXT_PATH}/bin" "${CUSTOM_GETTEXT_PATH}/lib" - DOC "gettext *intl*.dll") - find_file(GETTEXT_ICONV_DLL - NAMES libiconv2.dll - PATHS "${CUSTOM_GETTEXT_PATH}/bin" "${CUSTOM_GETTEXT_PATH}/lib" - DOC "gettext *iconv*.lib") - set(GETTEXT_REQUIRED_VARS ${GETTEXT_REQUIRED_VARS} GETTEXT_DLL GETTEXT_ICONV_DLL) endif(WIN32) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 62d604820..8a6eabccc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -63,14 +63,13 @@ if(ENABLE_GETTEXT) if(GETTEXTLIB_FOUND) if(WIN32) message(STATUS "GetText library: ${GETTEXT_LIBRARY}") - message(STATUS "GetText DLL: ${GETTEXT_DLL}") - message(STATUS "GetText iconv DLL: ${GETTEXT_ICONV_DLL}") + message(STATUS "GetText DLL(s): ${GETTEXT_DLL}") endif() set(USE_GETTEXT TRUE) message(STATUS "GetText enabled; locales found: ${GETTEXT_AVAILABLE_LOCALES}") endif(GETTEXTLIB_FOUND) else() - mark_as_advanced(GETTEXT_ICONV_DLL GETTEXT_INCLUDE_DIR GETTEXT_LIBRARY GETTEXT_MSGFMT) + mark_as_advanced(GETTEXT_INCLUDE_DIR GETTEXT_LIBRARY GETTEXT_MSGFMT) message(STATUS "GetText disabled.") endif() @@ -268,8 +267,10 @@ if(WIN32) if(ENABLE_SOUND) set(OPENAL_DLL "" CACHE FILEPATH "Path to OpenAL32.dll for installation (optional)") set(OGG_DLL "" CACHE FILEPATH "Path to libogg.dll for installation (optional)") - set(VORBIS_DLL "" CACHE FILEPATH "Path to libvorbis.dll for installation (optional)") - set(VORBISFILE_DLL "" CACHE FILEPATH "Path to libvorbisfile.dll for installation (optional)") + set(VORBIS_DLL "" CACHE FILEPATH "Path to Vorbis DLLs for installation (optional)") + endif() + if(USE_GETTEXT) + set(GETTEXT_DLL "" CACHE FILEPATH "Path to Intl/Iconv DLLs for installation (optional)") endif() if(USE_LUAJIT) set(LUA_DLL "" CACHE FILEPATH "Path to luajit-5.1.dll for installation (optional)") @@ -712,7 +713,7 @@ if(MSVC) # Flags that cannot be shared between cl and clang-cl # https://clang.llvm.org/docs/UsersManual.html#clang-cl - if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=lld") # Disable pragma-pack warning @@ -730,7 +731,7 @@ else() else() set(RELEASE_WARNING_FLAGS "") endif() - if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + if(CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?Clang") set(WARNING_FLAGS "${WARNING_FLAGS} -Wsign-compare") endif() @@ -767,7 +768,7 @@ else() else() set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${MATH_FLAGS}") endif() - endif(CMAKE_SYSTEM_NAME MATCHES "(Darwin|BSD|DragonFly)") + endif() set(CMAKE_CXX_FLAGS_SEMIDEBUG "-g -O1 -Wall ${WARNING_FLAGS} ${OTHER_FLAGS}") set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall ${WARNING_FLAGS} ${OTHER_FLAGS}") @@ -804,7 +805,7 @@ if(WIN32) FILES_MATCHING PATTERN "*.dll") else() # Use the old-style way to install dll's - if(USE_SOUND) + if(BUILD_CLIENT AND USE_SOUND) if(OPENAL_DLL) install(FILES ${OPENAL_DLL} DESTINATION ${BINDIR}) endif() @@ -814,9 +815,6 @@ if(WIN32) if(VORBIS_DLL) install(FILES ${VORBIS_DLL} DESTINATION ${BINDIR}) endif() - if(VORBISFILE_DLL) - install(FILES ${VORBISFILE_DLL} DESTINATION ${BINDIR}) - endif() endif() if(CURL_DLL) install(FILES ${CURL_DLL} DESTINATION ${BINDIR}) @@ -824,7 +822,7 @@ if(WIN32) if(ZLIB_DLL) install(FILES ${ZLIB_DLL} DESTINATION ${BINDIR}) endif() - if(FREETYPE_DLL) + if(BUILD_CLIENT AND FREETYPE_DLL) install(FILES ${FREETYPE_DLL} DESTINATION ${BINDIR}) endif() if(SQLITE3_DLL) @@ -836,6 +834,12 @@ if(WIN32) if(LUA_DLL) install(FILES ${LUA_DLL} DESTINATION ${BINDIR}) endif() + if(BUILD_CLIENT AND IRRLICHT_DLL) + install(FILES ${IRRLICHT_DLL} DESTINATION ${BINDIR}) + endif() + if(BUILD_CLIENT AND USE_GETTEXT AND GETTEXT_DLL) + install(FILES ${GETTEXT_DLL} DESTINATION ${BINDIR}) + endif() endif() endif() @@ -863,6 +867,7 @@ if(BUILD_CLIENT) endforeach() endif() + # Install necessary fonts depending on configuration if(USE_FREETYPE) install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../fonts" DESTINATION "${SHAREDIR}" FILES_MATCHING PATTERN "*.ttf" PATTERN "*.txt") @@ -870,22 +875,6 @@ if(BUILD_CLIENT) install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../fonts" DESTINATION "${SHAREDIR}" FILES_MATCHING PATTERN "*.png" PATTERN "*.xml") endif() - - if(WIN32) - if(NOT VCPKG_APPLOCAL_DEPS) - if(DEFINED IRRLICHT_DLL) - install(FILES ${IRRLICHT_DLL} DESTINATION ${BINDIR}) - endif() - if(USE_GETTEXT) - if(DEFINED GETTEXT_DLL) - install(FILES ${GETTEXT_DLL} DESTINATION ${BINDIR}) - endif() - if(DEFINED GETTEXT_ICONV_DLL) - install(FILES ${GETTEXT_ICONV_DLL} DESTINATION ${BINDIR}) - endif() - endif() - endif() - endif() endif(BUILD_CLIENT) if(BUILD_SERVER) diff --git a/util/buildbot/buildwin32.sh b/util/buildbot/buildwin32.sh index 715a89822..db3a23375 100755 --- a/util/buildbot/buildwin32.sh +++ b/util/buildbot/buildwin32.sh @@ -103,6 +103,8 @@ if [ "x$NO_MINETEST_GAME" = "x" ]; then fi irr_dlls=$(echo $libdir/irrlicht/bin/*.dll | tr ' ' ';') +vorbis_dlls=$(echo $libdir/libvorbis/bin/libvorbis{,file}-*.dll | tr ' ' ';') +gettext_dlls=$(echo $libdir/gettext/bin/lib{intl,iconv}-*.dll | tr ' ' ';') # Build the thing [ -d _build ] && rm -Rf _build/ @@ -137,9 +139,8 @@ cmake .. \ \ -DVORBIS_INCLUDE_DIR=$libdir/libvorbis/include \ -DVORBIS_LIBRARY=$libdir/libvorbis/lib/libvorbis.dll.a \ - -DVORBIS_DLL=$libdir/libvorbis/bin/libvorbis-0.dll \ + -DVORBIS_DLL="$vorbis_dlls" \ -DVORBISFILE_LIBRARY=$libdir/libvorbis/lib/libvorbisfile.dll.a \ - -DVORBISFILE_DLL=$libdir/libvorbis/bin/libvorbisfile-3.dll \ \ -DOPENAL_INCLUDE_DIR=$libdir/openal_stripped/include/AL \ -DOPENAL_LIBRARY=$libdir/openal_stripped/lib/libOpenAL32.dll.a \ @@ -150,8 +151,7 @@ cmake .. \ -DCURL_LIBRARY=$libdir/libcurl/lib/libcurl.dll.a \ \ -DGETTEXT_MSGFMT=`which msgfmt` \ - -DGETTEXT_DLL=$libdir/gettext/bin/libintl-8.dll \ - -DGETTEXT_ICONV_DLL=$libdir/gettext/bin/libiconv-2.dll \ + -DGETTEXT_DLL="$gettext_dlls" \ -DGETTEXT_INCLUDE_DIR=$libdir/gettext/include \ -DGETTEXT_LIBRARY=$libdir/gettext/lib/libintl.dll.a \ \ diff --git a/util/buildbot/buildwin64.sh b/util/buildbot/buildwin64.sh index 226ef84c1..53c6d1ea9 100755 --- a/util/buildbot/buildwin64.sh +++ b/util/buildbot/buildwin64.sh @@ -93,6 +93,8 @@ if [ "x$NO_MINETEST_GAME" = "x" ]; then fi irr_dlls=$(echo $libdir/irrlicht/bin/*.dll | tr ' ' ';') +vorbis_dlls=$(echo $libdir/libvorbis/bin/libvorbis{,file}-*.dll | tr ' ' ';') +gettext_dlls=$(echo $libdir/gettext/bin/lib{intl,iconv}-*.dll | tr ' ' ';') # Build the thing [ -d _build ] && rm -Rf _build/ @@ -127,9 +129,8 @@ cmake .. \ \ -DVORBIS_INCLUDE_DIR=$libdir/libvorbis/include \ -DVORBIS_LIBRARY=$libdir/libvorbis/lib/libvorbis.dll.a \ - -DVORBIS_DLL=$libdir/libvorbis/bin/libvorbis-0.dll \ + -DVORBIS_DLL="$vorbis_dlls" \ -DVORBISFILE_LIBRARY=$libdir/libvorbis/lib/libvorbisfile.dll.a \ - -DVORBISFILE_DLL=$libdir/libvorbis/bin/libvorbisfile-3.dll \ \ -DOPENAL_INCLUDE_DIR=$libdir/openal_stripped/include/AL \ -DOPENAL_LIBRARY=$libdir/openal_stripped/lib/libOpenAL32.dll.a \ @@ -140,8 +141,7 @@ cmake .. \ -DCURL_LIBRARY=$libdir/libcurl/lib/libcurl.dll.a \ \ -DGETTEXT_MSGFMT=`which msgfmt` \ - -DGETTEXT_DLL=$libdir/gettext/bin/libintl-8.dll \ - -DGETTEXT_ICONV_DLL=$libdir/gettext/bin/libiconv-2.dll \ + -DGETTEXT_DLL="$gettext_dlls" \ -DGETTEXT_INCLUDE_DIR=$libdir/gettext/include \ -DGETTEXT_LIBRARY=$libdir/gettext/lib/libintl.dll.a \ \ -- cgit v1.2.3 From 6a26d6d15a9a122681772c29a7f3b0c36ac9c62e Mon Sep 17 00:00:00 2001 From: sfan5 Date: Thu, 25 Mar 2021 15:09:49 +0100 Subject: Adjust build config for Irrlicht changes (again) --- .gitlab-ci.yml | 2 +- README.md | 4 ++-- cmake/Modules/FindIrrlicht.cmake | 29 ++++++++++++++++++----------- util/buildbot/buildwin32.sh | 6 +++--- util/buildbot/buildwin64.sh | 6 +++--- util/ci/common.sh | 2 +- 6 files changed, 28 insertions(+), 21 deletions(-) (limited to 'cmake/Modules') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 39ff576cf..9764648e1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,7 +9,7 @@ stages: - deploy variables: - IRRLICHT_TAG: "1.9.0mt0" + IRRLICHT_TAG: "1.9.0mt1" MINETEST_GAME_REPO: "https://github.com/minetest/minetest_game.git" CONTAINER_IMAGE: registry.gitlab.com/$CI_PROJECT_PATH diff --git a/README.md b/README.md index e767f1fe3..662b5c4ca 100644 --- a/README.md +++ b/README.md @@ -259,9 +259,9 @@ Library specific options: GETTEXT_INCLUDE_DIR - Only when building with gettext; directory that contains iconv.h GETTEXT_LIBRARY - Only when building with gettext on Windows; path to libintl.dll.a GETTEXT_MSGFMT - Only when building with gettext; path to msgfmt/msgfmt.exe - IRRLICHT_DLL - Only on Windows; path to Irrlicht.dll + IRRLICHT_DLL - Only on Windows; path to IrrlichtMt.dll IRRLICHT_INCLUDE_DIR - Directory that contains IrrCompileConfig.h - IRRLICHT_LIBRARY - Path to libIrrlicht.a/libIrrlicht.so/libIrrlicht.dll.a/Irrlicht.lib + IRRLICHT_LIBRARY - Path to libIrrlichtMt.a/libIrrlichtMt.so/libIrrlichtMt.dll.a/IrrlichtMt.lib LEVELDB_INCLUDE_DIR - Only when building with LevelDB; directory that contains db.h LEVELDB_LIBRARY - Only when building with LevelDB; path to libleveldb.a/libleveldb.so/libleveldb.dll.a LEVELDB_DLL - Only when building with LevelDB on Windows; path to libleveldb.dll diff --git a/cmake/Modules/FindIrrlicht.cmake b/cmake/Modules/FindIrrlicht.cmake index 8296de685..bb501b3b4 100644 --- a/cmake/Modules/FindIrrlicht.cmake +++ b/cmake/Modules/FindIrrlicht.cmake @@ -3,24 +3,31 @@ mark_as_advanced(IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR IRRLICHT_DLL) # Find include directory and libraries -if(TRUE) +# find our fork first, then upstream (TODO: remove this?) +foreach(libname IN ITEMS IrrlichtMt Irrlicht) + string(TOLOWER "${libname}" libname2) + find_path(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h - DOC "Path to the directory with Irrlicht includes" + DOC "Path to the directory with IrrlichtMt includes" PATHS - /usr/local/include/irrlicht - /usr/include/irrlicht - /system/develop/headers/irrlicht #Haiku - PATH_SUFFIXES "include/irrlicht" + /usr/local/include/${libname2} + /usr/include/${libname2} + /system/develop/headers/${libname2} #Haiku + PATH_SUFFIXES "include/${libname2}" ) - find_library(IRRLICHT_LIBRARY NAMES libIrrlicht Irrlicht - DOC "Path to the Irrlicht library file" + find_library(IRRLICHT_LIBRARY NAMES lib${libname} ${libname} + DOC "Path to the IrrlichtMt library file" PATHS /usr/local/lib /usr/lib /system/develop/lib # Haiku ) -endif() + + if(IRRLICHT_INCLUDE_DIR OR IRRLICHT_LIBRARY) + break() + endif() +endforeach() # Users will likely need to edit these mark_as_advanced(CLEAR IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR) @@ -29,8 +36,8 @@ mark_as_advanced(CLEAR IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR) if(WIN32) # If VCPKG_APPLOCAL_DEPS is ON, dll's are automatically handled by VCPKG if(NOT VCPKG_APPLOCAL_DEPS) - find_file(IRRLICHT_DLL NAMES Irrlicht.dll - DOC "Path of the Irrlicht dll (for installation)" + find_file(IRRLICHT_DLL NAMES IrrlichtMt.dll + DOC "Path of the IrrlichtMt dll (for installation)" ) endif() endif(WIN32) diff --git a/util/buildbot/buildwin32.sh b/util/buildbot/buildwin32.sh index db3a23375..1a66a9764 100755 --- a/util/buildbot/buildwin32.sh +++ b/util/buildbot/buildwin32.sh @@ -31,7 +31,7 @@ if [ -z "$toolchain_file" ]; then fi echo "Using $toolchain_file" -irrlicht_version=1.9.0mt0 +irrlicht_version=1.9.0mt1 ogg_version=1.3.2 vorbis_version=1.3.5 curl_version=7.65.3 @@ -122,8 +122,8 @@ cmake .. \ -DENABLE_FREETYPE=1 \ -DENABLE_LEVELDB=1 \ \ - -DIRRLICHT_INCLUDE_DIR=$libdir/irrlicht/include/irrlicht \ - -DIRRLICHT_LIBRARY=$libdir/irrlicht/lib/libIrrlicht.dll.a \ + -DIRRLICHT_INCLUDE_DIR=$libdir/irrlicht/include/irrlichtmt \ + -DIRRLICHT_LIBRARY=$libdir/irrlicht/lib/libIrrlichtMt.dll.a \ -DIRRLICHT_DLL="$irr_dlls" \ \ -DZLIB_INCLUDE_DIR=$libdir/zlib/include \ diff --git a/util/buildbot/buildwin64.sh b/util/buildbot/buildwin64.sh index 53c6d1ea9..54bfbef69 100755 --- a/util/buildbot/buildwin64.sh +++ b/util/buildbot/buildwin64.sh @@ -20,7 +20,7 @@ packagedir=$builddir/packages libdir=$builddir/libs toolchain_file=$dir/toolchain_x86_64-w64-mingw32.cmake -irrlicht_version=1.9.0mt0 +irrlicht_version=1.9.0mt1 ogg_version=1.3.2 vorbis_version=1.3.5 curl_version=7.65.3 @@ -112,8 +112,8 @@ cmake .. \ -DENABLE_FREETYPE=1 \ -DENABLE_LEVELDB=1 \ \ - -DIRRLICHT_INCLUDE_DIR=$libdir/irrlicht/include/irrlicht \ - -DIRRLICHT_LIBRARY=$libdir/irrlicht/lib/libIrrlicht.dll.a \ + -DIRRLICHT_INCLUDE_DIR=$libdir/irrlicht/include/irrlichtmt \ + -DIRRLICHT_LIBRARY=$libdir/irrlicht/lib/libIrrlichtMt.dll.a \ -DIRRLICHT_DLL="$irr_dlls" \ \ -DZLIB_INCLUDE_DIR=$libdir/zlib/include \ diff --git a/util/ci/common.sh b/util/ci/common.sh index d73c31b2f..ca2ecbc29 100644 --- a/util/ci/common.sh +++ b/util/ci/common.sh @@ -12,7 +12,7 @@ install_linux_deps() { shift pkgs+=(libirrlicht-dev) else - wget "https://github.com/minetest/irrlicht/releases/download/1.9.0mt0/ubuntu-bionic.tar.gz" + wget "https://github.com/minetest/irrlicht/releases/download/1.9.0mt1/ubuntu-bionic.tar.gz" sudo tar -xaf ubuntu-bionic.tar.gz -C /usr/local fi -- cgit v1.2.3 From 52c0384bd1c9f564f7a6deab93e560dc49ff8915 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Fri, 16 Apr 2021 23:39:16 +0200 Subject: Fix ignored OpenGLES2 include path and cmake warning --- cmake/Modules/FindOpenGLES2.cmake | 3 +-- src/CMakeLists.txt | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'cmake/Modules') diff --git a/cmake/Modules/FindOpenGLES2.cmake b/cmake/Modules/FindOpenGLES2.cmake index a47126705..ce04191dd 100644 --- a/cmake/Modules/FindOpenGLES2.cmake +++ b/cmake/Modules/FindOpenGLES2.cmake @@ -42,7 +42,7 @@ else() ) include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(OPENGLES2 DEFAULT_MSG OPENGLES2_LIBRARY OPENGLES2_INCLUDE_DIR) + find_package_handle_standard_args(OpenGLES2 DEFAULT_MSG OPENGLES2_LIBRARY OPENGLES2_INCLUDE_DIR) find_path(EGL_INCLUDE_DIR EGL/egl.h PATHS /usr/openwin/share/include @@ -59,7 +59,6 @@ else() /usr/lib ) - include(FindPackageHandleStandardArgs) find_package_handle_standard_args(EGL DEFAULT_MSG EGL_LIBRARY EGL_INCLUDE_DIR) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 26441063f..16b5bf991 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -513,6 +513,10 @@ include_directories( ${PROJECT_SOURCE_DIR}/script ) +if(ENABLE_GLES) + include_directories(${OPENGLES2_INCLUDE_DIR} ${EGL_INCLUDE_DIR}) +endif() + if(USE_GETTEXT) include_directories(${GETTEXT_INCLUDE_DIR}) endif() -- cgit v1.2.3 From 734fb2c811cdb0c26153c2bd5b62e458343963e7 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Wed, 28 Apr 2021 08:38:18 +0200 Subject: Add helpful error messages if Irrlicht library / include dir are set incorrectly (#11232) --- cmake/Modules/FindIrrlicht.cmake | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'cmake/Modules') diff --git a/cmake/Modules/FindIrrlicht.cmake b/cmake/Modules/FindIrrlicht.cmake index bb501b3b4..058e93878 100644 --- a/cmake/Modules/FindIrrlicht.cmake +++ b/cmake/Modules/FindIrrlicht.cmake @@ -1,5 +1,5 @@ -mark_as_advanced(IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR IRRLICHT_DLL) +mark_as_advanced(IRRLICHT_DLL) # Find include directory and libraries @@ -29,8 +29,22 @@ foreach(libname IN ITEMS IrrlichtMt Irrlicht) endif() endforeach() -# Users will likely need to edit these -mark_as_advanced(CLEAR IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR) +# Handholding for users +if(IRRLICHT_INCLUDE_DIR AND (NOT IS_DIRECTORY "${IRRLICHT_INCLUDE_DIR}" OR + NOT EXISTS "${IRRLICHT_INCLUDE_DIR}/irrlicht.h")) + message(WARNING "IRRLICHT_INCLUDE_DIR was set to ${IRRLICHT_INCLUDE_DIR} " + "but irrlicht.h does not exist inside. The path will not be used.") + unset(IRRLICHT_INCLUDE_DIR CACHE) +endif() +if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Linux" OR APPLE) + # (only on systems where we're sure how a valid library looks like) + if(IRRLICHT_LIBRARY AND (IS_DIRECTORY "${IRRLICHT_LIBRARY}" OR + NOT IRRLICHT_LIBRARY MATCHES "\\.(a|so|dylib|lib)([.0-9]+)?$")) + message(WARNING "IRRLICHT_LIBRARY was set to ${IRRLICHT_LIBRARY} " + "but is not a valid library file. The path will not be used.") + unset(IRRLICHT_LIBRARY CACHE) + endif() +endif() # On Windows, find the DLL for installation if(WIN32) -- cgit v1.2.3