[cmake]: https://cmake.org/ [cmake ext]: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools [cmake presets]: https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html [cpp ext]: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools [clangd ext]: https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd [dotnet]: https://dotnet.microsoft.com/en-us/download/dotnet [ninja build]: https://ninja-build.org/ [ninja multi-config generator]: https://cmake.org/cmake/help/latest/generator/Ninja%20Multi-Config.html [python]: https://www.python.org/ [py venv]: https://docs.python.org/3/library/venv.html [visual studio]: https://visualstudio.microsoft.com/ [visual studio generator]: https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2017%202022.html # C++ Intellisense for Spark on Windows (VS Code) **Steps** 1. Install the **[C++ extension][cpp ext]** 2. Install the **[CMake extension][cmake ext]** 3. Copy `c_cpp_properties.json` from this folder to `$workspaceFolder/.vscode/` 4. In the VS Code Command Palette, run **CMake: Select Configure Preset**, then select '**spark**' from the dropdown **Notes** * Intellisense won't work for generated files/types until you build libspark # C++ Intellisense for Sparkd on Linux (VS Code) 1. Install the **[CMake extension][cmake ext]** 2. Install the **[Clangd extension][clangd ext]** 3. (Optional) Install the **[C++ extension][cpp ext]** (*needed for debugging, but intellisense should work without it*). 4. If the **[C++ extension][cpp ext]** is installed, disable its intellisense in your workspace settings (*Clangd intellisense is better*) ``` "C_Cpp.intelliSenseEngine": "disabled" ``` 5. In the VS Code Command Palette, run **CMake: Select Configure Preset**, then select the **[preset][cmake presets]** you wish to build from the dropdown * *The **Clang** presets may work best with the **Clangd** extension* * *Intellisense won't work for generated files/types until you build libspark* # Build Sparkd on Linux **Notes** * Sparkd is built using **[CMakePresets][cmake presets]** **Steps** 1. Set up the **[Python virtual environment][py venv]**
* *Run commands from the repo root dir unless otherwise noted* 1. Create the virtual environment ``` python3 -m venv .venv ``` 2. Activate the virtual environment ``` . .venv/bin/activate ``` 3. Verify `python` in the venv is first in the path
* ***Expected:** output shows the absolute path to `.venv/bin/python`* ``` which python ``` 4. Update `pip`
* *The venv module initializes virtual environments with its own version of pip, rather than the system's version. Even if the latter is up-to-date, the former may not be.* ``` python -m pip install --upgrade pip ``` 5. Install the packages listed `requirements.txt` ``` pip install -r requirements.txt ``` 2. Build **Sparkd**
* From the terminal ``` tools/build_sparkd.sh ``` * *Run with `--help` to see available options* * From VS Code 1. Install the **[CMake extension][cmake ext]** 2. In the VS Code Command Palette, run **CMake: Select Configure Preset**, then select the **[preset][cmake presets]** you wish to build from the dropdown 3. Run **CMake: Build** in the command palette. # Build Spark Api Server on Windows ### **Dependencies** * **[CMake][cmake]** (version >= 3.23) * **[Python][python]** (version >= 3.9) * **[Visual Studio][visual studio]** (version) * **[Dotnet][dotnet]** (sdk version >= 7.0.0) ### **References** * **[CMakePresets][cmake presets]** * **[Visual Studio 17 2022 (CMake generator)][visual studio generator]** * **[Python Virtual Environment][py venv]** ### Notes * *Run commands from the repo root dir unless otherwise noted* 1. Set up the **[Python Virtual Environment][py venv]** ``` # Create the virtual environment python3 -m venv .venv # Activate the virtual environment .venv\bin\activate.bat # Update pip python -m pip install --upgrade pip # Install packages pip install -r requirements.txt ``` 2. Build * *Run in python virtual environment* ``` # Configure cmake --preset spark-api-server-windows # Build debug cmake --build --preset spark-api-server-windows-debug dotnet build Spark.Api.Server.sln --configuration Debug # Build release cmake --build --preset spark-api-server-windows-release dotnet build Spark.Api.Server.sln --configuration Release ``` # Build Spark Api Server on Linux ### **Dependencies** * **[CMake][cmake]** (version >= 3.23) * **[Ninja Build][ninja build]** * **[Python][python]** (version >= 3.9) * **[Dotnet][dotnet]** (sdk version >= 7.0.0) ### **References** * **[CMakePresets][cmake presets]** * **[Ninja Multi-Config (CMake generator)][ninja multi-config generator]** * **[Python Virtual Environment][py venv]** ### Prerequisites * Open repository in a VS Code [Devcontainer](../docker/sparkd/dev/README.md), or create your own [docker container](../docker/sparkd/dev/README.md) in which to build ### Notes * *Run commands from the repo root dir unless otherwise noted* 1. Set up the **[Python Virtual Environment][py venv]** ``` # Create the virtual environment python3 -m venv .venv # Activate the virtual environment . .venv/bin/activate # Update pip python -m pip install --upgrade pip # Install packages pip install -r requirements.txt ``` 2. Build * *Run in python virtual environment* ``` # Configure cmake --preset spark-api-server-linux # Build debug cmake --build --preset spark-api-server-linux-debug dotnet build Spark.Api.Server.sln --configuration Debug # Build release cmake --build --preset spark-api-server-linux-release dotnet build Spark.Api.Server.sln --configuration Release ```