Skip to content

Commit

Permalink
[windows] fix building for UWP with Visual Studio
Browse files Browse the repository at this point in the history
  • Loading branch information
Rechi committed Mar 8, 2018
1 parent d35bdd1 commit bc0f828
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -34,7 +34,7 @@ set(DEPLIBS ${LibArchive_LIBRARIES}
${LZ4_LIBRARIES}
${LZO2_LIBRARIES})

add_definitions(-DLIBARCHIVE_STATIC)
add_definitions(-DLIBARCHIVE_STATIC -D_CRT_NONSTDC_NO_DEPRECATE)

build_addon(vfs.libarchive ARCHIVE DEPLIBS)
include(CPack)
2 changes: 1 addition & 1 deletion depends/common/bz2/CMakeLists.txt
Expand Up @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 2.8)
if(NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FILE_OFFSET_BITS=64")
elseif(CMAKE_SYSTEM_NAME STREQUAL WindowsStore)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS)
endif()

set(SOURCES blocksort.c
Expand Down
15 changes: 12 additions & 3 deletions depends/windows/libarchive/04-fix-uwp.patch
Expand Up @@ -30,7 +30,7 @@ index 73bf07b..ff6d610 100644
ENDIF(WIN32)

IF(MSVC)
@@ -1267,8 +1267,13 @@ CHECK_FUNCTION_EXISTS_GLIBC(utimensat HAVE_UTIMENSAT)
@@ -1267,8 +1271,13 @@ CHECK_FUNCTION_EXISTS_GLIBC(utimensat HAVE_UTIMENSAT)
CHECK_FUNCTION_EXISTS_GLIBC(vfork HAVE_VFORK)
CHECK_FUNCTION_EXISTS_GLIBC(wcrtomb HAVE_WCRTOMB)
CHECK_FUNCTION_EXISTS_GLIBC(wcscmp HAVE_WCSCMP)
Expand All @@ -46,7 +46,7 @@ index 73bf07b..ff6d610 100644
CHECK_FUNCTION_EXISTS_GLIBC(wctomb HAVE_WCTOMB)
CHECK_FUNCTION_EXISTS_GLIBC(_ctime64_s HAVE__CTIME64_S)
CHECK_FUNCTION_EXISTS_GLIBC(_fseeki64 HAVE__FSEEKI64)
@@ -1870,7 +1874,9 @@ CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA384;SHA512" OPENSSL)
@@ -1870,7 +1879,9 @@ CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA384;SHA512" OPENSSL)
# Libmd has to be probed after OpenSSL.
CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA512" LIBMD)

Expand All @@ -57,6 +57,15 @@ index 73bf07b..ff6d610 100644

# Generate "config.h" from "build/cmake/config.h.in"
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in
@@ -1906,7 +1917,7 @@ if(NOT WIN32)
ENDIF()
#
IF(MSVC)
- ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
+ ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE)
ENDIF(MSVC)

IF(ENABLE_TEST)
diff --git a/cpio/CMakeLists.txt b/cpio/CMakeLists.txt
index 85fda77..233a5fa 100644
--- a/cpio/CMakeLists.txt
Expand All @@ -78,7 +87,7 @@ diff --git a/libarchive/CMakeLists.txt b/libarchive/CMakeLists.txt
index 5e958da..6044f01 100644
--- a/libarchive/CMakeLists.txt
+++ b/libarchive/CMakeLists.txt
@@ -204,14 +204,14 @@ SET(libarchive_MANS
@@ -205,14 +205,14 @@ SET(libarchive_MANS
tar.5
)

Expand Down
2 changes: 1 addition & 1 deletion depends/windows/libarchive/05-don-t-try_run-for-uwp.patch
Expand Up @@ -2,7 +2,7 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
index bbbdb50..9ac0f0e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -399,11 +399,13 @@ IF(ZLIB_FOUND)
@@ -403,11 +403,13 @@ IF(ZLIB_FOUND)
#
# Test if ZLIB_WINAPI macro is needed to use.
#
Expand Down

0 comments on commit bc0f828

Please sign in to comment.