aboutsummaryrefslogtreecommitdiff
path: root/ports/upb/fix-cmakelists.patch
blob: 4c7ab1413b2dd2d9e8607bf5e9c7d967f16d9819 (plain)
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 836c5ff..6ee66a7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,90 +58,148 @@ elseif(UNIX)
   set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--build-id")
 endif()
 
-enable_testing()
+if (ENABLE_TEST)
+    enable_testing()
+endif()
 
+set(UPB_HDRS
+  ${CMAKE_CURRENT_LIST_DIR}/upb/generated_util.h
+  ${CMAKE_CURRENT_LIST_DIR}/upb/msg.h
+  ${CMAKE_CURRENT_LIST_DIR}/upb/table.int.h
+  ${CMAKE_CURRENT_LIST_DIR}/upb/port_def.inc
+  ${CMAKE_CURRENT_LIST_DIR}/upb/port_undef.inc
+  ${CMAKE_CURRENT_LIST_DIR}/upb/decode.h
+  ${CMAKE_CURRENT_LIST_DIR}/upb/encode.h
+  ${CMAKE_CURRENT_LIST_DIR}/upb/upb.h
+)
+
+set(UBP_PROJECTS upb)
 add_library(upb
   upb/decode.c
   upb/encode.c
-  upb/generated_util.h
   upb/msg.c
-  upb/msg.h
   upb/port.c
-  upb/port_def.inc
-  upb/port_undef.inc
   upb/table.c
-  upb/table.int.h
   upb/upb.c
-  upb/decode.h
-  upb/encode.h
-  upb/upb.h)
+  upb/upb.h
+  ${UPB_HDRS})
+
+
+set(UBP_PROJECTS ${UBP_PROJECTS} generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me)
 add_library(generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me INTERFACE)
 target_link_libraries(generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me INTERFACE
   upb)
+
+set(REFLECTION_HDRS
+  ${CMAKE_CURRENT_LIST_DIR}/upb/def.h
+  ${CMAKE_CURRENT_LIST_DIR}/upb/msgfactory.h
+)
+
+set(UBP_PROJECTS ${UBP_PROJECTS} reflection)
 add_library(reflection
   upb/def.c
   upb/msgfactory.c
-  upb/def.h
-  upb/msgfactory.h)
+  ${REFLECTION_HDRS})
 target_link_libraries(reflection
   descriptor_upbproto
   table
   upb)
+
+set(UBP_PROJECTS ${UBP_PROJECTS} table)
 add_library(table INTERFACE)
 target_link_libraries(table INTERFACE
   upb)
+
+set(LEGACY_MSG_HDRS ${CMAKE_CURRENT_LIST_DIR}/upb/legacy_msg_reflection.h)
+
+set(UBP_PROJECTS ${UBP_PROJECTS} legacy_msg_reflection)
 add_library(legacy_msg_reflection
   upb/legacy_msg_reflection.c
-  upb/legacy_msg_reflection.h)
+  ${LEGACY_MSG_HDRS})
 target_link_libraries(legacy_msg_reflection
   table
   upb)
+
+set(HANDLERS_HDRS
+  ${CMAKE_CURRENT_LIST_DIR}/upb/handlers-inl.h
+  ${CMAKE_CURRENT_LIST_DIR}/upb/handlers.h
+  ${CMAKE_CURRENT_LIST_DIR}/upb/sink.h
+)
+
+set(UBP_PROJECTS ${UBP_PROJECTS} handlers)
 add_library(handlers
   upb/handlers.c
-  upb/handlers-inl.h
   upb/sink.c
-  upb/handlers.h
-  upb/sink.h)
+  ${HANDLERS_HDRS})
 target_link_libraries(handlers
   reflection
   table
   upb)
+
+set(UPB_PB_HDRS
+  ${CMAKE_CURRENT_LIST_DIR}/upb/pb/decoder.int.h
+  ${CMAKE_CURRENT_LIST_DIR}/upb/pb/varint.int.h
+  ${CMAKE_CURRENT_LIST_DIR}/upb/pb/decoder.h
+  ${CMAKE_CURRENT_LIST_DIR}/upb/pb/encoder.h
+  ${CMAKE_CURRENT_LIST_DIR}/upb/pb/textprinter.h
+)
+
+set(UBP_PROJECTS ${UBP_PROJECTS} upb_pb)
 add_library(upb_pb
   upb/pb/compile_decoder.c
   upb/pb/decoder.c
-  upb/pb/decoder.int.h
   upb/pb/encoder.c
   upb/pb/textprinter.c
   upb/pb/varint.c
-  upb/pb/varint.int.h
-  upb/pb/decoder.h
-  upb/pb/encoder.h
-  upb/pb/textprinter.h)
+  ${UPB_PB_HDRS})
 target_link_libraries(upb_pb
   descriptor_upbproto
   handlers
   reflection
   table
   upb)
+  
+set(UPB_JSON_HDRS
+  ${CMAKE_CURRENT_LIST_DIR}/upb/json/parser.h
+  ${CMAKE_CURRENT_LIST_DIR}/upb/json/printer.h
+)
+
+set(UBP_PROJECTS ${UBP_PROJECTS} upb_json)
 add_library(upb_json
   generated_for_cmake/upb/json/parser.c
   upb/json/printer.c
-  upb/json/parser.h
-  upb/json/printer.h)
+  ${UPB_JSON_HDRS})
 target_link_libraries(upb_json
   upb
   upb_pb)
+
+set(UBP_PROJECTS ${UBP_PROJECTS} upb_cc_bindings)
 add_library(upb_cc_bindings INTERFACE)
 target_link_libraries(upb_cc_bindings INTERFACE
   descriptor_upbproto
   handlers
   upb)
-add_library(upb_test
-  tests/testmain.cc
-  tests/test_util.h
-  tests/upb_test.h)
-target_link_libraries(upb_test
-  handlers
-  upb)
-
 
+if (ENABLE_TEST)
+  set(UBP_PROJECTS ${UBP_PROJECTS} upb_test)
+  add_library(upb_test
+    tests/testmain.cc
+    tests/test_util.h
+    tests/upb_test.h)
+  target_link_libraries(upb_test
+    handlers
+    upb)
+endif()
+ 
+install(FILES ${UPB_HDRS} ${REFLECTION_HDRS} ${LEGACY_MSG_HDRS} ${HANDLERS_HDRS} DESTINATION include/upb)
+install(FILES ${UPB_PB_HDRS} DESTINATION include/upb/pb)
+install(FILES ${UPB_JSON_HDRS} DESTINATION include/upb/json)
+
+foreach(PROJ ${UBP_PROJECTS})
+    install(
+    TARGETS ${PROJ}
+    RUNTIME DESTINATION bin
+    LIBRARY DESTINATION lib
+    ARCHIVE DESTINATION lib
+    )
+endforeach()
\ No newline at end of file