Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SFML] the wrap dont have the same name than pkg-config #1527

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
9 changes: 8 additions & 1 deletion releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,7 @@
"imgui"
],
"versions": [
"1.89.9-2",
"1.89.9-1",
"1.89.3-1",
"1.89.2-1",
Expand Down Expand Up @@ -3021,9 +3022,15 @@
},
"sfml": {
"dependency_names": [
"sfml"
"sfml-all",
"sfml-graphics",
"sfml-system",
"sfml-audio",
"sfml-network",
"sfml-window"
],
"versions": [
"2.6.1-2",
"2.6.1-1",
"2.6.0-2",
"2.6.0-1",
Expand Down
2 changes: 1 addition & 1 deletion subprojects/packagefiles/imgui-sfml/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ project(
)

imgui_dep = dependency('imgui')
sfml_dep = dependency('sfml')
sfml_dep = dependency('sfml-all')
opengl_dep = dependency('gl')

# We do not look up sfml here because there are many different
Expand Down
67 changes: 53 additions & 14 deletions subprojects/packagefiles/sfml/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,32 @@ project(
'cpp_std=c++17',
'wrap_mode=forcefallback',
],
meson_version: '>=0.49.0',
meson_version: '>=0.59.0',
)

cpp = meson.get_compiler('cpp')

openal_dep = dependency('openal')
thread_dep = dependency('threads')
graphics_opt = get_option('graphics')
audio_opt = get_option('audio')
window_opt = get_option('window')
network_opt = get_option('network')
nda-cunh marked this conversation as resolved.
Show resolved Hide resolved

gl_dep = dependency('gl')
winmm_dep = cpp.find_library('winmm', required: host_machine.system() == 'windows')
w32_dep = cpp.find_library('ws2_32', required: host_machine.system() == 'windows')
freetype_dep = dependency('freetype2')
flac_dep = dependency('flac')
ogg_dep = dependency('ogg')
vorbis_dep = dependency('vorbis')
vorbisenc_dep = dependency('vorbisenc')
vorbisfile_dep = dependency('vorbisfile')
nda-cunh marked this conversation as resolved.
Show resolved Hide resolved

foreach audio_dep : [
'flac',
'ogg',
'openal',
'vorbis',
'vorbisenc',
'vorbisfile',
]
_dep = dependency(audio_dep, required: audio_opt)
audio_opt = audio_opt.require(_dep.found())
set_variable(audio_dep + '_dep', _dep)
endforeach

stb_inc = include_directories('extlibs/headers/stb_image')
glad_inc = include_directories('extlibs/headers/glad/include')
Expand All @@ -30,12 +40,41 @@ mp3_inc = include_directories('extlibs/headers/minimp3')
pub_inc = include_directories('include')
priv_inc = include_directories('src')

summary(
{
'audio' : get_option('audio').allowed(),
'graphics': get_option('graphics').allowed(),
'network' : get_option('network').allowed(),
'window' : get_option('window').allowed(),
},
bool_yn: true,
section: 'Features',
)

subdir('src/SFML')

sfml_dep = declare_dependency(
include_directories: pub_inc,
link_with: [audio_lib, graphics_lib, network_lib, window_lib, system_lib, host_machine.system() == 'windows' ? main_lib : []],
compile_args: get_option('default_library') == 'static' ? '-DSFML_STATIC' : [],
if (
(
audio_opt.allowed()
and graphics_opt.allowed()
and network_opt.allowed()
and window_opt.allowed()
)
)
sfml_all_dep = declare_dependency(
include_directories: pub_inc,
link_with: [host_machine.system() == 'windows' ? main_lib : []],
dependencies: [
sfml_audio_dep,
sfml_graphics_dep,
sfml_network_dep,
sfml_window_dep,
sfml_system_dep,
],
)
meson.override_dependency('sfml-all', sfml_all_dep)
endif

subdir('examples')
if get_option('examples')
subdir('examples')
endif
5 changes: 5 additions & 0 deletions subprojects/packagefiles/sfml/meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
option('examples', type : 'boolean', value : false)
option('graphics', type: 'feature')
option('window', type: 'feature')
option('audio', type: 'feature')
option('network', type: 'feature')
8 changes: 8 additions & 0 deletions subprojects/packagefiles/sfml/src/SFML/Audio/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,11 @@ audio_lib = library(
include_directories: [pub_inc, priv_inc, mp3_inc],
dependencies: [openal_dep, flac_dep, vorbis_dep, vorbisenc_dep, vorbisfile_dep, ogg_dep],
)

sfml_audio_dep = declare_dependency(
include_directories: pub_inc,
link_with: audio_lib,
compile_args: get_option('default_library') == 'static' ? '-DSFML_STATIC' : [],
)

meson.override_dependency('sfml-audio', sfml_audio_dep)
13 changes: 13 additions & 0 deletions subprojects/packagefiles/sfml/src/SFML/Graphics/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,24 @@ graphics_sources += files(
'RenderTextureImplFBO.cpp',
)

gl_dep = dependency('gl')
freetype_dep = dependency('freetype2')

graphics_lib = library(
'sfml-graphics',
graphics_sources,
cpp_args: get_option('default_library') != 'static' ? '-DSFML_GRAPHICS_EXPORTS' : '-DSFML_STATIC',
include_directories: [glad_inc, pub_inc, priv_inc, stb_inc],
link_with: [window_lib, system_lib],
dependencies: [gl_dep, freetype_dep],
install: true
)

sfml_graphics_dep = declare_dependency(
include_directories: pub_inc,
link_with: graphics_lib,
compile_args: get_option('default_library') == 'static' ? '-DSFML_STATIC' : [],
dependencies: [sfml_window_dep, sfml_system_dep]
)

meson.override_dependency('sfml-graphics', sfml_graphics_dep)
9 changes: 9 additions & 0 deletions subprojects/packagefiles/sfml/src/SFML/Network/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,13 @@ network_lib = library(
include_directories: [pub_inc, priv_inc],
link_with: system_lib,
dependencies: w32_dep,
install: true
)

sfml_network_dep = declare_dependency(
include_directories: pub_inc,
link_with: network_lib,
compile_args: get_option('default_library') == 'static' ? '-DSFML_STATIC' : [],
)

meson.override_dependency('sfml-network', sfml_network_dep)
11 changes: 11 additions & 0 deletions subprojects/packagefiles/sfml/src/SFML/System/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,21 @@ else
)
endif

thread_dep = dependency('threads')

system_lib = library(
'sfml-system',
system_sources,
cpp_args: get_option('default_library') != 'static' ? '-DSFML_SYSTEM_EXPORTS' : '-DSFML_STATIC',
include_directories: [pub_inc, priv_inc],
dependencies: [thread_dep, winmm_dep],
install: true
)

sfml_system_dep = declare_dependency(
include_directories: pub_inc,
link_with: system_lib,
compile_args: get_option('default_library') == 'static' ? '-DSFML_STATIC' : [],
)

meson.override_dependency('sfml-system', sfml_system_dep)
9 changes: 9 additions & 0 deletions subprojects/packagefiles/sfml/src/SFML/Window/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,13 @@ window_lib = library(
link_with: system_lib,
include_directories: [glad_inc, pub_inc, priv_inc, vulkan_inc],
dependencies: [gl_dep, winmm_dep, window_deps],
install:true
)

sfml_window_dep = declare_dependency(
include_directories: pub_inc,
link_with: window_lib,
compile_args: get_option('default_library') == 'static' ? '-DSFML_STATIC' : [],
)

meson.override_dependency('sfml-window', sfml_window_dep)
22 changes: 17 additions & 5 deletions subprojects/packagefiles/sfml/src/SFML/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
subdir('System')
subdir('Main')
subdir('Window')
subdir('Network')
subdir('Graphics')
subdir('Audio')
subdir('System')

if window_opt.allowed() or graphics_opt.allowed()
subdir('Window')
endif

if network_opt.allowed()
subdir('Network')
endif

if graphics_opt.allowed()
subdir('Graphics')
endif

if audio_opt.allowed()
subdir('Audio')
endif
2 changes: 1 addition & 1 deletion subprojects/sfml.wrap
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ source_hash = 82535db9e57105d4f3a8aedabd138631defaedc593cab589c924b7d7a11ffb9d
patch_directory = sfml

[provide]
sfml = sfml_dep
dependency_names = sfml-all, sfml-audio, sfml-graphics, sfml-network, sfml-system, sfml-window