Skip to content

Commit

Permalink
Merge branch 'master' into stagging
Browse files Browse the repository at this point in the history
  • Loading branch information
YannickNovelab committed Aug 17, 2023
2 parents ae1a287 + e31b493 commit 31d1a4c
Show file tree
Hide file tree
Showing 51 changed files with 3,163 additions and 1,916 deletions.
31 changes: 28 additions & 3 deletions .github/workflows/cpp-python-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,34 @@ jobs:
xmllint --noout --schema JSBSimSystem.xsd $filename
done
MSIS-validation:
name: MSIS code validation
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{matrix.os}}
steps:
- name: Checkout JSBSim
uses: actions/checkout@v3
- name: Configure the MSIS test program
run: |
mkdir build && cd build
cmake ../src/models/atmosphere/MSIS
- name: Build the JSBSim test program
working-directory: build
run: make -j2
- name: Run the NRLMSIS-00 C package
working-directory: src/models/atmosphere/MSIS
run: |
if [[ $(head -261 DOCUMENTATION | tail -104 | diff -urN <(../../../../build/nrlmsise-test) - | wc -c) -ne 0 ]]; then
echo "Failed."
exit 1
fi
Linux:
name: C/C++ build (Linux)
needs: XML-validation
needs: [XML-validation, MSIS-validation]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -404,7 +429,7 @@ jobs:
MacOSX:
name: C/C++ build (MacOSX)
needs: XML-validation
needs: [XML-validation, MSIS-validation]
runs-on: macos-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -618,7 +643,7 @@ jobs:
Copy-Item -Path .\JSBSim-*\jsbsim\*.pyi -Destination ..\..\build\python\jsbsim
echo "::endgroup::"
- name: Build wheels
uses: pypa/cibuildwheel@v2.12.3
uses: pypa/cibuildwheel@v2.14
env:
CIBW_BEFORE_ALL_LINUX: |
cd build
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,5 @@ UnrealEngine/Binaries
UnrealEngine/DerivedDataCache
UnrealEngine/Intermediate
UnrealEngine/Saved

UnrealEngine
UnrealEngine/UEReferenceApp.xcworkspace
UnrealEngine/UEReferenceApp.sln
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ if (CXXTEST_FOUND)
list(APPEND LCOV_REMOVE_PATTERNS "'*/GeographicLib/*'")
list(APPEND LCOV_REMOVE_PATTERNS "'*/simgear/*'")
list(APPEND LCOV_REMOVE_PATTERNS "'*/unit_tests/*'")
list(APPEND LCOV_REMOVE_PATTERNS "'*/models/atmosphere/MSIS/*'")
coverage_evaluate()
endif(CXXTEST_FOUND)

