Skip to content

Commit

Permalink
Merge branch 'orbitersim:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
spaceexpanse authored Nov 17, 2023
2 parents f464314 + 15a6f4d commit 656910c
Show file tree
Hide file tree
Showing 1,411 changed files with 304,690 additions and 80,395 deletions.
62 changes: 51 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

jobs:
build:
name: Build with CMake
name: Build

env:
DXSDK_DIR: "${{ github.workspace }}\\DXSDK"
Expand All @@ -27,6 +27,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true

- name: Setup Problem Matcher
uses: ammaraskar/msvc-problem-matcher@master
Expand All @@ -44,7 +46,7 @@ jobs:
- name: Cache irrKlang package
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/out/build/Extern/irrKlang/${{ matrix.architecture }}
path: ${{ github.workspace }}/Extern/irrKlang/${{ matrix.architecture }}
key: irrKlang-${{ matrix.architecture }}

- name: Cache DirectX SDK
Expand All @@ -65,20 +67,17 @@ jobs:
dir /S /B DXSDK
- name: Configure
working-directory: ${{ github.workspace }}/out/build
run: cmake -G Ninja ../.. -DORBITER_MAKE_DOC=OFF -DIRRKLANG_DIR:STRING="irrKlang_DOWNLOAD" -DDXSDK_DIR:PATH="${{ github.workspace }}\\DXSDK"
run: cmake . --preset windows-${{ matrix.architecture }}-release -DORBITER_MAKE_DOC=OFF -DDXSDK_DIR:PATH="${{ github.workspace }}\\DXSDK"

- name: Build
working-directory: ${{ github.workspace }}/out/build
run: cmake --build . --config RelWithDebInfo
run: cmake --build --preset windows-${{ matrix.architecture }}-release --jobs 2

- name: Test
working-directory: ${{ github.workspace }}/out/build
run: ctest --config RelWithDebInfo .
run: ctest --preset windows-${{ matrix.architecture }}-release --jobs 2

- name: Install
working-directory: ${{ github.workspace }}/out/build
run: cmake --install . --prefix ${{ github.workspace }}/out/install
working-directory: ${{ github.workspace }}/out/build/windows-${{ matrix.architecture }}-release
run: cmake --install . --prefix ${{ github.workspace }}/out/install

- name: Pack
if: ${{ github.ref == 'refs/heads/main' }}
Expand All @@ -88,9 +87,50 @@ jobs:

- name: Upload Build Artifact
if: ${{ github.ref == 'refs/heads/main' }}
uses: actions/upload-artifact@v3.1.0
uses: actions/upload-artifact@v3.1.2
with:
name: Orbiter-${{ matrix.architecture }}
# A file, directory or wildcard pattern that describes what to upload
path: ${{ github.workspace }}/out/Orbiter.zip
retention-days: 60

pre-release:
name: Publish pre-release

needs: build

runs-on: ubuntu-latest

if: ${{ github.ref == 'refs/heads/main' }}

steps:
- name: Create directories
run: mkdir out

- name: Checkout
uses: actions/checkout@v3

- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: ./out

- name: Re-arrange artifacts
run: |
mv ./Orbiter-x64/Orbiter.zip ./Orbiter-x64.zip
mv ./Orbiter-x86/Orbiter.zip ./Orbiter-x86.zip
rmdir Orbiter-x64
rmdir Orbiter-x86
ls -R
working-directory: ./out

- name: "Push pre-release tag and upload packages"
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Orbiter development build"
files: |
./out/Orbiter-x86.zip
./out/Orbiter-x64.zip
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ Sound/XRSound/**/x64/
Sound/XRSound/**/dist/
Sound/XRSound/**/Debug-with-OrbiterRelease/
Sound/XRSound/**/Release-with-OrbiterRelease/

Extern/irrKlang
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "Extern/Lua"]
path = Extern/Lua
url = https://github.com/orbitersim/lua.git
[submodule "Extern/zlib"]
path = Extern/zlib
url = https://github.com/orbitersim/zlib.git
[submodule "Extern/Catch2"]
path = Extern/Catch2
url = https://github.com/orbitersim/Catch2.git
Binary file removed BinAssets/Star.bin
Binary file not shown.
95 changes: 23 additions & 72 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ cmake_minimum_required(VERSION 3.19)
# Set the project name
project (Orbiter VERSION 21.7.24)

