aboutsummaryrefslogtreecommitdiff
path: root/cmake/Modules
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2021-09-19 20:56:13 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2021-09-19 20:56:13 +0200
commitc8900e169a1ddceec07a449f1ae7c4322ff02036 (patch)
tree5156605fb473d25786426eb6876ba2e7d3b7507b /cmake/Modules
parent950d2c9b3e10cbace9236e820c8119d1abb9e01f (diff)
parente0529da5c84f224c380e6d5e063392cb01f85683 (diff)
downloaddragonfireclient-c8900e169a1ddceec07a449f1ae7c4322ff02036.tar.xz
Merge branch 'master' of https://github.com/minetest/minetest
Diffstat (limited to 'cmake/Modules')
-rw-r--r--cmake/Modules/FindIrrlicht.cmake61
-rw-r--r--cmake/Modules/FindLuaJIT.cmake17
-rw-r--r--cmake/Modules/FindZstd.cmake25
-rw-r--r--cmake/Modules/MinetestFindIrrlichtHeaders.cmake26
4 files changed, 55 insertions, 74 deletions
diff --git a/cmake/Modules/FindIrrlicht.cmake b/cmake/Modules/FindIrrlicht.cmake
deleted file mode 100644
index 058e93878..000000000
--- a/cmake/Modules/FindIrrlicht.cmake
+++ /dev/null
@@ -1,61 +0,0 @@
-
-mark_as_advanced(IRRLICHT_DLL)
-
-# Find include directory and libraries
-
-# 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 IrrlichtMt includes"
- PATHS
- /usr/local/include/${libname2}
- /usr/include/${libname2}
- /system/develop/headers/${libname2} #Haiku
- PATH_SUFFIXES "include/${libname2}"
- )
-
- 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
- )
-
- if(IRRLICHT_INCLUDE_DIR OR IRRLICHT_LIBRARY)
- break()
- endif()
-endforeach()
-
-# 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)
- # If VCPKG_APPLOCAL_DEPS is ON, dll's are automatically handled by VCPKG
- if(NOT VCPKG_APPLOCAL_DEPS)
- find_file(IRRLICHT_DLL NAMES IrrlichtMt.dll
- DOC "Path of the IrrlichtMt dll (for installation)"
- )
- endif()
-endif(WIN32)
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(Irrlicht DEFAULT_MSG IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR)
-
diff --git a/cmake/Modules/FindLuaJIT.cmake b/cmake/Modules/FindLuaJIT.cmake
index 97b0b7c64..217415d14 100644
--- a/cmake/Modules/FindLuaJIT.cmake
+++ b/cmake/Modules/FindLuaJIT.cmake
@@ -1,8 +1,8 @@
# Locate LuaJIT library
# This module defines
# LUAJIT_FOUND, if false, do not try to link to Lua
+# LUA_LIBRARY, where to find the lua library
# LUA_INCLUDE_DIR, where to find lua.h
-# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
#
# This module is similar to FindLua51.cmake except that it finds LuaJit instead.
@@ -44,19 +44,10 @@ else()
)
endif()
-
-IF(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/luajit.h")
- FILE(STRINGS "${LUA_INCLUDE_DIR}/luajit.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"LuaJIT .+\"")
-
- STRING(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"LuaJIT ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}")
- UNSET(lua_version_str)
-ENDIF()
-
INCLUDE(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LUAJIT_FOUND to TRUE if
-# all listed variables are TRUE
+# all listed variables exist
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJIT
- REQUIRED_VARS LUA_LIBRARY LUA_INCLUDE_DIR
- VERSION_VAR LUA_VERSION_STRING)
+ REQUIRED_VARS LUA_LIBRARY LUA_INCLUDE_DIR)
-MARK_AS_ADVANCED(LUA_INCLUDE_DIR LUA_LIBRARY LUA_MATH_LIBRARY)
+MARK_AS_ADVANCED(LUA_INCLUDE_DIR LUA_LIBRARY)
diff --git a/cmake/Modules/FindZstd.cmake b/cmake/Modules/FindZstd.cmake
new file mode 100644
index 000000000..e28e1334b
--- /dev/null
+++ b/cmake/Modules/FindZstd.cmake
@@ -0,0 +1,25 @@
+mark_as_advanced(ZSTD_LIBRARY ZSTD_INCLUDE_DIR)
+
+find_path(ZSTD_INCLUDE_DIR NAMES zstd.h)
+
+find_library(ZSTD_LIBRARY NAMES zstd)
+
+if(ZSTD_INCLUDE_DIR AND ZSTD_LIBRARY)
+ # Check that the API we use exists
+ include(CheckSymbolExists)
+ unset(HAVE_ZSTD_INITCSTREAM CACHE)
+ set(CMAKE_REQUIRED_INCLUDES ${ZSTD_INCLUDE_DIR})
+ set(CMAKE_REQUIRED_LIBRARIES ${ZSTD_LIBRARY})
+ check_symbol_exists(ZSTD_initCStream zstd.h HAVE_ZSTD_INITCSTREAM)
+ unset(CMAKE_REQUIRED_INCLUDES)
+ unset(CMAKE_REQUIRED_LIBRARIES)
+
+ if(NOT HAVE_ZSTD_INITCSTREAM)
+ unset(ZSTD_INCLUDE_DIR CACHE)
+ unset(ZSTD_LIBRARY CACHE)
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Zstd DEFAULT_MSG ZSTD_LIBRARY ZSTD_INCLUDE_DIR)
+
diff --git a/cmake/Modules/MinetestFindIrrlichtHeaders.cmake b/cmake/Modules/MinetestFindIrrlichtHeaders.cmake
new file mode 100644
index 000000000..d33b296d0
--- /dev/null
+++ b/cmake/Modules/MinetestFindIrrlichtHeaders.cmake
@@ -0,0 +1,26 @@
+# Locate Irrlicht or IrrlichtMt headers on system.
+
+foreach(libname IN ITEMS IrrlichtMt Irrlicht)
+ string(TOLOWER "${libname}" libname2)
+
+ find_path(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h
+ DOC "Path to the directory with IrrlichtMt includes"
+ PATHS
+ /usr/local/include/${libname2}
+ /usr/include/${libname2}
+ /system/develop/headers/${libname2} #Haiku
+ PATH_SUFFIXES "include/${libname2}"
+ )
+
+ if(IRRLICHT_INCLUDE_DIR)
+ break()
+ endif()
+endforeach()
+
+# 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()