Expand Down
4 changes: 3 additions & 1 deletion JSBSim.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@
<ClInclude Include="src\math\LagrangeMultiplier.h" />
<ClInclude Include="src\models\atmosphere\FGStandardAtmosphere.h" />
<ClInclude Include="src\models\atmosphere\FGWinds.h" />
<ClInclude Include="src\models\atmosphere\MSIS\nrlmsise-00.h" />
<ClInclude Include="src\models\FGAccelerations.h" />
<ClInclude Include="src\models\FGFCSChannel.h" />
<ClInclude Include="src\models\FGSurface.h" />
Expand Down Expand Up @@ -369,6 +370,8 @@
<ClCompile Include="src\math\FGTemplateFunc.cpp" />
<ClCompile Include="src\models\atmosphere\FGStandardAtmosphere.cpp" />
<ClCompile Include="src\models\atmosphere\FGWinds.cpp" />
<ClCompile Include="src\models\atmosphere\MSIS\nrlmsise-00.c" />
<ClCompile Include="src\models\atmosphere\MSIS\nrlmsise-00_data.c" />
<ClCompile Include="src\models\FGAccelerations.cpp" />
<ClCompile Include="src\models\FGSurface.cpp" />
<ClCompile Include="src\models\flight_control\FGAngles.cpp" />
Expand Down Expand Up @@ -420,7 +423,6 @@
<ClCompile Include="src\models\FGModel.cpp" />
<ClCompile Include="src\math\FGModelFunctions.cpp" />
<ClCompile Include="src\models\atmosphere\FGMSIS.cpp" />
<ClCompile Include="src\models\atmosphere\FGMSISData.cpp" />
<ClCompile Include="src\models\propulsion\FGNozzle.cpp" />
<ClCompile Include="src\models\FGOutput.cpp" />
<ClCompile Include="src\models\flight_control\FGPID.cpp" />
Expand Down
12 changes: 9 additions & 3 deletions JSBSim.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,6 @@
<ClCompile Include="src\models\atmosphere\FGMSIS.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\models\atmosphere\FGMSISData.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\models\propulsion\FGNozzle.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down Expand Up @@ -332,6 +329,12 @@
<ClCompile Include="src\input_output\string_utilities.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\models\atmosphere\MSIS\nrlmsise-00.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\models\atmosphere\MSIS\nrlmsise-00_data.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\input_output\FGInputSocket.h">
Expand Down Expand Up @@ -688,5 +691,8 @@
<ClInclude Include="src\JSBSim_API.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\models\atmosphere\MSIS\nrlmsise-00.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
12 changes: 6 additions & 6 deletions JSBSimForUnreal.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JSBSimForUnreal", "JSBSimFo
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
1_Release|x64 = 1_Release|x64
2_Debug|x64 = 2_Debug|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AF971B4F-3D53-4655-8A03-97E8054DC58B}.Debug|x64.ActiveCfg = Debug|x64
{AF971B4F-3D53-4655-8A03-97E8054DC58B}.Debug|x64.Build.0 = Debug|x64
{AF971B4F-3D53-4655-8A03-97E8054DC58B}.Release|x64.ActiveCfg = Release|x64
{AF971B4F-3D53-4655-8A03-97E8054DC58B}.Release|x64.Build.0 = Release|x64
{AF971B4F-3D53-4655-8A03-97E8054DC58B}.1_Release|x64.ActiveCfg = Release|x64
{AF971B4F-3D53-4655-8A03-97E8054DC58B}.1_Release|x64.Build.0 = Release|x64
{AF971B4F-3D53-4655-8A03-97E8054DC58B}.2_Debug|x64.ActiveCfg = Debug|x64
{AF971B4F-3D53-4655-8A03-97E8054DC58B}.2_Debug|x64.Build.0 = Debug|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
11 changes: 7 additions & 4 deletions JSBSimForUnreal.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(ProjectDir)src;$(ProjectDir)src\simgear\xml;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>JSBSIM_EXPORT;JSBSIM_VERSION="1.2.0.dev1";WIN32;NOMINMAX;XML_STATIC;_DEBUG;_CONSOLE;HAVE_EXPAT_CONFIG_H;_USE_MATH_DEFINES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>JSBSIM_EXPORT;JSBSIM_VERSION="1.2.0.dev1";WIN32;NOMINMAX;XML_STATIC;NDEBUG;_CONSOLE;HAVE_EXPAT_CONFIG_H;_USE_MATH_DEFINES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<FloatingPointModel>Precise</FloatingPointModel>
<FloatingPointExceptions>true</FloatingPointExceptions>
Expand All @@ -70,7 +70,8 @@
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4996;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<CompileAsManaged>false</CompileAsManaged>
<CompileAsManaged>
</CompileAsManaged>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
Expand Down Expand Up @@ -230,6 +231,7 @@ exit/B %errlev%</Command>
<ClInclude Include="src\models\FGModel.h" />
<ClInclude Include="src\math\FGModelFunctions.h" />
<ClInclude Include="src\models\atmosphere\FGMSIS.h" />
<ClInclude Include="src\models\atmosphere\MSIS\nrlmsise-00.h" />
<ClInclude Include="src\models\propulsion\FGNozzle.h" />
<ClInclude Include="src\models\FGOutput.h" />
<ClInclude Include="src\math\FGParameter.h" />
Expand Down Expand Up @@ -346,7 +348,8 @@ exit/B %errlev%</Command>
<ClCompile Include="src\models\FGModel.cpp" />
<ClCompile Include="src\math\FGModelFunctions.cpp" />
<ClCompile Include="src\models\atmosphere\FGMSIS.cpp" />
<ClCompile Include="src\models\atmosphere\FGMSISData.cpp" />
<ClCompile Include="src\models\atmosphere\MSIS\nrlmsise-00.c" />
<ClCompile Include="src\models\atmosphere\MSIS\nrlmsise-00_data.c" />
<ClCompile Include="src\models\propulsion\FGNozzle.cpp" />
<ClCompile Include="src\models\FGOutput.cpp" />
<ClCompile Include="src\models\flight_control\FGPID.cpp" />
Expand Down
8 changes: 7 additions & 1 deletion JSBSimForUnreal.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,10 @@
<ClCompile Include="src\models\atmosphere\FGMSIS.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\models\atmosphere\FGMSISData.cpp">
<ClCompile Include="src\models\atmosphere\MSIS\nrlmsise-00.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\models\atmosphere\MSIS\nrlmsise-00_data.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\models\propulsion\FGNozzle.cpp">
Expand Down Expand Up @@ -544,6 +547,9 @@
<ClInclude Include="src\models\atmosphere\FGMSIS.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\models\atmosphere\MSIS\nrlmsise-00.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\models\propulsion\FGNozzle.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand Down
49 changes: 49 additions & 0 deletions JSBSimForUnrealLinux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

