Skip to content

Commit

Permalink
Build with GitHub Action
Browse files Browse the repository at this point in the history
  • Loading branch information
Molnár Csaba committed Aug 27, 2024
1 parent 6fa0d53 commit d106d1b
Show file tree
Hide file tree
Showing 17 changed files with 1,540 additions and 11 deletions.
123 changes: 123 additions & 0 deletions .github/workflows/msbuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: MSBuild

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
# Path to the solution file relative to the root of the project.
SOLUTION_FILE_PATH: .

# Configuration type to build.
# You can convert this to a build matrix if you need coverage of multiple configuration types.
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
BUILD_CONFIGURATION: Release

MSFS_SDK: 'MSFS_SDK\MSFS SDK'
MSFS_SDK_PATH: 0.24.3
MSFS_SDK_VERSION: 0.24.3.0

permissions:
contents: read

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive' # Checkout vcpkg submodule

- name: Cache vcpkg
uses: actions/cache@v4
with:
path: |
vcpkg/installed
vcpkg/downloads
key: ${{ runner.os }}-vcpkg-${{ hashFiles('vcpkg.json') }}
restore-keys: |
${{ runner.os }}-vcpkg-
- name: Setup vcpkg
run: |
cd vcpkg
.\bootstrap-vcpkg.bat # For Windows
.\vcpkg integrate install
- name: Install vcpkg dependencies
run: |
./vcpkg/vcpkg install # This will read from vcpkg.json
# https://stackoverflow.com/questions/60491837/
- if: ${{ steps.cache-msfs-sdk.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v4
name: Cache vcpkg files if the vcpkg.json has changed
with:
path: |
vcpkg/installed
vcpkg/downloads
key: ${{ runner.os }}-vcpkg-${{ hashFiles('vcpkg.json') }}

- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2

- name: Cache MSFS SDK
id: cache-msfs-sdk
uses: actions/cache@v4
with:
path: ${{ env.MSFS_SDK }}
key: msfs-sdk-${{ env.MSFS_SDK_VERSION }}

- if: ${{ steps.cache-msfs-sdk.outputs.cache-hit != 'true' }}
name: Download MSFS SDK file
run: |
curl -L -o MSFS_SDK_Core_Installer_$env:MSFS_SDK_VERSION.msi https://sdk.flightsimulator.com/files/installers/$env:MSFS_SDK_PATH/MSFS_SDK_Core_Installer_$env:MSFS_SDK_VERSION.msi
- name: Print Folder Tree
uses: jaywcjlove/github-action-folder-tree@main
with:
path: .
depth: 3

# Piping to Out-Null waits for completion
# Current path = Workspace. See https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#github-context
- if: ${{ steps.cache-msfs-sdk.outputs.cache-hit != 'true' }}
name: Extract MSFS SDK msi
run: |
msiexec /a MSFS_SDK_Core_Installer_$env:MSFS_SDK_VERSION.msi /qb TARGETDIR=$env:GITHUB_WORKSPACE\MSFS_SDK | Out-Null
# https://stackoverflow.com/questions/70036493/
# $file = "MSFS_SDK_Core_Installer_0.24.3.0.msi"
# $log = "install.log"
# $procMain = Start-Process "msiexec" "/a `"$file`" /qb TARGETDIR=D:\a\x52msfsout\x52msfsout\MSFS_SDK" -NoNewWindow -PassThru
# $procMain.WaitForExit()
- name: Print Folder Tree
uses: jaywcjlove/github-action-folder-tree@main
with:
path: .
depth: 5

- if: ${{ steps.cache-msfs-sdk.outputs.cache-hit != 'true' }}
name: Cache MSFS SDK if this version hasn't been cached before
uses: actions/cache/save@v4
with:
path: ${{ env.MSFS_SDK }}
key: msfs-sdk-${{ env.MSFS_SDK_VERSION }}

- name: Build
working-directory: ${{env.GITHUB_WORKSPACE}}
# Add additional options to the MSBuild command line here (like platform or verbosity level).
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:VcpkgRoot=.\vcpkg ${{env.SOLUTION_FILE_PATH}}

- name: Archive built artifacts
uses: actions/upload-artifact@v4
with:
name: build-folder-${{ env.GITHUB_SHA }}
path: build
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "vcpkg"]
path = vcpkg
url = https://github.com/microsoft/vcpkg.git
270 changes: 270 additions & 0 deletions include/WASimCommander_SDK-v1.2.0.0/WASimCommander.h

Large diffs are not rendered by default.

633 changes: 633 additions & 0 deletions include/WASimCommander_SDK-v1.2.0.0/client/WASimClient.h

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions include/WASimCommander_SDK-v1.2.0.0/client/enums.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
This file is part of the WASimCommander project.
https://github.com/mpaperno/WASimCommander
COPYRIGHT: (c) Maxim Paperno; All Rights Reserved.
This file may be used under the terms of either the GNU General Public License (GPL)
or the GNU Lesser General Public License (LGPL), as published by the Free Software
Foundation, either version 3 of the Licenses, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Copies of the GNU GPL and LGPL are included with this project
and are available at <http://www.gnu.org/licenses/>.
*/

#pragma once

#ifdef WSMCMND_ENUM_EXPORT
#undef WSMCMND_ENUM_EXPORT
#undef WSMCMND_ENUM_NAMESPACE
#endif

#define WSMCMND_ENUM_EXPORT
#define WSMCMND_ENUM_NAMESPACE WASimCommander::Client

#include "./enums_impl.h"
83 changes: 83 additions & 0 deletions include/WASimCommander_SDK-v1.2.0.0/client/enums_impl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
This file is part of the WASimCommander project.
https://github.com/mpaperno/WASimCommander
COPYRIGHT: (c) Maxim Paperno; All Rights Reserved.
This file may be used under the terms of either the GNU General Public License (GPL)
or the GNU Lesser General Public License (LGPL), as published by the Free Software
Foundation, either version 3 of the Licenses, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Copies of the GNU GPL and LGPL are included with this project
and are available at <http://www.gnu.org/licenses/>.
*/

// DO NOT USE THIS FILE DIRECTLY -- NO INCLUDE GUARD
// Use client/enums.h

#include <cstdint>
#include <vector>

#ifndef WSMCMND_ENUM_EXPORT
#define WSMCMND_ENUM_EXPORT
#define WSMCMND_ENUM_NAMESPACE WASimCommander::Client
#endif

namespace WSMCMND_ENUM_NAMESPACE
{

/// Client status flags. \sa WASimClient::status()
WSMCMND_ENUM_EXPORT enum class ClientStatus : uint8_t
{
Idle = 0x00, ///< no active SimConnect or WASim server connection
Initializing = 0x01, ///< trying to connect to SimConnect
SimConnected = 0x02, ///< have SimConnect link
Connecting = 0x04, ///< attempting connection to WASim server
Connected = 0x08, ///< connected to WASim server
ShuttingDown = 0x10, ///< closing SimConnect link, before being back in Idle status mode
AllConnected = SimConnected | Connected,
};
#if defined(DEFINE_ENUM_FLAG_OPERATORS) && !defined(_MANAGED)
DEFINE_ENUM_FLAG_OPERATORS(ClientStatus)
#endif
/// \name Enumeration name strings
/// \{
static const std::vector<const char *> ClientStatusNames = { "Idle", "Initializing", "SimConnected", "Connecting", "Connected", "ShuttingDown" }; ///< \refwcc{ClientStatus} enum names.
/// \}

/// Client event type enumeration. \sa ClientEvent, ClientStatus, WASimClient::setClientEventCallback()
WSMCMND_ENUM_EXPORT enum class ClientEventType : uint8_t
{
None = 0,
SimConnecting, ///< Initializing status
SimConnected, ///< SimConnected status
SimDisconnecting, ///< ShuttingDown status
SimDisconnected, ///< From SimConnected to Initializing status change
ServerConnecting, ///< Connecting status
ServerConnected, ///< Connected status
ServerDisconnected, ///< From Connected to SimConnected status change
};
/// \name Enumeration name strings
/// \{
static const std::vector<const char *> ClientEventTypeNames = { "None",
"SimConnecting", "SimConnected", "SimDisconnecting", "SimDisconnected",
"ServerConnecting", "ServerConnected", "ServerDisconnected" }; ///< \refwcc{ClientEventType} enum names.
/// \}

/// Log entry source, Client or Server. \sa WASimClient::logCallback_t
WSMCMND_ENUM_EXPORT enum class LogSource : uint8_t
{
Client, ///< Log record from WASimClient
Server ///< Log record from WASimModule (Server)
};
/// \name Enumeration name strings
/// \{
static const std::vector<const char *> LogSourceNames = { "Client", "Server" }; ///< \refwcc{LogSource} enum names.
/// \}

};
51 changes: 51 additions & 0 deletions include/WASimCommander_SDK-v1.2.0.0/client/exports.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
This file is part of the WASimCommander project.
https://github.com/mpaperno/WASimCommander
COPYRIGHT: (c) Maxim Paperno; All Rights Reserved.
This file may be used under the terms of either the GNU General Public License (GPL)
or the GNU Lesser General Public License (LGPL), as published by the Free Software
Foundation, either version 3 of the Licenses, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Copies of the GNU GPL and LGPL are included with this project
and are available at <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "global.h"

#if defined(_MSC_VER) && defined(WSMCMND_API_IMPORT)

// This exercise is mainly to silence MSVC warnings (C4251) when exporting (to DLL) some variables which use stdlib templated types.
// It does not actually make any difference since the produced DLLs are compiler-specific anyway. And we're only exporting
// very basic vector types which are simply dynamic memory allocation (std::string just being a glorified char array, after all).
// We could probably just as well disable the warning... but we'll try to do it "the right way."
//#pragma warning( disable: 4251 )

#include <string>
#include <vector>

// for string (basic_string<char>)
WSMCMND_API_IMPORT template class WSMCMND_API std::allocator<char>;
WSMCMND_API_IMPORT template union WSMCMND_API std::_String_val<std::_Simple_types<char>>::_Bxty;
WSMCMND_API_IMPORT template class WSMCMND_API std::_String_val<std::_Simple_types<char>>;
WSMCMND_API_IMPORT template class WSMCMND_API std::_Compressed_pair<std::allocator<char>,std::_String_val<std::_Simple_types<char>>,true>;
WSMCMND_API_IMPORT template class WSMCMND_API std::basic_string<char, std::char_traits<char>, std::allocator<char>>;
// for vector<uint8_t>
WSMCMND_API_IMPORT template class WSMCMND_API std::allocator<uint8_t>;
WSMCMND_API_IMPORT template class WSMCMND_API std::_Vector_val<std::_Simple_types<uint8_t>>;
WSMCMND_API_IMPORT template class WSMCMND_API std::_Compressed_pair<std::allocator<uint8_t>,std::_Vector_val<std::_Simple_types<uint8_t>>,true>;
WSMCMND_API_IMPORT template class WSMCMND_API std::vector<uint8_t, std::allocator<uint8_t>>;
// for vector< pair< int, string > >
WSMCMND_API_IMPORT template class WSMCMND_API std::_Vector_val<std::_Simple_types<std::pair<int,std::string>>>;
WSMCMND_API_IMPORT template class WSMCMND_API std::_Compressed_pair<std::allocator<std::pair<int,std::string>>,std::_Vector_val<std::_Simple_types<std::pair<int,std::string>>>,true>;
WSMCMND_API_IMPORT template class WSMCMND_API std::vector<std::pair<int,std::string>,std::allocator<std::pair<int,std::string>>>;

#endif
30 changes: 30 additions & 0 deletions include/WASimCommander_SDK-v1.2.0.0/enums.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
This file is part of the WASimCommander project.
https://github.com/mpaperno/WASimCommander
COPYRIGHT: (c) Maxim Paperno; All Rights Reserved.
This file may be used under the terms of either the GNU General Public License (GPL)
or the GNU Lesser General Public License (LGPL), as published by the Free Software
Foundation, either version 3 of the Licenses, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Copies of the GNU GPL and LGPL are included with this project
and are available at <http://www.gnu.org/licenses/>.
*/

#pragma once

#ifdef WSMCMND_ENUM_EXPORT
#undef WSMCMND_ENUM_EXPORT
#undef WSMCMND_ENUM_NAMESPACE
#endif

#define WSMCMND_ENUM_EXPORT
#define WSMCMND_ENUM_NAMESPACE WASimCommander::Enums

#include "./enums_impl.h"
Loading

0 comments on commit d106d1b

Please sign in to comment.