Compiling Engine for Windows

Requirements

For compiling under Windows, the following is required:

See also

To get the Scorpion source code for compiling, see Getting the source.

Setting up CMake

To install CMake, download the installer from the CMake website and run it.

You can then check that CMake is installed by running cmake --version in a command prompt.

Downloading Scorpion’s source

Refer to Getting the source for detailed instructions.

Warning

To prevent slowdowns caused by continuous virus scanning during compilation, add the Scorpion source folder to the list of exceptions in your antivirus software.

For Windows Defender, hit the Windows key, type “Windows Defender Settings” then hit Enter. Under Virus & threat protection, go to Virus & threat protection setting and scroll down to Exclusions. Click Add or remove exclusions then add the Scorpion source folder.

Running CMake

mkdir .build && cd .build
cmake .. -G "Visual Studio 17 2022" -DSAM_STATIC_ANN_ONNX_MODELPATH="path/to/ANN-78M-in2381-h11-out1-v0.onnx"
                                    -DSAM_STATIC_ANN_STANDARDIZE_PARAMS="path/to/standardize-params-20240307_181717.pkl"
                                    -DSAM_STATIC_CNN_COLORMAP="path/to/gray_colormap.npy"
                                    -DSAM_ONNXRUNTIME_ROOTDIR="path/to/onnxruntime-win-x64-1.17.1/"
                                    -DSAM_STATIC_CNN_ONNX_MODELPATH="path/to/CNN-model3-167M-in(1,256,256)-out1.onnx"

Note

You need to download our trained models in order to compile the engine. Check Models for more information.

You can build then with:

cmake --build . --config Debug

Note

When compiling with -DSAM_BUILD_TESTS=ON, you will get multiple warnings about linking, you can ignore them.

If all goes well, you will have our engine’s .lib and .dll files in the .build folder.

Tip

If you want to test the engine, you can build with -DSAM_BUILD_CLI_TOOLS=ON and run the executable. DON’T forget to add the directories you want to scan inside .build/sam-cli-tools/scanareasprocessor_output.pathl file. You can then run the executable in the .build folder. .. code-block:: shell

./sam-cli-tools/Debug/sam-cli-tools.exe

Tip

Add your project build directory to the list of excluded directories of any anti-virus application that runs on your system.

Linking The Console

To link the console, you will need to run cmake with -DSAM_LINK_CONSOLE=ON and give it the prefix of the console’s path. For example, if you want to link the console, you will run:

cmake .. -G "Visual Studio 17 2022" -DSAM_STATIC_ANN_ONNX_MODELPATH="path/to/ANN-78M-in2381-h11-out1-v0.onnx"
                                    -DSAM_STATIC_ANN_STANDARDIZE_PARAMS="path/to/standardize-params-20240307_181717.pkl"
                                    -DSAM_STATIC_CNN_COLORMAP="path/to/gray_colormap.npy"
                                    -DSAM_ONNXRUNTIME_ROOTDIR="path/to/onnxruntime-win-x64-1.17.1/"
                                    -DSAM_STATIC_CNN_ONNX_MODELPATH="path/to/CNN-model3-167M-in(1,256,256)-out1.onnx"
                                    -DSAM_LINK_CONSOLE=ON
                                    -DCMAKE_PREFIX_PATH="C:/Qt/{QT_VERSION}/{MSVC_VERSION}/lib/cmake/"

Then run the build command:

cmake --build . --config Debug

Then run the console executable in the .build folder.

./Debug/scorpion-antimalware.exe

Note

You will need to add C:/Qt/{QT_VERSION}/{MSVC_VERSION}/bin/ to PATH in order to run the software without errors.

Python Embedding

We embed Python 3.12 in our engine to run the Python scripts. You will need to get the packages required from the requirements.txt file in the root.

pip install -r requirements.txt

Note

to use the Python modules with no problems, you need to make sure that Download debug binaries option is checked in the Advanced Options.

Note

Check Add Python to enviroment variables option in the installation wizard.

Running Engine’s Tests

To run the tests, you will need to run cmake with -DSAM_BUILD_TESTS=ON and then run the corresponding test executable in the .build folder.

./tests/Debug/sam-engine-tests.exe

You will find the command for each test case in the tests folder.