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

x-plane-sdk: new wrap #1394

Merged
merged 1 commit into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ci_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -869,5 +869,10 @@
"wayland:tests=false",
"wayland:dtd_validation=false"
]
},
"x-plane-sdk": {
"build_options": [
"x-plane-sdk:cpp=enabled"
]
}
}
10 changes: 10 additions & 0 deletions releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -3347,6 +3347,16 @@
"0.3.0-1"
]
},
"x-plane-sdk": {
"dependency_names": [
"xplm",
"xpwidgets",
"xpcpp"
],
"versions": [
"4.0.1-1"
]
},
"xtensor": {
"dependency_names": [
"xtensor"
Expand Down
128 changes: 128 additions & 0 deletions subprojects/packagefiles/x-plane-sdk/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
project(
'x-plane-sdk',
'c',
version: '4.0.1',
license: 'MIT',
default_options: 'warning_level=0',
meson_version: '>= 0.60.0',
)

xplm_incdir = include_directories('SDK/CHeaders/XPLM')
widgets_incdir = include_directories('SDK/CHeaders/Widgets')
wrappers_incdir = include_directories('SDK/CHeaders/Wrappers')

cc = meson.get_compiler('c')

ca = []
xplm_level = get_option('xplm-level')

if xplm_level >= 200
ca += '-DXPLM200'
endif

if xplm_level >= 210
ca += '-DXPLM210'
endif

if xplm_level >= 300
ca += '-DXPLM300'
endif

if xplm_level >= 301
ca += '-DXPLM301'
endif

if xplm_level >= 303
ca += '-DXPLM303'
endif

if xplm_level >= 400
ca += '-DXPLM400'
endif

if target_machine.system() == 'windows'
ca += ['-DAPL=0', '-DIBM=1', '-DLIN=0']
xplm_dep = declare_dependency(
compile_args: ca,
include_directories: [xplm_incdir],
dependencies: [
cc.find_library(
'XPLM_64',
dirs: [meson.current_source_dir() / 'SDK' / 'Libraries' / 'Win'],
),
],
)
xpwidgets_dep = declare_dependency(
compile_args: ca,
include_directories: [widgets_incdir],
dependencies: [
xplm_dep,
cc.find_library(
'XPWidgets_64',
dirs: [meson.current_source_dir() / 'SDK' / 'Libraries' / 'Win'],
),
],
)
elif target_machine.system() == 'darwin'
ca += ['-DAPL=1', '-DIBM=0', '-DLIN=0']
xplm_dep = declare_dependency(
compile_args: ca,
link_args: [
'-F' + meson.current_source_dir() / 'SDK' / 'Libraries' / 'Mac',
'-framework',
'XPLM',
],
include_directories: [xplm_incdir],
)
xpwidgets_dep = declare_dependency(
compile_args: ca,
link_args: [
'-F' + meson.current_source_dir() / 'SDK' / 'Libraries' / 'Mac',
'-framework',
'XPWidgets',
],
include_directories: [widgets_incdir],
dependencies: [xplm_dep],
)
else
ca += ['-DAPL=0', '-DIBM=0', '-DLIN=1']
xplm_dep = declare_dependency(
compile_args: ca,
include_directories: [xplm_incdir],
)
xpwidgets_dep = declare_dependency(
compile_args: ca,
include_directories: [widgets_incdir],
dependencies: [xplm_dep],
)
endif

if add_languages('cpp', native: false, required: get_option('cpp'))
xpcpp_dir = 'SDK/CHeaders/Wrappers'
# There is no reason to make this a dynamic library.
# Static is the only sensible choice for this particular library.
xpcpp = static_library(
'xpcpp',
cpp_args: ca,
include_directories: [wrappers_incdir],
pic: true,
dependencies: [xplm_dep, xpwidgets_dep],
sources: [
xpcpp_dir / 'XPCBroadcaster.cpp',
xpcpp_dir / 'XPCDisplay.cpp',
xpcpp_dir / 'XPCListener.cpp',
xpcpp_dir / 'XPCProcessing.cpp',
xpcpp_dir / 'XPCWidgetAttachments.cpp',
xpcpp_dir / 'XPCWidget.cpp',
],
)

xpcpp_dep = declare_dependency(
compile_args: ca,
dependencies: [xplm_dep, xpwidgets_dep],
include_directories: [wrappers_incdir],
link_with: [xpcpp],
)
else
xpcpp_dep = dependency('', required: false)
endif
4 changes: 4 additions & 0 deletions subprojects/packagefiles/x-plane-sdk/meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
option('xplm-level', type: 'integer', min: 0, max: 400, value: 0,
description: 'The XPLM compatibility level to use. See the documentation.')
option('cpp', type: 'feature', value: 'disabled',
description: 'Build C++ wrappers')
12 changes: 12 additions & 0 deletions subprojects/x-plane-sdk.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[wrap-file]
directory = x-plane-sdk-4.0.1
source_url = https://developer.x-plane.com/wp-content/plugins/code-sample-generation/sample_templates/XPSDK401.zip
source_filename = x-plane-sdk-4.0.1.zip
source_hash = c1104e83d9b54b03d0084c1db52ee6491e5290994503e8dd2d4a0af637e2bdd7
patch_directory = x-plane-sdk
lead_directory_missing = true

[provide]
xplm = xplm_dep
xpwidgets = xpwidgets_dep
xpcpp = xpcpp_dep
4 changes: 4 additions & 0 deletions tools/sanity_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ def check_source_url(self, name: str, wrap_section: configparser.SectionProxy, v
elif name == 'directxmath':
# DirectXMath source url contains only tag name without version
return True
elif name == 'x-plane-sdk':
segs = version.split('.')
self.assertEqual(len(segs), 3)
version = segs[0] + segs[1] + segs[2]
source_url = wrap_section['source_url']
version_ = version.replace('.', '_')
self.assertTrue(version in source_url or version_ in source_url,
Expand Down