# Allow building targets as external projects
include(ExternalProject)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED OFF)
set(CMAKE_CXX_EXTENSIONS OFF)

#Add /permissive if using C++20 or higher
#add_compile_options(/permissive)

# Some functions to simplify debugging CMake scripts
include(CMakePrintHelpers)
Expand Down Expand Up @@ -39,11 +43,7 @@ else()
endif()

if (NOT ${CMAKE_GENERATOR} STREQUAL "Ninja")
message(STATUS "USING: MultiCore VS Solution")
set(CompileFlags "/MP")
else()
message(STATUS "USING: Ninja Configuration")
set(CompileFlags "")
add_compile_options(/MP)
endif()

# Define directories and file paths for some common binaries
Expand Down Expand Up @@ -90,19 +90,6 @@ set(GDICLIENT_LIB $<TARGET_LINKER_FILE:GDIClient>)

set(EXTERN_DIR "${CMAKE_SOURCE_DIR}/Extern")

set(ZLIB_VER "1.2.11")
set(ZLIB_DIR "${EXTERN_DIR}/zlib/zlib-${ZLIB_VER}-${ARCH}")
set(ZLIB_INCLUDE_DIR "${ZLIB_DIR}/include")
set(ZLIB_LIB_DIR "${ZLIB_DIR}/lib")
set(ZLIB_LIB "${ZLIB_LIB_DIR}/zlibstatic.lib")

set(Lua_VER "5.1")
set(LUA_DIR "${EXTERN_DIR}/Lua/Lua-${Lua_VER}-${ARCH}")
set(LUA_INCLUDE_DIR "${LUA_DIR}/include")
set(LUA_LIB_DIR "${LUA_DIR}/lib")
set(LUA_DLL_DIR "${LUA_DIR}/dll")
set(LUA_LIB "${LUA_DLL_DIR}/lua${Lua_VER}.lib")

set(DX7SDK_PATH "${EXTERN_DIR}/mssdk_dx7")
set(DX7SDK_INCLUDE_DIR "${DX7SDK_PATH}/include")
set(DX7SDK_LIB_DIR "${DX7SDK_PATH}/lib")
Expand All @@ -113,8 +100,7 @@ set(HTMLHELP_LIB_DIR ${HTMLHELP_DIR}/lib-${ARCH})
set(HTMLHELP_LIB ${HTMLHELP_LIB_DIR}/Htmlhelp.lib)

set(ORBITER_TOOL_MESHC "$<TARGET_FILE:meshc>")
set(LUA_EXE ${LUA_DIR}/bin/lua.exe)
set(ldoc ${LUA_EXE} ${LUA_DIR}/packages/LDoc/ldoc.lua)
set(ldoc $<TARGET_FILE:lua::exe> ${LUA_DIR}/packages/LDoc/ldoc.lua)

find_package(OpenGL QUIET)
find_package(HTMLHelp)
Expand All @@ -131,8 +117,8 @@ set(Qt5_x64_DIR
)

if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /we4311")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:\"LIBCMTD\"")
add_compile_options(/we4311 /DNOMINMAX)
add_link_options("/NODEFAULTLIB:\"LIBCMTD\"")
endif()

