Skip to content

Conversation

@CaptainSwag101
Copy link
Contributor

@CaptainSwag101 CaptainSwag101 commented Aug 9, 2024

I believe that NASSP would gain significant benefits from transitioning our build system to use CMake. In a nutshell, CMake is a higher-level, more abstract system than something like the Visual Studio project files that we currently use to define our vessels, libraries, MFDs, etc. Rather than directly instructing a C++ compiler on how to build the code, it processes a set of instructions like a script, and generates an intermediary output file which is then used by a C++ compiler to build our code. (In theory, CMake can actually be used to generate VS project files, which is pretty cool.)

CMake has some very nice features for those familiar with it, but it will also let us keep our existing workflow relatively unchanged. Some particular benefits I see for NASSP are as follows:

  • Having much less verbose, human-readable project files that can be edited like source code, and which will play nicer with git.
  • The ability to use logic within our project files and introduce/remove in-code definitions directly from the build system, depending on user-defined settings or for particular build configurations. As an example, while we would eventually like to not require explicit code changes to enable J-Mission systems, CMake could (with some work) allow toggling J-Mission code and systems configs with a single check-box, while we figure out a more elegant and modular solution down the line.
  • It gives our project files a "clean slate" free of the roughly 20 years of legacy leftovers and inscrutable per-project tweaks and adjustments. This also helps make them easier to understand as a side-effect.
  • More progress towards an OS-agnostic future. While CMake is compatible with Visual Studio, and can even be used to generate VS project files if desired, moving away from direct reliance on Visual Studio will give us more flexibility going forward with what tools we use, and if Orbiter ever makes a full transition away from Windows-specific SDKs and libraries, this will make it easier for us to follow suit.
  • Significantly less work is required to enable OpenOrbiter/Orbiter 2024 compatibility, with the added benefit of being able to keep VESIM functionality in all situations. OpenOrbiter/Orbiter Beta detection is now done automatically based on the presence of "lua.dll", which should only exist in OpenOrbiter/Orbiter 2024 installations because it's named differently in Orbiter Beta. No more separate branches and frustrating merge conflicts; now one branch can build for both versions of the simulator.

Since these changes would inherently allow for OpenOrbiter compatibility, this PR supersedes #793.

I have had several devs personally encourage these changes, and I am naturally an advocate for switching to CMake after seeing the workflow and practical improvements it offers us. As-is, the only changes needed to put this in a fully "ready for prime-time" state would be to delete the old VS project files, to ensure users don't get confused and use the wrong system. I have not done this yet, for the sake of making it easy to merge/rebase to upstream changes or for folks to experiment with migrating their outstanding pull requests if they so desire. These are foundational changes, and I want to give everybody plenty of time to figure out what this is all about, and to test and give me feedback on workflow, stability, and other issues that I can't discover by myself. I have only been using and learning about CMake for a year or two, and this is by far the most complex thing I've done with it. Nevertheless, I have been very encouraged by how simple it has been to re-organize a project as big and complex as NASSP into this new build system with relatively little work; I think it speaks to CMake's strengths that it can be done by even someone as relatively inexperienced as me.

@CaptainSwag101 CaptainSwag101 self-assigned this Aug 9, 2024
target_link_libraries(${PROJECT_NAME} Orbiter)
target_link_libraries(${PROJECT_NAME} Orbitersdk)
target_link_libraries(${PROJECT_NAME} PanelSDK)
target_link_libraries(${PROJECT_NAME} XRSound) No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why you're only passing one library to each target_link_libraries() call? You could instead do something like

target_link_libraries(${PROJECT_NAME} PRIVATE
    GLU32
    dxguid
    dinput8
    OpenGL32
    User32
    WinMM
    WS2_32
    Orbiter
    Orbitersdk
    PanelSDK
    XRSound
)

which would be less verbose and potentionally a bit more performant on the CMake side.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, I didn't realize that was possible, thanks! Much more elegant.

@CaptainSwag101 CaptainSwag101 force-pushed the CMake branch 2 times, most recently from f0e4ceb to 3aea6c5 Compare August 19, 2024 21:06
@CaptainSwag101 CaptainSwag101 force-pushed the CMake branch 4 times, most recently from a62b276 to 8211b5c Compare January 14, 2025 19:16
@CaptainSwag101 CaptainSwag101 force-pushed the CMake branch 2 times, most recently from f1199e9 to 09e88e0 Compare February 5, 2025 02:35
@CaptainSwag101 CaptainSwag101 force-pushed the CMake branch 3 times, most recently from ed5c7f5 to b3b23f2 Compare February 22, 2025 02:10
@CaptainSwag101 CaptainSwag101 changed the title Transition build system to CMake Transition development to Orbiter 2024 x64, change build system to CMake Feb 22, 2025
@CaptainSwag101 CaptainSwag101 force-pushed the CMake branch 2 times, most recently from b5c4966 to a751c63 Compare March 9, 2025 00:53
@CaptainSwag101 CaptainSwag101 force-pushed the CMake branch 2 times, most recently from 1fe98d1 to 93d3b84 Compare May 2, 2025 17:52
@maxq519 maxq519 mentioned this pull request May 16, 2025
7 tasks
@CaptainSwag101 CaptainSwag101 marked this pull request as ready for review May 18, 2025 02:15
@CaptainSwag101 CaptainSwag101 force-pushed the CMake branch 2 times, most recently from 7aa3cff to d20ddce Compare June 18, 2025 03:30
CaptainSwag101 and others added 29 commits December 6, 2025 10:29
While Orbiter 2024 only fully supports 32-bit compilation, 64-bit is an alternate option that is offered and some people may wish to use it. To accommodate this, we will disable the celestial bodies which only exist as closed-source, 32-bit libraries, because they cause havoc with orbits and vessel trajectories when using the 64-bit version of Orbiter 2024. Disabling these only affects NASSP flights, and it will not impact optical sightings because none ever use the moons of the various other planets (nor do the optics have the capability to see them, in all honesty).
Turns out the Earth.cfg file isn't used in modern scenarios, it's the Earth_VirtualAGC file we need to modify!
These were only used by the "broken" NASSP 7 scenario holdovers, and they weren't being updated like the rest of our configs. Removing them makes it clear which files need to be changed, and probably improves the situation for the broken scenarios as far as solar system accuracy goes now that they're not using 10-year-old configs.
Fix Orbiter dependency path

Fix CMake source path, generator, and architecture

More fixes and improvements to build workflow

Even more fixes?

Fixes pt 3

Final fix?

Set GH token

Fix and simplify release tagging

Try and fix the per-config subdirectory added to the build output

Add comment for buildbot workaround, fix release commit tagging

Use PowerShell directly for downloading Orbiter release ZIP

See if we can use multithreading for compilation

Remove autobuild from PRs, look at CMake branch now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants