@@ -210,7 +210,6 @@ install_headers(
210
210
subdir : ' openframeworks'
211
211
)
212
212
213
- compiler = meson .get_compiler(' cpp' )
214
213
cmake = import (' cmake' )
215
214
216
215
deps = [
@@ -233,7 +232,6 @@ deps = [
233
232
dependency (' rtaudio' ),
234
233
dependency (' sndfile' ),
235
234
dependency (' utf8cpp' ),
236
- compiler.find_library (' freeimage' , has_headers : [' FreeImage.h' ]),
237
235
]
238
236
239
237
if host_machine .system() == ' linux'
@@ -293,6 +291,22 @@ endif
293
291
294
292
deps += [kissfft_dep]
295
293
294
+ # FreeImage is a special snowflake: no pkg-config / cmake / etc.. file is installed by it
295
+ # so we need to use the compiler to find it
296
+ compiler = meson .get_compiler(' cpp' )
297
+ freeimage_dep = compiler.find_library (' freeimage' , has_headers : [' FreeImage.h' ], required : false )
298
+ if not freeimage_dep.found()
299
+ freeimage_opts = cmake.subproject_options()
300
+ # doesn't compile with the define bellow
301
+ # freeimage_opts.add_cmake_defines({'BUILD_SHARED_LIBS': true})
302
+ # We need -fPIC to link against the produced static library
303
+ freeimage_opts.add_cmake_defines({' CMAKE_POSITION_INDEPENDENT_CODE' : true })
304
+ freeimage_proj = cmake.subproject (' freeimage' , options : freeimage_opts)
305
+ freeimage_dep = freeimage_proj.dependency (' FreeImage' )
306
+ endif
307
+
308
+ deps += [freeimage_dep]
309
+
296
310
lib = library (' openFrameworks' ,
297
311
sources,
298
312
include_directories : inc,
0 commit comments