Skip to content

Commit

Permalink
meson: add macos specific tweaks
Browse files Browse the repository at this point in the history
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
  • Loading branch information
AdelKS committed Oct 7, 2024
1 parent bc20719 commit aeabf3e
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,23 @@ if host_machine.system() == 'linux'
subdir: 'openframeworks'
)

elif host_machine.system() == 'darwin'

deps += [dependency('appleframeworks', modules : ['Cocoa', 'AppKit', 'Foundation', 'AVKit', 'GLKit'])]
add_languages('objcpp', native: false)
add_project_arguments(['-ObjC++', '-fobjc-arc'], language: ['cpp', 'objcpp'])

sources += files(
'libs/openFrameworks/sound/ofAVEngineSoundPlayer.mm',
'libs/openFrameworks/video/ofAVFoundationGrabber.mm',
'libs/openFrameworks/video/ofAVFoundationPlayer.mm',
)

endif

# We need to treat this dependency independently
# We need to treat this dependency independently
# because if it's not installed in the host system,
# we will use the .wrap file in the subprojects file AND
# we will use the .wrap file in the subprojects file AND
# need to change a define in the cmake subproject
uriparser_dep = dependency('uriparser', required: false)
if not uriparser_dep.found()
Expand Down Expand Up @@ -298,7 +310,7 @@ freeimage_dep = compiler.find_library('freeimage', has_headers: ['FreeImage.h'],
if not freeimage_dep.found()
freeimage_opts = cmake.subproject_options()
# doesn't compile with the define bellow
# freeimage_opts.add_cmake_defines({'BUILD_SHARED_LIBS': true})
# freeimage_opts.add_cmake_defines({'BUILD_SHARED_LIBS': true})
# We need -fPIC to link against the produced static library
freeimage_opts.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': true})
freeimage_proj = cmake.subproject('freeimage', options: freeimage_opts)
Expand All @@ -311,7 +323,8 @@ lib = library('openFrameworks',
sources,
include_directories: inc,
dependencies: deps,
install: true)
install: true,
)

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

Expand Down

0 comments on commit aeabf3e

Please sign in to comment.