@@ -36,6 +36,8 @@ if (UNIX)
36
36
set (Onnxruntime_INCLUDE_HINT /usr/local/include /)
37
37
endif ()
38
38
39
+ set (RELEASE_DIR "${PROJECT_SOURCE_DIR} /release" CACHE STRING "Directory for building release packages" )
40
+
39
41
set (CMAKE_PREFIX_PATH "${QTDIR} " )
40
42
set (CMAKE_INCLUDE_CURRENT_DIR ON )
41
43
set (CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH} ;${CMAKE_SOURCE_DIR} /external" )
@@ -121,9 +123,7 @@ if(WIN32)
121
123
endif ()
122
124
123
125
# find the onnxruntime DLL for packaging with the plugin DLL
124
- if (WIN32 )
125
- set (Onnxruntime_DLL "${Onnxruntime_LIBRARY_DIR} /onnxruntime.dll" )
126
- endif ()
126
+ set (Onnxruntime_DLL "${Onnxruntime_LIBRARY_DIR} /onnxruntime.dll" )
127
127
128
128
# Enable Multicore Builds and disable FH4 (to not depend on VCRUNTIME140_1.DLL when building with VS2019)
129
129
if (MSVC )
@@ -148,8 +148,6 @@ if(WIN32)
148
148
149
149
# --- Release package helper ---
150
150
# The "release" folder has a structure similar OBS' one on Windows
151
- set (RELEASE_DIR "${PROJECT_SOURCE_DIR} /release" )
152
-
153
151
add_custom_command (TARGET ${CMAKE_PROJECT_NAME} POST_BUILD
154
152
# If config is Release or RelWithDebInfo, package release files
155
153
COMMAND if $<OR :$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>>==1 (
@@ -209,9 +207,7 @@ if(WIN32)
209
207
)
210
208
# --- End of sub-section ---
211
209
212
- install (DIRECTORY "${RELEASE_DIR} /"
213
- DESTINATION .
214
- )
210
+ install (DIRECTORY "${RELEASE_DIR} /" DESTINATION .)
215
211
# Tell CPack to create a zip file.
216
212
set (CPACK_GENERATOR "ZIP" )
217
213
# Tell CPack what to name the zip file. It will append `.zip`.
@@ -251,5 +247,38 @@ if(APPLE)
251
247
252
248
set_target_properties (${CMAKE_PROJECT_NAME} PROPERTIES PREFIX "" )
253
249
target_link_libraries (${CMAKE_PROJECT_NAME} "${OBS_FRONTEND_LIB} " )
250
+
251
+ add_custom_command (TARGET ${CMAKE_PROJECT_NAME} POST_BUILD
252
+ # If config is Release or RelWithDebInfo, package release files
253
+ COMMAND
254
+ "${CMAKE_COMMAND} " ARGS -E make_directory
255
+ "${RELEASE_DIR} /Resources/data/obs-plugins/${CMAKE_PROJECT_NAME} "
256
+ "${RELEASE_DIR} /Plugins"
257
+
258
+
259
+ COMMAND
260
+ "${CMAKE_COMMAND} " ARGS -E copy_directory
261
+ "${PROJECT_SOURCE_DIR} /data"
262
+ "${RELEASE_DIR} /Resources/data/obs-plugins/${CMAKE_PROJECT_NAME} "
263
+
264
+
265
+ COMMAND
266
+ "${CMAKE_COMMAND} " ARGS -E copy
267
+ "$<TARGET_FILE:${CMAKE_PROJECT_NAME} >"
268
+ "${RELEASE_DIR} /Plugins/"
269
+
270
+ )
271
+
272
+ install (DIRECTORY "${RELEASE_DIR} /" DESTINATION .)
273
+
274
+ # Tell CPack to create a zip file.
275
+ set (CPACK_GENERATOR "ZIP" )
276
+ # Tell CPack what to name the zip file. It will append `.zip`.
277
+ set (CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME} -macosx" )
278
+ # Tell CPack not to put everything inside an enclosing directory.
279
+ set (CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF )
280
+ # Apparently this should be always on but isn't for backwards compatibility.
281
+ set (CPACK_VERBATIM_VARIABLES YES )
282
+ include (CPack)
254
283
endif ()
255
284
# -- End of section --
0 commit comments