Clean up cmake DLL installation and other minor things

This commit is contained in:
sfan5 2021-03-10 14:48:53 +01:00
parent 75eb28b959
commit bb1c4badfb
6 changed files with 29 additions and 54 deletions

@ -1,7 +1,5 @@
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.5)
cmake_policy(SET CMP0025 OLD)
# This can be read from ${PROJECT_NAME} after project() is called # This can be read from ${PROJECT_NAME} after project() is called
project(minetest) project(minetest)
set(PROJECT_NAME_CAPITALIZED "Minetest") set(PROJECT_NAME_CAPITALIZED "Minetest")
@ -192,7 +190,6 @@ install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games/devtest" DESTINATION "${SHA
if(BUILD_CLIENT) if(BUILD_CLIENT)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/client/shaders" DESTINATION "${SHAREDIR}/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}/textures/base/pack" DESTINATION "${SHAREDIR}/textures/base")
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/fonts" DESTINATION "${SHAREDIR}")
if(RUN_IN_PLACE) if(RUN_IN_PLACE)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/clientmods" DESTINATION "${SHAREDIR}") install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/clientmods" DESTINATION "${SHAREDIR}")
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/client/serverlist" DESTINATION "${SHAREDIR}/client") 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}. " message(FATAL_ERROR "Insufficient gcc version, found ${CMAKE_CXX_COMPILER_VERSION}. "
"Version ${GCC_MINIMUM_VERSION} or higher is required.") "Version ${GCC_MINIMUM_VERSION} or higher is required.")
endif() 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}") if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "${CLANG_MINIMUM_VERSION}")
message(FATAL_ERROR "Insufficient clang version, found ${CMAKE_CXX_COMPILER_VERSION}. " message(FATAL_ERROR "Insufficient clang version, found ${CMAKE_CXX_COMPILER_VERSION}. "
"Version ${CLANG_MINIMUM_VERSION} or higher is required.") "Version ${CLANG_MINIMUM_VERSION} or higher is required.")

@ -255,8 +255,7 @@ Library specific options:
FREETYPE_INCLUDE_DIR_ft2build - Only if building with FreeType 2; directory that contains ft2build.h 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_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 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_DLL - Only when building with gettext on Windows; paths to libintl + libiconv DLLs
GETTEXT_ICONV_DLL - Only when building with gettext on Windows; path to libiconv2.dll
GETTEXT_INCLUDE_DIR - Only when building with gettext; directory that contains iconv.h 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_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 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 OPENGLES2_LIBRARY - Only if building with GLES; path to libGLESv2.a/libGLESv2.so
SQLITE3_INCLUDE_DIR - Directory that contains sqlite3.h SQLITE3_INCLUDE_DIR - Directory that contains sqlite3.h
SQLITE3_LIBRARY - Path to libsqlite3.a/libsqlite3.so/sqlite3.lib 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 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_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 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 XXF86VM_LIBRARY - Only on Linux; path to libXXf86vm.a/libXXf86vm.so

@ -42,15 +42,6 @@ if(WIN32)
NAMES ${GETTEXT_LIB_NAMES} NAMES ${GETTEXT_LIB_NAMES}
PATHS "${CUSTOM_GETTEXT_PATH}/lib" PATHS "${CUSTOM_GETTEXT_PATH}/lib"
DOC "GetText library") 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) endif(WIN32)

