Skip to content

Commit 49f614d

Browse files
committed
macos, windows meson builds
1 parent 045425f commit 49f614d

File tree

3 files changed

+36
-5
lines changed

3 files changed

+36
-5
lines changed

.github/workflows/meson.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ jobs:
178178
echo "::group::Installing pkg-config"
179179
sudo apt install pkg-config
180180
echo "::group::Installing mac deps"
181-
omp install libsdl2 onetbb lz4 libpng minizip luajit flac
181+
omp install libsdl2 libsdl2_image onetbb lz4 libpng minizip luajit flac
182182
echo "OSXCROSS_PKG_CONFIG_PATH=${{env.OSXCROSS_TARGET}}/macports/pkgs/opt/local/libexec/onetbb/lib/pkgconfig" >> $GITHUB_ENV
183183
echo "::endgroup::"
184184
echo "::group::Installing meson"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
project('SDL2_image', ['c', 'cpp'])
2+
3+
4+
libname = 'SDL2_image' #filename without extension or lib prefix
5+
lib_include_dir = include_directories('include')
6+
7+
if get_option('debug')
8+
libname += '-Debug'
9+
else
10+
libname += '-Release'
11+
endif
12+
13+
cc = meson.get_compiler('c')
14+
cxx = meson.get_compiler('cpp')
15+
if host_machine.cpu_family() == 'x86_64'
16+
libname += '-x64'
17+
lib = cc.find_library(libname, dirs: meson.current_source_dir()/'_Bin', required: false)
18+
if not lib.found()
19+
lib = cxx.find_library(libname, dirs: meson.current_source_dir()/'_Bin')
20+
endif
21+
else
22+
lib = cc.find_library(libname+'-Win32', dirs: meson.current_source_dir()/'_Bin', required: false)
23+
if not lib.found()
24+
lib = cxx.find_library(libname+'-Win32', dirs: meson.current_source_dir()/'_Bin')
25+
endif
26+
endif
27+
28+
lib_dep = declare_dependency(dependencies: lib, include_directories: lib_include_dir)
29+
30+
meson.override_dependency(meson.project_name(), lib_dep)
31+
# Remember to fix the corresponding dependency in the main project meson.build (compare other precompiled libraries)

meson.build

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ endif
192192
if host_machine.system() in ['linux','darwin']
193193
deps += [
194194
dependency(['sdl2']),
195+
dependency('SDL2_image'),
195196
dependency('flac'),
196197
dependency('minizip'),
197198
dependency('threads'),
@@ -200,15 +201,14 @@ if host_machine.system() in ['linux','darwin']
200201
dependency('tbb'),
201202
dependency('gl')
202203
]
203-
if host_machine.system() == 'linux'
204-
deps += dependency('SDL2_image')
205-
endif
206204
if host_machine.system()=='darwin'
207205
deps += dependency('appleframeworks', modules: ['Foundation'])
208206
endif
209207
elif host_machine.system() == 'windows'
210208
sdl2 = subproject('SDL2-2.26.3')
211209
sdl2_dep = dependency('sdl2')
210+
sdl2_image = subproject('SDL2_image-2.8.2')
211+
sdl2_image_dep = dependency('SDL2_image')
212212
zlib = subproject('zlib-ng-2.1.3')
213213
zlib_dep = dependency('zlib')
214214
minizip = subproject('minizip-ng-4.0.0')
@@ -217,7 +217,7 @@ elif host_machine.system() == 'windows'
217217
libpng_dep = dependency('libpng')
218218
# Windows Libraries
219219
opengl = compiler.find_library('opengl32')
220-
deps += [sdl2_dep, zlib_dep, minizip_dep, libpng_dep, opengl]
220+
deps += [sdl2_dep, sdl2_image_dep, zlib_dep, minizip_dep, libpng_dep, opengl]
221221
endif
222222

223223

0 commit comments

Comments
 (0)