Tutorial¶
Create an application from scratch¶
If you want to create an application that uses pars, you can conveniently use the pars-app-template
:
Using GitHub web¶
click on
Use this template
then
Create a new repository
complete the procedure by naming your repository
follow the instructions in the
Develop a pars application
section
Using git¶
create the repository somewhere, say it’s
git@somewhere:somebody/my-pars-app.git
clone the template
git clone https://github.com/grobwrk/pars-app-template my-pars-app
change directory to it
cd my-pars-app
set origin url
git remote set-url origin git@somewhere:somebody/my-pars-app.git
push set upstream
git push -u origin
follow the instructions in the
Develop a pars application
section
Integrate pars into your application¶
At the moment we only support vcpkg.
Note
If you’re not using vcpkg in your project, you’re welcoming to contribute on extending the build systems that pars support.
Install vcpkg and my-vcpkg-triplets¶
install vcpkg (https://learn.microsoft.com/en-us/vcpkg/get_started/get-started?pivots=shell-bash)
make sure that you set
VCPKG_ROOT
environment variableinstall my-vcpkg-triplets to
${VCPKG_ROOT}/../my-vcpkg-triplets
by cloning the repository (https://github.com/Neumann-A/my-vcpkg-triplets)
Add pars overlay to your project¶
At the moment of writing the pars project is not yet published on the vcpkg repository. Follow these steps to add it as an overlay to your vcpkg base project:
create the folder
ports/pars
copy there the files
portfile.cmake
andvcpkg.json
from the repository https://github.com/grobwrk/pars-app-templateenable the overlay by adding it in the
overlay-ports
of thevcpkg-configuration.json
file:
"overlay-ports": [
"./ports/pars"
]
Add pars port¶
run
vcpkg add port pars
include
<pars/pars.h>
build the project
Develop a pars application¶
Using CMake¶
change directory to where your project is
run
cmake --list-presets
choose a presets from the list, let’s say
linux-debug-llvm
run
cmake --preset linux-debug-llvm
run
cmake --build out/build/linux-debug-llvm
Using Qt Creator¶
This procesure was tested on Qt Creator 16.0.0
:
start
Qt Creator
navigate where the
CMakeLists.txt
of your project isopen it
on the configure page, select the LLVM kits
click
Configure Project
build the project
Using Visual Studio¶
This procedure was tested on Microsoft Visual Studio Community 2022 (64-bit)
version 17.13.6
.
start
Visual Studio
click
Open a Local Folder
open the root directory of your project
click
Project > CMake Workspace Settings
turn
enableCmake
fromfalse
totrue
save
build the project