Web Analytics Made Easy - Statcounter
Skip to content

Building on Windows#

This guide shows how to build a SAMSON Extension on Windows with Microsoft Visual Studio and CMake.

Read it after you have already:

  • installed SAMSON and the SAMSON SDK
  • generated a new extension workspace with the Extension Generator
  • installed the required compiler, CMake, and Qt version

The goal is to open the generated workspace, build the extension, install it into SAMSON, and launch the correct SAMSON executable for either Debug or Release.

Requirements#

If you have not installed the SAMSON SDK yet, complete Installation first.

Environment assumptions used in the commands below:

  • your extension workspace contains the root CMakeLists.txt
  • SAMSON_SDK_PATH points to your installed SDK
  • QT6_DIR points to the matching Qt installation, unless it is already defined in your environment

Configuration of a project in Microsoft Visual Studio#

Once CMake is installed, generating a Visual Studio solution is straightforward.

Open your extension workspace, create or reuse a build folder, then open PowerShell in that folder.

The build folder

Run the CMake generator command that matches your Visual Studio version:

cmake -G"Visual Studio 18" `
    -DSAMSON_SDK_PATH="YourSDKPath/SAMSON-Sdks/11.0.0/" `
    -DQT6_DIR="C:/Qt/6.10.2/msvc2022_64" ..
cmake -G"Visual Studio 17" `
    -DSAMSON_SDK_PATH="YourSDKPath/SAMSON-Sdks/11.0.0/" `
    -DQT6_DIR="C:/Qt/6.10.2/msvc2022_64" ..

Note

The -G option selects the CMake generator. Run cmake -h to list the generators available on your machine.

Note

YourSDKPath is the path to your installed SAMSON SDK. By default, SAMSON and its SDK are installed in C:\Users\%USERNAME%\OneAngstrom\.

Note

If QT6_DIR is already defined in your environment, you may not need to pass it explicitly.

Project generation using CMake

If configuration succeeds, you should see a generated .sln file in the build folder.

Generation is done

Open that solution in Visual Studio and confirm that the workspace structure looks correct.

Project view in MSVS

Building step#

The generated solution contains one target per extension plus CMake helper targets.

For normal development:

  1. choose Debug when writing and debugging code
  2. choose Release when validating performance or preparing a distribution build
  3. enable the INSTALL target so Visual Studio copies the built extension into SAMSON automatically

To enable installation, open the solution properties and, for both Debug and Release, enable the build checkbox for the INSTALL target in Configuration Properties > Configuration.

Project Configuration: INSTALL

Now build either:

  • the extension target itself, if you only want to compile
  • INSTALL, if you want to compile and install in one step
  • ALL_BUILD, if your solution contains multiple extensions and you want to build everything

Checkpoint:

  • the build succeeds
  • the install step copies the extension into the correct SAMSON directory

Running SAMSON#

The SAMSON executable must match the build configuration of your extension:

  • Release builds are loaded by the Release SAMSON application installation
  • Debug builds are loaded by the Debug SAMSON executable that comes with the SDK

Set the extension target, for example SEMyElement, as the Startup Project.

Then open the target properties and set Configuration Properties > Debugging > Command to the correct SAMSON-Core.exe path for each configuration:

  • Release example: C:\Users\%USERNAME%\OneAngstrom\SAMSON-Application\11.0.0\Binaries\SAMSON-Core.exe
  • Debug example: C:\Users\%USERNAME%\OneAngstrom\SAMSON-Sdks\11.0.0\SAMSON-Debug\Binaries\SAMSON-Core.exe

Set command to run

Once this is set, the normal loop becomes:

  1. build the solution or the INSTALL target
  2. press F5 to launch SAMSON under the debugger
  3. verify that the extension is loaded and visible in SAMSON

Adding files to a SAMSON Extension#

When you add or remove source files, classes, or resources, you need to regenerate the CMake project.

You can do that by:

  • running CMake again from the build folder, or
  • making a small change to the extension CMakeLists.txt and letting Visual Studio/CMake reconfigure automatically on the next build

Adding new SAMSON Extensions to the project#

If you generate new extensions in the same workspace, the Extension Generator updates the root CMakeLists.txt with ADD_SUBDIRECTORY. The next CMake reconfiguration should pull the new targets into the solution automatically.

Troubleshooting#

  • If CMake cannot find Qt, verify QT6_DIR.
  • If the extension builds but does not load, check that you launched the SAMSON executable matching the build configuration.
  • If the project structure looks incomplete, regenerate the solution from the root CMakeLists.txt.

If you have questions or run into issues, use the SAMSON Connect Forum or contact us.

Next steps#