-
Notifications
You must be signed in to change notification settings - Fork 0
/
0001-zlib-CMakeLists.txt.patch
104 lines (97 loc) · 3.51 KB
/
0001-zlib-CMakeLists.txt.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
From 26aa1b4b01556a65f60ec628373ed932ba04c26d Mon Sep 17 00:00:00 2001
From: radhikaj <[email protected]>
Date: Wed, 26 Jun 2019 20:41:45 +0000
Subject: [PATCH] CMakeLists.txt
Get Zlib to build
---
CMakeLists.txt | 15 ++++++++++++++-
zlib_oe_enclave.pc.cmakein | 13 +++++++++++++
zlib_oe_enclave.pc.in | 13 +++++++++++++
3 files changed, 40 insertions(+), 1 deletion(-)
create mode 100644 zlib_oe_enclave.pc.cmakein
create mode 100644 zlib_oe_enclave.pc.in
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0fe939d..0ce8f8b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -79,8 +79,12 @@ if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
endif()
set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc)
+set(ZLIB_OE_ENCLAVE_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib_oe_enclave.pc)
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein
${ZLIB_PC} @ONLY)
+configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib_oe_enclave.pc.cmakein
+ ${ZLIB_OE_ENCLAVE_PC} @ONLY )
+
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein
${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
@@ -185,6 +189,14 @@ endif(MINGW)
add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
+
+# The enclave lib is always static
+find_package(OpenEnclave CONFIG REQUIRED)
+add_library(zlibstatic_oe_enclave STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
+target_link_libraries(zlibstatic_oe_enclave PUBLIC
+ openenclave::oeenclave
+ openenclave::oelibcxx)
+
set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
set_target_properties(zlib PROPERTIES SOVERSION 1)
@@ -202,6 +214,7 @@ endif()
if(UNIX)
# On unix-like platforms the library is almost always called libz
set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z)
+ set_target_properties(zlibstatic_oe_enclave PROPERTIES OUTPUT_NAME zlib_oe_enclave)
if(NOT APPLE)
set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
endif()
@@ -211,7 +224,7 @@ elseif(BUILD_SHARED_LIBS AND WIN32)
endif()
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
- install(TARGETS zlib zlibstatic
+ install(TARGETS zlib zlibstatic zlibstatic_oe_enclave
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" )
diff --git a/zlib_oe_enclave.pc.cmakein b/zlib_oe_enclave.pc.cmakein
new file mode 100644
index 0000000..9b73ba5
--- /dev/null
+++ b/zlib_oe_enclave.pc.cmakein
@@ -0,0 +1,13 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@
+libdir=@INSTALL_LIB_DIR@
+sharedlibdir=@INSTALL_LIB_DIR@
+includedir=@INSTALL_INC_DIR@
+
+Name: zlib_oe_enclave
+Description: zlib compression library for openenclave
+Version: @VERSION@
+
+Requires:
+Libs: -L${sharedlibdir} -lz
+Cflags: -I${includedir}
diff --git a/zlib_oe_enclave.pc.in b/zlib_oe_enclave.pc.in
new file mode 100644
index 0000000..fc4adca
--- /dev/null
+++ b/zlib_oe_enclave.pc.in
@@ -0,0 +1,13 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+sharedlibdir=@sharedlibdir@
+includedir=@includedir@
+
+Name: zlib_oe_enclave
+Description: zlib compression library
+Version: @VERSION@
+
+Requires:
+Libs: -L${libdir} -L${sharedlibdir} -lz
+Cflags: -I${includedir}
--
2.7.4