@ -63,14 +63,13 @@ if(ENABLE_GETTEXT)
if(GETTEXTLIB_FOUND) if(GETTEXTLIB_FOUND)
if(WIN32) if(WIN32)
message(STATUS "GetText library: ${GETTEXT_LIBRARY}") message(STATUS "GetText library: ${GETTEXT_LIBRARY}")
message(STATUS "GetText DLL: ${GETTEXT_DLL}") message(STATUS "GetText DLL(s): ${GETTEXT_DLL}")
message(STATUS "GetText iconv DLL: ${GETTEXT_ICONV_DLL}")
endif() endif()
set(USE_GETTEXT TRUE) set(USE_GETTEXT TRUE)
message(STATUS "GetText enabled; locales found: ${GETTEXT_AVAILABLE_LOCALES}") message(STATUS "GetText enabled; locales found: ${GETTEXT_AVAILABLE_LOCALES}")
endif(GETTEXTLIB_FOUND) endif(GETTEXTLIB_FOUND)
else() 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.") message(STATUS "GetText disabled.")
endif() endif()
@ -268,8 +267,10 @@ if(WIN32)
if(ENABLE_SOUND) if(ENABLE_SOUND)
set(OPENAL_DLL "" CACHE FILEPATH "Path to OpenAL32.dll for installation (optional)") 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(OGG_DLL "" CACHE FILEPATH "Path to libogg.dll for installation (optional)")
set(VORBIS_DLL "" CACHE FILEPATH "Path to libvorbis.dll for installation (optional)") set(VORBIS_DLL "" CACHE FILEPATH "Path to Vorbis DLLs for installation (optional)")
set(VORBISFILE_DLL "" CACHE FILEPATH "Path to libvorbisfile.dll for installation (optional)") endif()
if(USE_GETTEXT)
set(GETTEXT_DLL "" CACHE FILEPATH "Path to Intl/Iconv DLLs for installation (optional)")
endif() endif()
if(USE_LUAJIT) if(USE_LUAJIT)
set(LUA_DLL "" CACHE FILEPATH "Path to luajit-5.1.dll for installation (optional)") 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 # Flags that cannot be shared between cl and clang-cl
# https://clang.llvm.org/docs/UsersManual.html#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") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=lld")
# Disable pragma-pack warning # Disable pragma-pack warning
@ -730,7 +731,7 @@ else()
else() else()
set(RELEASE_WARNING_FLAGS "") set(RELEASE_WARNING_FLAGS "")
endif() endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") if(CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?Clang")
set(WARNING_FLAGS "${WARNING_FLAGS} -Wsign-compare") set(WARNING_FLAGS "${WARNING_FLAGS} -Wsign-compare")
endif() endif()
@ -767,7 +768,7 @@ else()
else() else()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${MATH_FLAGS}") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${MATH_FLAGS}")
endif() 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_SEMIDEBUG "-g -O1 -Wall ${WARNING_FLAGS} ${OTHER_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -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") FILES_MATCHING PATTERN "*.dll")
else() else()
# Use the old-style way to install dll's # Use the old-style way to install dll's
if(USE_SOUND) if(BUILD_CLIENT AND USE_SOUND)
if(OPENAL_DLL) if(OPENAL_DLL)
install(FILES ${OPENAL_DLL} DESTINATION ${BINDIR}) install(FILES ${OPENAL_DLL} DESTINATION ${BINDIR})
endif() endif()
@ -814,9 +815,6 @@ if(WIN32)
if(VORBIS_DLL) if(VORBIS_DLL)
install(FILES ${VORBIS_DLL} DESTINATION ${BINDIR}) install(FILES ${VORBIS_DLL} DESTINATION ${BINDIR})
endif() endif()
if(VORBISFILE_DLL)
install(FILES ${VORBISFILE_DLL} DESTINATION ${BINDIR})
endif()
endif() endif()
if(CURL_DLL) if(CURL_DLL)
install(FILES ${CURL_DLL} DESTINATION ${BINDIR}) install(FILES ${CURL_DLL} DESTINATION ${BINDIR})
@ -824,7 +822,7 @@ if(WIN32)
if(ZLIB_DLL) if(ZLIB_DLL)
install(FILES ${ZLIB_DLL} DESTINATION ${BINDIR}) install(FILES ${ZLIB_DLL} DESTINATION ${BINDIR})
endif() endif()
if(FREETYPE_DLL) if(BUILD_CLIENT AND FREETYPE_DLL)
install(FILES ${FREETYPE_DLL} DESTINATION ${BINDIR}) install(FILES ${FREETYPE_DLL} DESTINATION ${BINDIR})
endif() endif()
if(SQLITE3_DLL) if(SQLITE3_DLL)
@ -836,6 +834,12 @@ if(WIN32)
if(LUA_DLL) if(LUA_DLL)
install(FILES ${LUA_DLL} DESTINATION ${BINDIR}) install(FILES ${LUA_DLL} DESTINATION ${BINDIR})
endif() 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()
endif() endif()
@ -863,6 +867,7 @@ if(BUILD_CLIENT)
endforeach() endforeach()
endif() endif()
# Install necessary fonts depending on configuration
if(USE_FREETYPE) if(USE_FREETYPE)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../fonts" DESTINATION "${SHAREDIR}" install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../fonts" DESTINATION "${SHAREDIR}"
FILES_MATCHING PATTERN "*.ttf" PATTERN "*.txt") FILES_MATCHING PATTERN "*.ttf" PATTERN "*.txt")
@ -870,22 +875,6 @@ if(BUILD_CLIENT)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../fonts" DESTINATION "${SHAREDIR}" install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../fonts" DESTINATION "${SHAREDIR}"
FILES_MATCHING PATTERN "*.png" PATTERN "*.xml") FILES_MATCHING PATTERN "*.png" PATTERN "*.xml")
endif() 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) endif(BUILD_CLIENT)
if(BUILD_SERVER) if(BUILD_SERVER)

