Skip to content

Commit 1632919

Browse files
AdelKSartificiel
andcommitted
meson: add macos specific tweaks
Treat files as Objective-C++ instead of C++ because some included macos headers are Objective-C++ Objective-C++ apparently is a superset of C++ so we should be all good Co-authored-by: Alexandre Burton <[email protected]> Co-authored-by: Adel KARA SLIMANE <[email protected]>
1 parent bc20719 commit 1632919

File tree

1 file changed

+40
-7
lines changed

1 file changed

+40
-7
lines changed

meson.build

+40-7
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,6 @@ install_headers(
198198
'libs/openFrameworks/utils/ofURLFileLoader.h',
199199
'libs/openFrameworks/utils/ofUtils.h',
200200
'libs/openFrameworks/utils/ofXml.h',
201-
'libs/openFrameworks/video/ofAVFoundationGrabber.h',
202-
'libs/openFrameworks/video/ofAVFoundationPlayer.h',
203-
'libs/openFrameworks/video/ofAVFoundationVideoPlayer.h',
204201
'libs/openFrameworks/video/ofDirectShowGrabber.h',
205202
'libs/openFrameworks/video/ofDirectShowPlayer.h',
206203
'libs/openFrameworks/video/ofMediaFoundationPlayer.h',
@@ -262,11 +259,46 @@ if host_machine.system() == 'linux'
262259
subdir: 'openframeworks'
263260
)
264261

262+
elif host_machine.system() == 'darwin'
263+
264+
deps += [
265+
dependency('Cocoa'),
266+
dependency('AppKit'),
267+
dependency('Foundation'),
268+
dependency('AVKit'),
269+
dependency('GLKit'),
270+
dependency('AVFoundation'),
271+
dependency('opengl'),
272+
dependency('coremedia'),
273+
dependency('corevideo'),
274+
dependency('accelerate')
275+
]
276+
add_languages('objcpp', native: false)
277+
add_languages('objc', native: false)
278+
add_project_arguments(['-ObjC++', '-fobjc-arc'], language: ['cpp', 'objcpp', 'objc'])
279+
280+
sources += files(
281+
'libs/openFrameworks/sound/ofAVEngineSoundPlayer.mm',
282+
'libs/openFrameworks/video/ofAVFoundationGrabber.mm',
283+
'libs/openFrameworks/video/ofAVFoundationPlayer.mm',
284+
'libs/openFrameworks/video/ofAVFoundationVideoPlayer.m',
285+
)
286+
287+
install_headers(
288+
'libs/openFrameworks/sound/ofAVEngineSoundPlayer.h',
289+
'libs/openFrameworks/video/ofAVFoundationGrabber.h',
290+
'libs/openFrameworks/video/ofAVFoundationPlayer.h',
291+
'libs/openFrameworks/video/ofAVFoundationGrabber.h',
292+
'libs/openFrameworks/video/ofAVFoundationPlayer.h',
293+
'libs/openFrameworks/video/ofAVFoundationVideoPlayer.h',
294+
subdir: 'openframeworks'
295+
)
296+
265297
endif
266298

267-
# We need to treat this dependency independently
299+
# We need to treat this dependency independently
268300
# because if it's not installed in the host system,
269-
# we will use the .wrap file in the subprojects file AND
301+
# we will use the .wrap file in the subprojects file AND
270302
# need to change a define in the cmake subproject
271303
uriparser_dep = dependency('uriparser', required: false)
272304
if not uriparser_dep.found()
@@ -298,7 +330,7 @@ freeimage_dep = compiler.find_library('freeimage', has_headers: ['FreeImage.h'],
298330
if not freeimage_dep.found()
299331
freeimage_opts = cmake.subproject_options()
300332
# doesn't compile with the define bellow
301-
# freeimage_opts.add_cmake_defines({'BUILD_SHARED_LIBS': true})
333+
# freeimage_opts.add_cmake_defines({'BUILD_SHARED_LIBS': true})
302334
# We need -fPIC to link against the produced static library
303335
freeimage_opts.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': true})
304336
freeimage_proj = cmake.subproject('freeimage', options: freeimage_opts)
@@ -311,7 +343,8 @@ lib = library('openFrameworks',
311343
sources,
312344
include_directories: inc,
313345
dependencies: deps,
314-
install: true)
346+
install: true,
347+
)
315348

316349
openframeworks_dep = declare_dependency(link_with: lib, include_directories: inc, dependencies: deps)
317350

0 commit comments

Comments
 (0)