Open nda-cunh opened 6 months ago
Or rather the port should declare dependencies for sfml-audio
, sfml-graphics
, etc…
Or rather the port should declare dependencies for
sfml-audio
,sfml-graphics
, etc…
I know , i have tried this but a wrap file can't specified some option...
Meaning?
when sfml-audio is call, for example, it should call a specific option (meson-options.txt), for example
[wrap-file]
...
[provide]
sfml = sfml_dep : build_sfml_all
sfml-all = sfml_all_dep : build_sfml_all
sfml-graphics = sfml_graphics_dep: build_sfml_graphics
sfml-window = sfml_window_dep : build_sfml_window
sfml-system = sfml_system_dep : build_sfml_window
sfml-audio = sfml_audio_dep : build_sfml_audio
sfml-network = sfml_network_dep: build_sfml_network
like it it's possible ? (build_sfml_graphics) would be an meson-options.txt (true/false)
No, that's not for the provide section to decide. It's the role of the main project.
can you show me an example for a good call of the wrap in the project ?
Ideally it would look like this:
releases.json | 4 +++-
subprojects/packagefiles/imgui-sfml/meson.build | 2 +-
subprojects/packagefiles/sfml/meson.build | 23 +++++++++++++++-------
subprojects/packagefiles/sfml/meson_options.txt | 1 +
.../sfml/src/SFML/Graphics/meson.build | 7 +++++++
subprojects/packagefiles/sfml/src/SFML/meson.build | 4 +++-
subprojects/sfml.wrap | 2 +-
7 files changed, 32 insertions(+), 11 deletions(-)
diff --git c/releases.json i/releases.json
index a5fd39ef..e51ff104 100644
--- c/releases.json
+++ i/releases.json
@@ -1251,6 +1251,7 @@
"imgui-sfml"
],
"versions": [
+ "2.6-2",
"2.6-1",
"2.5-4",
"2.5-3",
@@ -3021,7 +3022,8 @@
},
"sfml": {
"dependency_names": [
- "sfml"
+ "sfml-all",
+ "sfml-graphics"
],
"versions": [
"2.6.1-1",
diff --git c/subprojects/packagefiles/imgui-sfml/meson.build i/subprojects/packagefiles/imgui-sfml/meson.build
index 170eb605..a2bfed44 100644
--- c/subprojects/packagefiles/imgui-sfml/meson.build
+++ i/subprojects/packagefiles/imgui-sfml/meson.build
@@ -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
diff --git c/subprojects/packagefiles/sfml/meson.build i/subprojects/packagefiles/sfml/meson.build
index e963b10e..767d888b 100644
--- c/subprojects/packagefiles/sfml/meson.build
+++ i/subprojects/packagefiles/sfml/meson.build
@@ -6,11 +6,15 @@ project(
'cpp_std=c++17',
'wrap_mode=forcefallback',
],
- meson_version: '>=0.49.0',
+ meson_version: '>=0.59.0',
)
cpp = meson.get_compiler('cpp')
+graphics_opt = get_option('graphics')
+
+# FIXME: handle `graphics_opt` dependencies.
+
openal_dep = dependency('openal')
thread_dep = dependency('threads')
gl_dep = dependency('gl')
@@ -32,10 +36,15 @@ priv_inc = include_directories('src')
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 graphics_opt.allowed()
+ sfml_all_dep = declare_dependency(
+ include_directories: pub_inc,
+ link_with: [audio_lib, network_lib, window_lib, system_lib, host_machine.system() == 'windows' ? main_lib : []],
+ dependencies: [sfml_graphics_dep],
+ )
+ meson.override_dependency('sfml-all', sfml_all_dep)
+endif
-subdir('examples')
+# FIXME: add an `examples` option, only compile each
+# example if the correct SFML sub-dep is available.
+# subdir('examples')
diff --git c/subprojects/packagefiles/sfml/meson_options.txt i/subprojects/packagefiles/sfml/meson_options.txt
new file mode 100644
index 00000000..a301e4aa
--- /dev/null
+++ i/subprojects/packagefiles/sfml/meson_options.txt
@@ -0,0 +1 @@
+option('graphics', type: 'feature')
diff --git c/subprojects/packagefiles/sfml/src/SFML/Graphics/meson.build i/subprojects/packagefiles/sfml/src/SFML/Graphics/meson.build
index 3b5205ec..a0773e18 100644
--- c/subprojects/packagefiles/sfml/src/SFML/Graphics/meson.build
+++ i/subprojects/packagefiles/sfml/src/SFML/Graphics/meson.build
@@ -45,3 +45,10 @@ graphics_lib = library(
link_with: [window_lib, system_lib],
dependencies: [gl_dep, freetype_dep],
)
+
+sfml_graphics_dep = declare_dependency(
+ include_directories: pub_inc,
+ link_with: graphics_lib,
+ compile_args: get_option('default_library') == 'static' ? '-DSFML_STATIC' : [],
+)
+meson.override_dependency('sfml-graphics', sfml_graphics_dep)
diff --git c/subprojects/packagefiles/sfml/src/SFML/meson.build i/subprojects/packagefiles/sfml/src/SFML/meson.build
index 4f7a7727..43700262 100644
--- c/subprojects/packagefiles/sfml/src/SFML/meson.build
+++ i/subprojects/packagefiles/sfml/src/SFML/meson.build
@@ -2,5 +2,7 @@ subdir('System')
subdir('Main')
subdir('Window')
subdir('Network')
-subdir('Graphics')
+if graphics_opt.allowed()
+ subdir('Graphics')
+endif
subdir('Audio')
diff --git c/subprojects/sfml.wrap i/subprojects/sfml.wrap
index e1fbbb5b..977533bf 100644
--- c/subprojects/sfml.wrap
+++ i/subprojects/sfml.wrap
@@ -6,4 +6,4 @@ source_hash = 82535db9e57105d4f3a8aedabd138631defaedc593cab589c924b7d7a11ffb9d
patch_directory = sfml
[provide]
-sfml = sfml_dep
+dependency_names = sfml-all, sfml-graphics
A non negligible amount of work.
As a first step, just redirect all sfml-XXX
dependencies to the current sfml_dep
. And replace use of sfml
by sfml-all
.
Does that answer your question?
imgui-sfml
revision would need to be bumped too.
@benoit-pierre I've just push the huge modifications, but it's not linking well. Do you have any idea where it's coming from? :)
when dependency() is set to sfml-graphics or sfml-all (like the pkg-config) meson can't found the sfml-wrap