@ -103,6 +103,8 @@ if [ "x$NO_MINETEST_GAME" = "x" ]; then
fi fi
irr_dlls=$(echo $libdir/irrlicht/bin/*.dll | tr ' ' ';') 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 # Build the thing
[ -d _build ] && rm -Rf _build/ [ -d _build ] && rm -Rf _build/
@ -137,9 +139,8 @@ cmake .. \
\ \
-DVORBIS_INCLUDE_DIR=$libdir/libvorbis/include \ -DVORBIS_INCLUDE_DIR=$libdir/libvorbis/include \
-DVORBIS_LIBRARY=$libdir/libvorbis/lib/libvorbis.dll.a \ -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_LIBRARY=$libdir/libvorbis/lib/libvorbisfile.dll.a \
-DVORBISFILE_DLL=$libdir/libvorbis/bin/libvorbisfile-3.dll \
\ \
-DOPENAL_INCLUDE_DIR=$libdir/openal_stripped/include/AL \ -DOPENAL_INCLUDE_DIR=$libdir/openal_stripped/include/AL \
-DOPENAL_LIBRARY=$libdir/openal_stripped/lib/libOpenAL32.dll.a \ -DOPENAL_LIBRARY=$libdir/openal_stripped/lib/libOpenAL32.dll.a \
@ -150,8 +151,7 @@ cmake .. \
-DCURL_LIBRARY=$libdir/libcurl/lib/libcurl.dll.a \ -DCURL_LIBRARY=$libdir/libcurl/lib/libcurl.dll.a \
\ \
-DGETTEXT_MSGFMT=`which msgfmt` \ -DGETTEXT_MSGFMT=`which msgfmt` \
-DGETTEXT_DLL=$libdir/gettext/bin/libintl-8.dll \ -DGETTEXT_DLL="$gettext_dlls" \
-DGETTEXT_ICONV_DLL=$libdir/gettext/bin/libiconv-2.dll \
-DGETTEXT_INCLUDE_DIR=$libdir/gettext/include \ -DGETTEXT_INCLUDE_DIR=$libdir/gettext/include \
-DGETTEXT_LIBRARY=$libdir/gettext/lib/libintl.dll.a \ -DGETTEXT_LIBRARY=$libdir/gettext/lib/libintl.dll.a \
\ \

@ -93,6 +93,8 @@ if [ "x$NO_MINETEST_GAME" = "x" ]; then
fi fi
irr_dlls=$(echo $libdir/irrlicht/bin/*.dll | tr ' ' ';') 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 # Build the thing
[ -d _build ] && rm -Rf _build/ [ -d _build ] && rm -Rf _build/
@ -127,9 +129,8 @@ cmake .. \
\ \
-DVORBIS_INCLUDE_DIR=$libdir/libvorbis/include \ -DVORBIS_INCLUDE_DIR=$libdir/libvorbis/include \
-DVORBIS_LIBRARY=$libdir/libvorbis/lib/libvorbis.dll.a \ -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_LIBRARY=$libdir/libvorbis/lib/libvorbisfile.dll.a \
-DVORBISFILE_DLL=$libdir/libvorbis/bin/libvorbisfile-3.dll \
\ \
-DOPENAL_INCLUDE_DIR=$libdir/openal_stripped/include/AL \ -DOPENAL_INCLUDE_DIR=$libdir/openal_stripped/include/AL \
-DOPENAL_LIBRARY=$libdir/openal_stripped/lib/libOpenAL32.dll.a \ -DOPENAL_LIBRARY=$libdir/openal_stripped/lib/libOpenAL32.dll.a \
@ -140,8 +141,7 @@ cmake .. \
-DCURL_LIBRARY=$libdir/libcurl/lib/libcurl.dll.a \ -DCURL_LIBRARY=$libdir/libcurl/lib/libcurl.dll.a \
\ \
-DGETTEXT_MSGFMT=`which msgfmt` \ -DGETTEXT_MSGFMT=`which msgfmt` \
-DGETTEXT_DLL=$libdir/gettext/bin/libintl-8.dll \ -DGETTEXT_DLL="$gettext_dlls" \
-DGETTEXT_ICONV_DLL=$libdir/gettext/bin/libiconv-2.dll \
-DGETTEXT_INCLUDE_DIR=$libdir/gettext/include \ -DGETTEXT_INCLUDE_DIR=$libdir/gettext/include \
-DGETTEXT_LIBRARY=$libdir/gettext/lib/libintl.dll.a \ -DGETTEXT_LIBRARY=$libdir/gettext/lib/libintl.dll.a \
\ \