aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoradrido <robots_only_adrido@gmx.com>2019-06-10 03:56:55 +0200
committerrubenwardy <rw@rubenwardy.com>2019-06-10 02:56:55 +0100
commitbd6f1cca9dc357a6dbd54e86b3f575282daf6e1e (patch)
tree4f22d7ae58c5a1641fe1601d3e4e67b3c73ad51d /src
parent9a07792f4d79ae5b386b781e6e73377f5758ee6a (diff)
downloadminetest-bd6f1cca9dc357a6dbd54e86b3f575282daf6e1e.tar.gz
minetest-bd6f1cca9dc357a6dbd54e86b3f575282daf6e1e.tar.bz2
minetest-bd6f1cca9dc357a6dbd54e86b3f575282daf6e1e.zip
Add compatibility to vcpkg buildsystem (#8317)
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt145
-rw-r--r--src/serialization.cpp4
2 files changed, 76 insertions, 73 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 45008e337..cb920e875 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -176,7 +176,7 @@ option(ENABLE_LEVELDB "Enable LevelDB backend" TRUE)
set(USE_LEVELDB FALSE)
if(ENABLE_LEVELDB)
- find_library(LEVELDB_LIBRARY leveldb)
+ find_library(LEVELDB_LIBRARY NAMES leveldb libleveldb)
find_path(LEVELDB_INCLUDE_DIR db.h PATH_SUFFIXES leveldb)
if(LEVELDB_LIBRARY AND LEVELDB_INCLUDE_DIR)
set(USE_LEVELDB TRUE)
@@ -251,32 +251,23 @@ if(WIN32)
set(PLATFORM_LIBS ws2_32.lib version.lib shlwapi.lib ${PLATFORM_LIBS})
# Zlib stuff
- set(ZLIB_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/../../zlib/zlib-1.2.5"
- CACHE PATH "Zlib include directory")
- set(ZLIB_LIBRARIES "${PROJECT_SOURCE_DIR}/../../zlib125dll/dll32/zlibwapi.lib"
- CACHE FILEPATH "Path to zlib library (usually zlibwapi.lib)")
- set(ZLIB_DLL "${PROJECT_SOURCE_DIR}/../../zlib125dll/dll32/zlibwapi.dll"
- CACHE FILEPATH "Path to zlib DLL (for installation)")
- set(ZLIBWAPI_DLL "" CACHE FILEPATH "Path to zlibwapi DLL")
- set(IRRLICHT_SOURCE_DIR "${PROJECT_SOURCE_DIR}/../../irrlicht-1.7.2"
- CACHE PATH "irrlicht dir")
- if(USE_FREETYPE)
- set(FREETYPE_INCLUDE_DIR_ft2build "${PROJECT_SOURCE_DIR}/../../freetype2/include/"
- CACHE PATH "freetype include dir")
- set(FREETYPE_INCLUDE_DIR_freetype2 "${PROJECT_SOURCE_DIR}/../../freetype2/include/freetype"
- CACHE PATH "freetype include dir")
- set(FREETYPE_LIBRARY "${PROJECT_SOURCE_DIR}/../../freetype2/objs/win32/vc2005/freetype247.lib"
- CACHE FILEPATH "Path to freetype247.lib")
- endif()
- 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)")
- endif()
- if(USE_LUAJIT)
- set(LUA_DLL "" CACHE FILEPATH "Path to lua51.dll for installation (optional)")
+ find_path(ZLIB_INCLUDE_DIR "zlib.h" DOC "Zlib include directory")
+ find_library(ZLIB_LIBRARIES "zlib" DOC "Path to zlib library")
+
+ # Dll's are automatically copied to the output directory by vcpkg when VCPKG_APPLOCAL_DEPS=ON
+ if(NOT VCPKG_APPLOCAL_DEPS)
+ find_file(ZLIB_DLL NAMES "zlib.dll" "zlib1.dll" DOC "Path to zlib.dll for installation (optional)")
+ 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)")
+ endif()
+ if(USE_LUAJIT)
+ set(LUA_DLL "" CACHE FILEPATH "Path to lua51.dll for installation (optional)")
+ endif()
endif()
+
else()
# Unix probably
if(BUILD_CLIENT)
@@ -703,12 +694,6 @@ else()
set(OTHER_FLAGS "${OTHER_FLAGS} -Wsign-compare")
endif()
- if(WIN32 AND NOT ZLIBWAPI_DLL AND CMAKE_SIZEOF_VOID_P EQUAL 4)
- set(OTHER_FLAGS "${OTHER_FLAGS} -DWIN32_NO_ZLIB_WINAPI")
- message(WARNING "Defaulting to cdecl for zlib on win32 because ZLIBWAPI_DLL"
- " isn't set, ensure that ZLIBWAPI_DLL is set if you want stdcall.")
- endif()
-
if(MINGW)
set(OTHER_FLAGS "${OTHER_FLAGS} -mthreads -fexceptions")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWIN32_LEAN_AND_MEAN")
@@ -736,40 +721,58 @@ endif()
# Installation
if(WIN32)
- if(USE_SOUND)
- if(OPENAL_DLL)
- install(FILES ${OPENAL_DLL} DESTINATION ${BINDIR})
+ if(VCPKG_APPLOCAL_DEPS)
+ # Collect the dll's from the output path
+ install(DIRECTORY ${EXECUTABLE_OUTPUT_PATH}/Release/
+ DESTINATION ${BINDIR}
+ CONFIGURATIONS Release
+ FILES_MATCHING PATTERN "*.dll")
+ install(DIRECTORY ${EXECUTABLE_OUTPUT_PATH}/Debug/
+ DESTINATION ${BINDIR}
+ CONFIGURATIONS Debug
+ FILES_MATCHING PATTERN "*.dll")
+ install(DIRECTORY ${EXECUTABLE_OUTPUT_PATH}/RelWithDebInfo/
+ DESTINATION ${BINDIR}
+ CONFIGURATIONS RelWithDebInfo
+ FILES_MATCHING PATTERN "*.dll")
+ install(DIRECTORY ${EXECUTABLE_OUTPUT_PATH}/MinSizeRel/
+ DESTINATION ${BINDIR}
+ CONFIGURATIONS RelWithDebInfo
+ FILES_MATCHING PATTERN "*.dll")
+ else()
+ # Use the old-style way to install dll's
+ if(USE_SOUND)
+ if(OPENAL_DLL)
+ install(FILES ${OPENAL_DLL} DESTINATION ${BINDIR})
+ endif()
+ if(OGG_DLL)
+ install(FILES ${OGG_DLL} DESTINATION ${BINDIR})
+ endif()
+ if(VORBIS_DLL)
+ install(FILES ${VORBIS_DLL} DESTINATION ${BINDIR})
+ endif()
+ if(VORBISFILE_DLL)
+ install(FILES ${VORBISFILE_DLL} DESTINATION ${BINDIR})
+ endif()
endif()
- if(OGG_DLL)
- install(FILES ${OGG_DLL} DESTINATION ${BINDIR})
+ if(CURL_DLL)
+ install(FILES ${CURL_DLL} DESTINATION ${BINDIR})
endif()
- if(VORBIS_DLL)
- install(FILES ${VORBIS_DLL} DESTINATION ${BINDIR})
+ if(ZLIB_DLL)
+ install(FILES ${ZLIB_DLL} DESTINATION ${BINDIR})
endif()
- if(VORBISFILE_DLL)
- install(FILES ${VORBISFILE_DLL} DESTINATION ${BINDIR})
+ if(FREETYPE_DLL)
+ install(FILES ${FREETYPE_DLL} DESTINATION ${BINDIR})
+ endif()
+ if(SQLITE3_DLL)
+ install(FILES ${SQLITE3_DLL} DESTINATION ${BINDIR})
+ endif()
+ if(LEVELDB_DLL)
+ install(FILES ${LEVELDB_DLL} DESTINATION ${BINDIR})
+ endif()
+ if(LUA_DLL)
+ install(FILES ${LUA_DLL} DESTINATION ${BINDIR})
endif()
- endif()
- if(CURL_DLL)
- install(FILES ${CURL_DLL} DESTINATION ${BINDIR})
- endif()
- if(ZLIB_DLL)
- install(FILES ${ZLIB_DLL} DESTINATION ${BINDIR})
- endif()
- if(ZLIBWAPI_DLL)
- install(FILES ${ZLIBWAPI_DLL} DESTINATION ${BINDIR})
- endif()
- if(FREETYPE_DLL)
- install(FILES ${FREETYPE_DLL} DESTINATION ${BINDIR})
- endif()
- if(SQLITE3_DLL)
- install(FILES ${SQLITE3_DLL} DESTINATION ${BINDIR})
- endif()
- if(LEVELDB_DLL)
- install(FILES ${LEVELDB_DLL} DESTINATION ${BINDIR})
- endif()
- if(LUA_DLL)
- install(FILES ${LUA_DLL} DESTINATION ${BINDIR})
endif()
endif()
@@ -806,15 +809,17 @@ if(BUILD_CLIENT)
endif()
if(WIN32)
- if(DEFINED IRRLICHT_DLL)
- install(FILES ${IRRLICHT_DLL} DESTINATION ${BINDIR})
- endif()
- if(USE_GETTEXT)
- if(DEFINED GETTEXT_DLL)
- install(FILES ${GETTEXT_DLL} DESTINATION ${BINDIR})
+ if(NOT VCPKG_APPLOCAL_DEPS)
+ if(DEFINED IRRLICHT_DLL)
+ install(FILES ${IRRLICHT_DLL} DESTINATION ${BINDIR})
endif()
- if(DEFINED GETTEXT_ICONV_DLL)
- install(FILES ${GETTEXT_ICONV_DLL} DESTINATION ${BINDIR})
+ 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()
diff --git a/src/serialization.cpp b/src/serialization.cpp
index ac6fc0db2..36ddb467c 100644
--- a/src/serialization.cpp
+++ b/src/serialization.cpp
@@ -20,9 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "serialization.h"
#include "util/serialize.h"
-#if defined(_WIN32) && !defined(WIN32_NO_ZLIB_WINAPI)
- #define ZLIB_WINAPI
-#endif
+
#include "zlib.h"
/* report a zlib or i/o error */