# make build folder and cd into it
mkdir -p build
cd build

# build the jsbsim library with cmake
cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS="-stdlib=libc++" ..
make -j4

# cd back to the root directory
cd ..

# set the unreal plugin folder for use in the script
UNREAL_PLUGIN_FOLDER=./UnrealEngine/Plugins/JSBSimFlightDynamicsModel
UNREAL_PLUGIN_INCLUDE_FOLDER=$UNREAL_PLUGIN_FOLDER/Source/ThirdParty/JSBSim/Include
UNREAL_PLUGIN_LIB_FOLDER=$UNREAL_PLUGIN_FOLDER/Source/ThirdParty/JSBSim/Lib/Linux
UNREAL_PLUGIN_RESOURCES_FOLDER=$UNREAL_PLUGIN_FOLDER/Resources/JSBSim

echo "Copying JSBSim header files to Unreal plugin folder: $UNREAL_PLUGIN_INCLUDE_FOLDER"

# make the unreal plugin thirdparty/jsbsim/include folder
rm -rf $UNREAL_PLUGIN_INCLUDE_FOLDER
mkdir -p $UNREAL_PLUGIN_INCLUDE_FOLDER
# copy the include files (.h,.hxx) from src (and its subdirectories) into unreal
# plugin thirdparty/jsbsim/include folder, keeping the same directory structure
# as in src. Since we're on macos, we use rsync instead of cp to preserve the
# directory structure

# Copy headers
rsync -avm --include='*.h' --include='*.hpp' --include='*.hxx' -f 'hide,! */' src/ UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/ThirdParty/JSBSim/Include/