# Copy data and binary assets from source to binary tree to provide a working Orbiter environment
Expand All @@ -143,10 +129,9 @@ add_custom_target(CopyData ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Meshes/ ${CMAKE_BINARY_DIR}/Meshes
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Script/ ${CMAKE_BINARY_DIR}/Script
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Config/ ${CMAKE_BINARY_DIR}/Config
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/GravityModels/ ${CMAKE_BINARY_DIR}/GravityModels
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Flights/ ${CMAKE_BINARY_DIR}/Flights
COMMAND ${CMAKE_COMMAND} -E make_directory ${ORBITER_BINARY_SDK_DIR}/lib/Lua
COMMAND ${CMAKE_COMMAND} -E copy ${LUA_DLL_DIR}/lua5.1.lib ${ORBITER_BINARY_SDK_DIR}/lib/Lua/
COMMAND ${CMAKE_COMMAND} -E copy ${LUA_DLL_DIR}/lua5.1.dll ${CMAKE_BINARY_DIR}
)
set_target_properties(CopyData
PROPERTIES
Expand Down Expand Up @@ -281,32 +266,25 @@ option(ORBITER_MAKE_SDK_SAMPLES
OFF
)

option(ORBITER_ENABLE_ASAN
option(ORBITER_SANITIZER
"Build binaries with Address Sanitizer"
OFF
)

if(ORBITER_BUILD_XRSOUND)
set(IRRKLANG_DIR
irrKlang_NOTFOUND
CACHE
PATH
"Root folder of irrKlang installation."
)
set(IRRKLANG_DIR "" CACHE PATH "Path to the irrKlang library")
endif()

if(ORBITER_BUILD_D3D9CLIENT)
find_package(DXSDK
)
find_package(DXSDK REQUIRED)
set(DXSDK_DIR
${DXSDK_DIR}
CACHE
PATH
"Installation directory of DirectX SDK (June 2010)"
)
if(${DXSDK_DIR} STREQUAL "DXSDK_DIR-NOTFOUND")
message(WARNING "DirectX SDK not found. The D3D9 graphics client will not be built.")
set(ORBITER_BUILD_D3D9CLIENT OFF)
message(FATAL_ERROR "DirectX SDK not found. The D3D9 graphics client will not be built.")
endif()
endif()

Expand Down Expand Up @@ -339,30 +317,9 @@ if (ORBITER_MAKE_DOC)
endif()

# Enable Address SANitizer
if (ORBITER_ENABLE_ASAN AND MSVC)
set(asan_binary_dir "$ENV{VCToolsInstallDir}bin\\Host${ARCH}\\${ARCH}")
if (NOT EXISTS "${asan_binary_dir}")
message( FATAL_ERROR "ASAN: Visual Studio tools directory ${asan_binary_dir} not valid, check VCToolsInstallDir environment variable" )
endif()

if (BUILD64)
set(asan_arch_id "x86_64")
else()
set(asan_arch_id "i386")
endif()
set(asan_dll "clang_rt.asan_dynamic-${asan_arch_id}.dll")
set(asan_dbg_dll "clang_rt.asan_dbg_dynamic-${asan_arch_id}.dll")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fsanitize=address /EHsc")
add_custom_command(
COMMENT "Copying ASAN Clang runtime from ${asan_binary_dir}"
OUTPUT ${asan_dll}
OUTPUT ${asan_dbg_dll}
COMMAND ${CMAKE_COMMAND} -E copy ${asan_binary_dir}\\${asan_dll} ${ORBITER_BINARY_ROOT_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${asan_binary_dir}\\${asan_dbg_dll} ${ORBITER_BINARY_ROOT_DIR}
)
add_custom_target(AsanBinaries DEPENDS ${asan_dll})
message("Address Sanitizer Enabled")
include(cmake/sanitizer.cmake)
if (ORBITER_SANITIZER AND MSVC)
enable_sanitizer(${ORBITER_SANITIZER})
endif()

# For a given argument string template (odt_to_pdf_arglist) and source file name (infile)
Expand Down Expand Up @@ -434,15 +391,12 @@ endfunction()


# Installation
install(DIRECTORY Scenarios Textures Meshes Config Script Flights BinAssets/
DESTINATION ${ORBITER_INSTALL_ROOT_DIR}
)
install(FILES ${LUA_DLL_DIR}/lua5.1.dll
install(DIRECTORY Scenarios Textures Meshes Config GravityModels Script Flights BinAssets/
DESTINATION ${ORBITER_INSTALL_ROOT_DIR}
)
install(FILES ${LUA_DLL_DIR}/lua5.1.lib
DESTINATION ${ORBITER_INSTALL_SDK_DIR}/lib/Lua
)
#install(FILES ${LUA_DLL_DIR}/lua5.1.lib
# DESTINATION ${ORBITER_INSTALL_SDK_DIR}/lib/Lua
#)

set(CMAKE_MODULE_PATH
${ORBITER_BINARY_ROOT_DIR}
Expand All @@ -457,6 +411,7 @@ INSTALL(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
)

# Sub-projects
add_subdirectory(Extern)
add_subdirectory(Src)
add_subdirectory(Utils)
add_subdirectory(Orbitersdk)
Expand Down Expand Up @@ -517,7 +472,3 @@ if (ORBITER_MAKE_TESTS)
enable_testing()
add_subdirectory(Tests)
endif()

if (ORBITER_ENABLE_ASAN AND MSVC)
add_dependencies(Orbiter_server AsanBinaries)
endif()
Loading

0 comments on commit 656910c

Please sign in to comment.