feat(plugin): create initial structure for XPLM

This commit is contained in:
Anthony 2024-04-08 20:54:40 +02:00
parent 4d99e7cc2d
commit 9ab92b6d62
3 changed files with 81 additions and 0 deletions

21
plugin/CMakeLists.txt Normal file
View File

@ -0,0 +1,21 @@
cmake_minimum_required(VERSION 3.27)
project(XPL-Checklist-Connector CXX)
set(CMAKE_CXX_STANDARD 17)
# Set compile options for XPLM
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DXPLM401=1 -fvisibility=hidden -shared -rdynamic -nodefaultlibs -undefined_warning -lGL -lGLU")
# Set output directory in X-Plane plugin structure
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/lin_x64)
find_package(unofficial-x-plane CONFIG REQUIRED)
add_executable(XPL-Checklist-Connector main.cpp)
target_link_libraries(XPL-Checklist-Connector PRIVATE unofficial::x-plane::xplm unofficial::x-plane::xpwidgets unofficial::x-plane::xplm_cpp)
# Rename compiled file to X-Plane conventions
set_target_properties(XPL-Checklist-Connector PROPERTIES RUNTIME_OUTPUT_NAME "lin")
set_target_properties(XPL-Checklist-Connector PROPERTIES SUFFIX ".xpl")

45
plugin/main.cpp Normal file
View File

@ -0,0 +1,45 @@
#include <XPLMProcessing.h>
#if IBM
#include <windows.h>
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#endif
#if LIN
#include <GL/gl.h>
#elif __GNUC__
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif
#ifndef XPLM401
#error This is made to be compiled against the XPLM400 SDK
#endif
PLUGIN_API int XPluginStart(char * outName, char * outSignature, char * outDescription) {
return 0;
}
PLUGIN_API int XPluginEnable(void) {
return 1;
}
PLUGIN_API void XPluginReceiveMessage(XPLMPluginID inFrom, int inMsg, void * inParam) { }
PLUGIN_API void XPluginDisable(void) { }
PLUGIN_API void XPluginStop(void) { }

15
plugin/vcpkg.json Normal file
View File

@ -0,0 +1,15 @@
{
"name" : "xpl-checklist-connector",
"version-string" : "1.0.0",
"builtin-baseline" : "5fa0f075ea51f305b627ecd5e050a363707353ff",
"dependencies" : [ {
"name" : "vcpkg-cmake-config",
"version>=" : "2022-02-06#1"
}, {
"name" : "vcpkg-cmake",
"version>=" : "2023-05-04"
}, {
"name" : "x-plane",
"version>=" : "4.0.1"
} ]
}