Add X-Plane SDK support (#5408)

* Add X-Plane SDK support

The x-plane SDK website claims that the SDK is only
compatible with x64. The PR that adds support for this
fails in x86, so I'm disallow x86 builds to align with
the x-plane documentation.

The x-plane SDK website's examples expect that the sdk
headers are at the root of the include path. I'm adjusting
this port to align with those samples, as we want examples
to "just work" as much as possible.
This commit is contained in:
xDarKraDx 2019-02-21 17:39:10 -05:00 committed by Codiferous
parent 0396f80560
commit 434b30185d
2 changed files with 47 additions and 0 deletions

3
ports/x-plane/CONTROL Normal file
View File

@ -0,0 +1,3 @@
Source: x-plane
Version: 3.0.1
Description: The X-Plane Plugin SDK.

View File

@ -0,0 +1,44 @@
include(vcpkg_common_functions)
if (VCPKG_TARGET_ARCHITECTURE STREQUAL x86)
message(FATAL_ERROR "the x-plane SDK cannot be built for the x86 architecture")
endif()
vcpkg_download_distfile(
OUT_SOURCE_PATH
URLS http://developer.x-plane.com/wp-content/plugins/code-sample-generation/sample_templates/XPSDK301.zip
FILENAME XPSDK301.zip
SHA512 3044d606039be8230f35a5992d322d4c009b4056f8fb17e929a9f5c2204c084e2c83ddad10801b21727645ec957c8942b83938f81256ec3778dbe75df525e62a
)
vcpkg_extract_source_archive(
${OUT_SOURCE_PATH} ${CURRENT_PACKAGES_DIR}/temp/
)
file(MAKE_DIRECTORY
${CURRENT_PACKAGES_DIR}/include/x-plane/
${CURRENT_PACKAGES_DIR}/lib
${CURRENT_PACKAGES_DIR}/debug/lib
)
file(COPY ${CURRENT_PACKAGES_DIR}/temp/SDK/CHeaders/Widgets/ DESTINATION ${CURRENT_PACKAGES_DIR}/include)
file(COPY ${CURRENT_PACKAGES_DIR}/temp/SDK/CHeaders/Wrappers/ DESTINATION ${CURRENT_PACKAGES_DIR}/include)
file(COPY ${CURRENT_PACKAGES_DIR}/temp/SDK/CHeaders/XPLM/ DESTINATION ${CURRENT_PACKAGES_DIR}/include)
if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
file(COPY ${CURRENT_PACKAGES_DIR}/temp/SDK/Libraries/Win/XPLM_64.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib/)
file(COPY ${CURRENT_PACKAGES_DIR}/temp/SDK/Libraries/Win/XPWidgets_64.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib/)
file(COPY ${CURRENT_PACKAGES_DIR}/temp/SDK/Libraries/Win/XPLM_64.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/)
file(COPY ${CURRENT_PACKAGES_DIR}/temp/SDK/Libraries/Win/XPWidgets_64.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/)
elseif (VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin")
file(COPY ${CURRENT_PACKAGES_DIR}/temp/SDK/Libraries/Mac/XPLM.framework/ DESTINATION ${CURRENT_PACKAGES_DIR}/lib/)
file(COPY ${CURRENT_PACKAGES_DIR}/temp/SDK/Libraries/Mac/XPWidgets.framework/ DESTINATION ${CURRENT_PACKAGES_DIR}/lib/)
file(COPY ${CURRENT_PACKAGES_DIR}/temp/SDK/Libraries/Mac/XPLM.framework/ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/)
file(COPY ${CURRENT_PACKAGES_DIR}/temp/SDK/Libraries/Mac/XPWidgets.framework/ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/)
endif()
# Handle copyright
file(COPY ${CURRENT_PACKAGES_DIR}/temp/SDK/license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/x-plane/)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/x-plane/license.txt ${CURRENT_PACKAGES_DIR}/share/x-plane/copyright)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/temp/)