echo "Copying JSBSim library to Unreal plugin folder:
$UNREAL_PLUGIN_LIB_FOLDER"
# make the unreal plugin thirdparty/jsbsim/lib folder
mkdir -p $UNREAL_PLUGIN_LIB_FOLDER
# copy the jsbsim library from the build folder into the unreal plugin
# thirdparty/jsbsim/lib folder
# cp ./build/src/libJSBSim.a $UNREAL_PLUGIN_LIB_FOLDER/.
cp ./build/src/*.so $UNREAL_PLUGIN_LIB_FOLDER/.

echo "Copying JSBSim resources to Unreal plugin folder:
$UNREAL_PLUGIN_RESOURCES_FOLDER"
# make the unreal plugin resources folder
mkdir -p $UNREAL_PLUGIN_RESOURCES_FOLDER
# copy the aircraft, engine, and systems folders into the unreal plugin resources folder
cp -r ./aircraft $UNREAL_PLUGIN_FOLDER/Resources/JSBSim/.
cp -r ./engine $UNREAL_PLUGIN_FOLDER/Resources/JSBSim/.
cp -r ./systems $UNREAL_PLUGIN_FOLDER/Resources/JSBSim/.
49 changes: 49 additions & 0 deletions JSBSimForUnrealMac.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

# make build folder and cd into it
mkdir -p build
cd build

# build the jsbsim library with cmake
cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS="-stdlib=libc++" ..
make -j4

# cd back to the root directory
cd ..

# set the unreal plugin folder for use in the script
UNREAL_PLUGIN_FOLDER=./UnrealEngine/Plugins/JSBSimFlightDynamicsModel
UNREAL_PLUGIN_INCLUDE_FOLDER=$UNREAL_PLUGIN_FOLDER/Source/ThirdParty/JSBSim/Include
UNREAL_PLUGIN_LIB_FOLDER=$UNREAL_PLUGIN_FOLDER/Source/ThirdParty/JSBSim/Lib/Mac
UNREAL_PLUGIN_RESOURCES_FOLDER=$UNREAL_PLUGIN_FOLDER/Resources/JSBSim

echo "Copying JSBSim header files to Unreal plugin folder: $UNREAL_PLUGIN_INCLUDE_FOLDER"

# make the unreal plugin thirdparty/jsbsim/include folder
rm -rf $UNREAL_PLUGIN_INCLUDE_FOLDER
mkdir -p $UNREAL_PLUGIN_INCLUDE_FOLDER
# copy the include files (.h,.hxx) from src (and its subdirectories) into unreal
# plugin thirdparty/jsbsim/include folder, keeping the same directory structure
# as in src. Since we're on macos, we use rsync instead of cp to preserve the
# directory structure

# Copy headers
rsync -avm --include='*.h' --include='*.hpp' --include='*.hxx' -f 'hide,! */' src/ UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/ThirdParty/JSBSim/Include/

