Skip to content

Commit

Permalink
Add X-Plane plugin SDK x-plane-sdk
Browse files Browse the repository at this point in the history
Signed-off-by: Julia DeMille <[email protected]>
  • Loading branch information
judemille committed Feb 6, 2024
1 parent a702ac4 commit b0f96d4
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 0 deletions.
10 changes: 10 additions & 0 deletions releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -3425,5 +3425,15 @@
"1.3.3-2",
"1.3.3-1"
]
},
"x-plane-sdk": {
"dependency_names": [
"xplm",
"xpwidgets",
"xpcpp"
],
"versions": [
"4.0.1-1"
]
}
}
104 changes: 104 additions & 0 deletions subprojects/packagefiles/x-plane-sdk/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
project(
'x-plane-sdk', 'c', 'cpp',
version: '4.0.1',
license: 'MIT',
default_options: 'warning_level=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')
cxx = meson.get_compiler('cpp')

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],
link_with: [cc.find_library('XPLM_64', dirs: ['SDK/Libraries/Win'])],
)
xpwidgets_dep = declare_dependency(
compile_args: ca,
include_directories: [widgets_incdir],
dependencies: [xplm_dep],
link_with: [cc.find_library('XPWidgets_64', dirs: ['SDK/Libraries/Win'])]
)
elif target_machine.system() == 'darwin'
ca += ['-DAPL=1', '-DIBM=0', '-DLIN=0']
xplm_dep = declare_dependency(
compile_args: [
'-F' + meson.current_source_dir() / 'SDK' / 'Libraries' / 'Mac',
'-framework',
'XPLM',
] + ca,
include_directories: [xplm_incdir],
)
xpwidgets_dep = declare_dependency(
compile_args: [
'-F' + meson.current_source_dir() / 'SDK' / 'Libraries' / 'Mac',
'-framework',
'XPWidgets'
] + ca,
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

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_dep = 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',
]
)
2 changes: 2 additions & 0 deletions subprojects/packagefiles/x-plane-sdk/meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
option('xplm_level', type: 'integer', min: 0, max: 400, value: 0,
description: 'The XPLM compatibility level to use. See the documentation.')
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

0 comments on commit b0f96d4

Please sign in to comment.