Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 101 additions & 15 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ are defined within the "cacheVariables" section. Modify/Add your own as required
to indicate to VS 2022 where to find some libraries (.lib) or include files (.hpp), those are specific to this
example and may not apply to your setup.

<CMakePreset.json file example>
<CMakePresets.json file example>

{
"version": 3,
Expand All @@ -430,9 +430,9 @@ example and may not apply to your setup.
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_CONFIGURATION_TYPES": "Debug;Release;RelWithDebInfo",
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_SUPPRESS_DEVELOPER_WARNINGS": "1",
"CMAKE_PREFIX_PATH": "C:/Qt/6.7.3/msvc2022_64;C:/Dev/Libs/exiv2-0.28.7/lib/cmake/exiv2",
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_SUPPRESS_DEVELOPER_WARNINGS": "1",
"CMAKE_PREFIX_PATH": "C:/Qt/6.7.3/msvc2022_64;C:/Dev/Libs/exiv2-0.28.7/lib/cmake/exiv2",
"QT_QMAKE_EXECUTABLE": "C:/Qt/6.7.3/msvc2022_64/bin/qmake.exe",
"ENABLE_SCRIPTING": "ON",
"ENABLE_GPS": "ON",
Expand Down Expand Up @@ -473,7 +473,7 @@ example and may not apply to your setup.
on your main system drive. Add the path to your user/system environment variables PATH to allow Stellarium to
discover them during runtime.

Open Visual Studio 2022 (run as admin). Continue wihtout code.
Open Visual Studio 2022. Continue without code.

If you want to use a specific cmake.exe go to Tools -> Options, navigate to Cmake -> General and fill the appropriate
checkbox and path. Otherwise VS 2022 will use it own cmake.exe tool. The path of an external cmake should be included
Expand All @@ -499,26 +499,112 @@ Then build by typing this command in the Developer Command Prompt:

cmake --build --preset Release

Redo the same process for the last build, ie. RelWithDebInfo.
Redo the same process for the last build, i.e. RelWithDebInfo.

cmake --build --preset RelWithDebInfo

**Note** : Once all three builds are completed, YOU MUST REMAIN in the Folder View of VS 2022 for all subsequent actions.
Do not open any of the Stellarium.sln files generated by VS 2022. This may disrupt the multi-config links between Visual
Studio and Qt.

At this point you can run any executables (Start Debugging F5 or Start without Debugging Ctrl-F5). Just ensure you specify
which executable by setting it as 'Set as Startup Item' prior

To run test suites (if ENABLE_TESTING = ON), use again the Developer Command Prompt. Navigate to <stel_dir>+"\build.
Then type one of these three commands:

ctest -C Debug
ctest -C Release
ctest -C RelWithDebInfo

If you edit the code of your source files, select from the Configuration dropdown list the configuration you want to rebuilt
and use again the Developer Command Prompt with the appropriate command : cmake --build --preset <build-type>
Once all three builds are completed and unit testing is verified you can close the folder view and open the Stellarium Solution
which is located here : stellarium/build/Stellarium.sln

File --> Close Folder
File --> Open --> Project/Solution...

Visual Studio 2022 should open Stellarium in Debug/x64 configuration. The Solution Explorer should display all the Stellarium projects.
Right click on the stellarium project to 'Set as Startup Project'. At this stage you are ready to further modify/rebuild the code, test and
run Stellarium, or any of the test cases projects listed in the Solution Explorer view, after selecting them as start-up project.

Note: To work on the Release or RelWithDebInfo configuration first select it from the dropdown top menu of Visual Studio 2022.

#### For Visual Studio 2026 (multi-configuration):

You can also used this newly released version of Visual Studio (November 2025) to build and develop Stellarium. This release fixes the bug
of VS 2022 for the building steps and in a sense simplify the building process of Stellarium. Here are the changes to the process described
above for Visual Studio 2022 (multi-configuration)

Use a slightly different CMakePresets.json file, and adapt it to your development environment.

<CMakePresets.json file example for VS 2026>
{
"version": 3,
"cmakeMinimumRequired": { "major": 3, "minor": 21, "patch": 0 },
"configurePresets": [
{
"name": "vs2026-multi-config",
"displayName": "Stellarium (VS2026 Multi-Config)",
"description": "Unified build tree for Debug, Release, and RelWithDebInfo using Visual Studio 2026",
"generator": "Visual Studio 18 2026",
"architecture": {
"value": "x64"
},
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_CONFIGURATION_TYPES": "Debug;Release;RelWithDebInfo",
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_SUPPRESS_DEVELOPER_WARNINGS": "1",
"CMAKE_PREFIX_PATH": "C:/Qt/6.7.3/msvc2022_64;C:/Dev/Libs/exiv2-0.28.7/lib/cmake/exiv2",
"QT_QMAKE_EXECUTABLE": "C:/Qt/6.7.3/msvc2022_64/bin/qmake.exe",
"ENABLE_SCRIPTING": "ON",
"ENABLE_GPS": "ON",
"ENABLE_TESTING": "ON",
"ENABLE_NLS": "ON",
"SCM_SHOULD_ENABLE_CONVERTER": "TRUE",
"GETTEXTPO_LIBRARY": "C:/Dev/Libs/gettextpo/lib/libgettextpo.lib",
"GETTEXTPO_INCLUDE_DIR": "C:/Dev/Libs/gettextpo/include",
"LIBTIDY_LIBRARY": "C:/Dev/Libs/libtidy/lib/libtidy.lib",
"LIBTIDY_INCLUDE_DIR": "C:/Dev/Libs/libtidy/include",
"EXIV2_LIBRARY": "C:/Dev/Libs/exiv2-0.28.7/lib/exiv2.lib",
"EXIV2_INCLUDE_DIR": "C:/Dev/Libs/exiv2-0.28.7/include",
"exiv2_DIR": "C:/Dev/Libs/exiv2-0.28.7/lib/cmake/exiv2",
"Qt6LinguistTools_DIR": "C:/Qt/6.7.3/msvc2022_64/lib/cmake/Qt6LinguistTools"
}
}
],
"buildPresets": [
{
"name": "Debug",
"configurePreset": "vs2026-multi-config",
"configuration": "Debug"
},
{
"name": "Release",
"configurePreset": "vs2026-multi-config",
"configuration": "Release"
},
{
"name": "RelWithDebInfo",
"configurePreset": "vs2026-multi-config",
"configuration": "RelWithDebInfo"
}
]
}

