Skip to content

Commit

Permalink
meson: add FreeImage wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
AdelKS committed Oct 5, 2024
1 parent d78ce57 commit ad082fc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
18 changes: 16 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ install_headers(
subdir: 'openframeworks'
)

compiler = meson.get_compiler('cpp')
cmake = import('cmake')

deps = [
Expand All @@ -233,7 +232,6 @@ deps = [
dependency('rtaudio'),
dependency('sndfile'),
dependency('utf8cpp'),
compiler.find_library('freeimage', has_headers: ['FreeImage.h']),
]

if host_machine.system() == 'linux'
Expand Down Expand Up @@ -293,6 +291,22 @@ endif

deps += [kissfft_dep]

# FreeImage is a special snowflake: no pkg-config / cmake / etc.. file is installed by it
# so we need to use the compiler to find it
compiler = meson.get_compiler('cpp')
freeimage_dep = compiler.find_library('freeimage', has_headers: ['FreeImage.h'], required: false)
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})
# 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)
freeimage_dep = freeimage_proj.dependency('FreeImage')
endif

deps += [freeimage_dep]

lib = library('openFrameworks',
sources,
include_directories: inc,
Expand Down
8 changes: 8 additions & 0 deletions subprojects/freeimage.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[wrap-git]
url = https://github.com/danoli3/FreeImage.git
revision = 3.19.7
depth = 1
method = cmake

[provide]
freeimage = FreeImage_dep

0 comments on commit ad082fc

Please sign in to comment.