echo "Copying JSBSim library to Unreal plugin folder:
$UNREAL_PLUGIN_LIB_FOLDER"
# make the unreal plugin thirdparty/jsbsim/lib folder
mkdir -p $UNREAL_PLUGIN_LIB_FOLDER
# copy the jsbsim library from the build folder into the unreal plugin
# thirdparty/jsbsim/lib folder
# cp ./build/src/libJSBSim.a $UNREAL_PLUGIN_LIB_FOLDER/.
cp ./build/src/*.dylib $UNREAL_PLUGIN_LIB_FOLDER/.

echo "Copying JSBSim resources to Unreal plugin folder:
$UNREAL_PLUGIN_RESOURCES_FOLDER"
# make the unreal plugin resources folder
mkdir -p $UNREAL_PLUGIN_RESOURCES_FOLDER
# copy the aircraft, engine, and systems folders into the unreal plugin resources folder
cp -r ./aircraft $UNREAL_PLUGIN_FOLDER/Resources/JSBSim/.
cp -r ./engine $UNREAL_PLUGIN_FOLDER/Resources/JSBSim/.
cp -r ./systems $UNREAL_PLUGIN_FOLDER/Resources/JSBSim/.
3 changes: 0 additions & 3 deletions UnrealEngine/CleanProject.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@



#!/bin/bash

rm -rf *.vs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private void SetupWindowsPlatform()
string LibFolderName = "Lib";

// When working in debug mode, try to use the Debug version of JSBSim
if (Target.Configuration == UnrealTargetConfiguration.Debug)
if (Target.Configuration == UnrealTargetConfiguration.DebugGame)
{
// Source\ThirdParty\JSBSim\LibDebug
string DebugLibsPath = Path.Combine(ModuleDirectory, JSBSimLocalFolder, LibFolderName + "Debug");
Expand Down
24 changes: 15 additions & 9 deletions UnrealEngine/README-Unix.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ This document describes how to build the JSBSim library as well as the Unreal En
| Macos | Supported |
| Android | Work in progress |

## Building
## Building (Easy way)
Run `JSBSimForUnrealMac.sh` on Macos or `JSBSimForUnrealLinux.sh` on Linux

## Building (Hard way)
The first step is to build JSBSim on your target platform using cmake. Open an terminal and type the following commands

### For Macos
On macos you've to install Julia first, for instance using homebrew with the following command `brew install julia`.


```bash
mkdir -p build && cd build
julia -e "import Pkg;Pkg.add(\"CxxWrap\")"
export CXXWRAP_PREFIX_PATH=`julia -e "using CxxWrap;print(CxxWrap.prefix_path())"`
cmake -DCMAKE_INCLUDE_PATH=$PWD/../cxxtest -DBUILD_JULIA_PACKAGE=ON -DCYTHON_FLAGS="-X embedsignature=True" -DCMAKE_PREFIX_PATH=$CXXWRAP_PREFIX_PATH ..
mkdir build
cd build
cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS="-stdlib=libc++" ..
make -j4
```

Expand All @@ -45,7 +45,7 @@ rsync -avm --include='*.h' --include='*.hpp' --include='*.hxx' -f 'hide,! */' sr

# Copy the JSBSim library (Macos)
mkdir -p UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/ThirdParty/JSBSim/Lib/Mac/
cp -Rf build/julia/libJSBSimJL.dylib UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/ThirdParty/JSBSim/Lib/Mac/libJSBSim.dylib
cp -Rf build/src/libJSBSim.1.2.0.dev1.dylib UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/ThirdParty/JSBSim/Lib/Mac/libJSBSim.dylib

# Copy the JSBSim library (Linux)
mkdir -p UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/ThirdParty/JSBSim/Lib/Linux/
Expand All @@ -66,6 +66,12 @@ cp -Rf systems UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Resources/JSBSim

Run the following command to compile and run JSBSim for Unreal

You can generate a makefile or an Xcode workspace using the following command

```bash
$PATH_TO_UNREAL/Engine/Build/BatchFiles/Mac/GenerateProjectFiles.sh $PATH_TO_JSBSIM/UnrealEngine/UEReferenceApp.uproject -game
```

```bash
$PATH_TO_UNREAL/Engine/Binaries/Linux/UnrealEditor $_PATH_TO_UNREAL_PROJECTS/jsbsim/UnrealEngine/UEReferenceApp.uproject
$PATH_TO_UNREAL/Engine/Binaries/Linux/UnrealEditor $PATH_TO_JSBSIM/UnrealEngine/UEReferenceApp.uproject
```
5 changes: 5 additions & 0 deletions python/JSBSim.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
help="specifies to suspend the simulation after initialization")
parser.add_argument("--initfile", metavar="<filename>",
help="specifies an initialization file")
parser.add_argument("--planet", metavar="<filename>",
help="specifies a planet definition file")
parser.add_argument("--catalog", default=False, action="store_true",
help="specifies that all properties for this aircraft model should be printed")
parser.add_argument("--property", action="append", metavar="<name=value>",
Expand Down Expand Up @@ -123,6 +125,9 @@ def CheckXMLFile(f):

args.simulation_rate = fdm.get_delta_t()

if args.planetfile:
fdm.load_planet(args.planetfile, False)

if args.property:
pm = fdm.get_property_manager()
for p in args.property:
Expand Down

0 comments on commit 31d1a4c

Please sign in to comment.