Note: To use 'Visual Studio 18 2026' generator, you need the latest version of CMake, version 4.2.0

Open Visual Studio 2026. Open the Stellarium folder.

File -> Open -> Folder... and select <stel_dir>

VS 2026 will automatically detect the CMakePresets.json file and start to configure the first Preset Configuration which
is 'Debug'. To build the Debug configuration, select Build --> Build All from the top menu of VS 2026. Building information should be
displayed in the Build Output window. If the Debug build was successful you should see the executable stellarium.exe generated in the
sub-directory <stel_dir>\build\src\Debug.

If the Debug build was successful, select from the Configuration dropdown menu of VS 2026, the next configuration specified in
the CMakePresets.json file, i.e Release in this case. VS 2026 will start cmake to configure the build. Upon completion, to build the
Release configuration select Build --> Build All from the top menu of VS 2026. If the Release build was successful you should see the
executable stellarium.exe generated in the sub-directory <stel_dir>\build\src\Release. Repeat the same steps for the RelWithDebInfo
configuration. If the RelWithDebInfo build was successful you should see the executable stellarium.exe generated in the
sub-directory <stel_dir>\build\src\RelWithDebInfo.

Upon completion of the build process for all three configurations, you can close the folder and open the Stellarium solution,
the same way as it is described for VS 2022 above.


### Supported CMake parameters
Expand Down
Loading