-
Notifications
You must be signed in to change notification settings - Fork 23
/
openexr_w7.patch
115 lines (111 loc) · 4.04 KB
/
openexr_w7.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
diff --git a/build.cmd b/build.cmd
new file mode 100644
index 00000000..0c367fb3
--- /dev/null
+++ b/build.cmd
@@ -0,0 +1,23 @@
+set BLIBS=%1
+mkdir build
+cd build
+cmake ^
+ -G Ninja ^
+ -DCMAKE_INSTALL_PREFIX=%BLIBS%/openexr ^
+ -DCMAKE_BUILD_TYPE=Release ^
+ -DCMAKE_CXX_STANDARD_LIBRARIES="kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib psapi.lib" ^
+ -DCMAKE_BUILD_TYPE=Release ^
+ -DZLIB_LIBRARY=%BLIBS%\zlib\lib\libz_st.lib ^
+ -DZLIB_INCLUDE_DIR=%BLIBS%\zlib\include ^
+ -DBUILD_TESTING=OFF ^
+ -DOPENEXR_BUILD_BOTH_STATIC_SHARED=OFF ^
+ -DBUILD_SHARED_LIBS=ON ^
+ -DOPENEXR_INSTALL_TOOLS=OFF ^
+ -DOPENEXR_INSTALL_EXAMPLES=OFF ^
+ -DImath_DIR=%BLIBS%\imath\lib\cmake\Imath ^
+ -Dlibdeflate_DIR=%BLIBS%\deflate\lib\cmake\libdeflate ^
+ -DOPENEXR_LIB_SUFFIX= ^
+ ..
+ninja
+ninja install
+cd ..
diff --git a/cmake/OpenEXRSetup.cmake b/cmake/OpenEXRSetup.cmake
index ef5c6c08..3eddfeb1 100644
--- a/cmake/OpenEXRSetup.cmake
+++ b/cmake/OpenEXRSetup.cmake
@@ -160,14 +160,22 @@ set(OPENEXR_DEFLATE_TAG "v1.18" CACHE STRING "Tag to use for libdeflate source r
if(NOT OPENEXR_FORCE_INTERNAL_DEFLATE)
#TODO: ^^ Release should not clone from main, this is a place holder
set(CMAKE_IGNORE_PATH "${CMAKE_CURRENT_BINARY_DIR}/_deps/deflate-src/config;${CMAKE_CURRENT_BINARY_DIR}/_deps/deflate-build/config")
- include(FindPkgConfig)
- pkg_check_modules(deflate IMPORTED_TARGET GLOBAL libdeflate)
- set(CMAKE_IGNORE_PATH)
- if (deflate_FOUND)
- message(STATUS "Using libdeflate from ${deflate_LINK_LIBRARIES}")
+ find_package(libdeflate CONFIG)
+ if(libdeflate_FOUND)
+ message(STATUS "Using libdeflate from ${libdeflate_DIR}")
+ else()
+ include(FindPkgConfig)
+ pkg_check_modules(deflate IMPORTED_TARGET GLOBAL libdeflate)
+ set(CMAKE_IGNORE_PATH)
+ if (deflate_FOUND)
+ message(STATUS "Using libdeflate from ${deflate_LINK_LIBRARIES}")
+ endif()
endif()
endif()
+if(libdeflate_FOUND)
+ set(EXR_DEFLATE_LIB libdeflate::libdeflate_static)
+else()
if(NOT TARGET PkgConfig::deflate AND NOT deflate_FOUND)
if(OPENEXR_FORCE_INTERNAL_DEFLATE)
message(STATUS "libdeflate forced internal, installing from ${OPENEXR_DEFLATE_REPO} (${OPENEXR_DEFLATE_TAG})")
@@ -224,6 +232,7 @@ else()
endif()
set(EXR_DEFLATE_SOURCES)
endif()
+endif()
#######################################
# Find or install Imath
diff --git a/src/lib/OpenEXRCore/internal_win32_file_impl.h b/src/lib/OpenEXRCore/internal_win32_file_impl.h
index cda37161..fe7a1165 100644
--- a/src/lib/OpenEXRCore/internal_win32_file_impl.h
+++ b/src/lib/OpenEXRCore/internal_win32_file_impl.h
@@ -316,10 +316,6 @@ default_init_read_file (struct _internal_exr_context* file)
wcFn = widen_filename (file, file->filename.str);
if (wcFn)
{
-#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
- fd = CreateFile2 (
- wcFn, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, NULL);
-#else
fd = CreateFileW (
wcFn,
GENERIC_READ,
@@ -328,7 +324,6 @@ default_init_read_file (struct _internal_exr_context* file)
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, /* TBD: use overlapped? | FILE_FLAG_OVERLAPPED */
NULL);
-#endif
file->free_fn (wcFn);
if (fd == INVALID_HANDLE_VALUE)
@@ -363,14 +358,6 @@ default_init_write_file (struct _internal_exr_context* file)
wcFn = widen_filename (file, outfn);
if (wcFn)
{
-#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
- fd = CreateFile2 (
- wcFn,
- GENERIC_WRITE | DELETE,
- 0, /* no sharing */
- CREATE_ALWAYS,
- NULL);
-#else
fd = CreateFileW (
wcFn,
GENERIC_WRITE | DELETE,
@@ -379,7 +366,6 @@ default_init_write_file (struct _internal_exr_context* file)
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, /* TBD: use overlapped? | FILE_FLAG_OVERLAPPED */
NULL);
-#endif
file->free_fn (wcFn);
if (fd == INVALID_HANDLE_VALUE)