Tutorial¶
Create an application from scratch¶
If you want to create an application that uses pars, you can conveniently use the pars-cxx-template:
Using GitHub web¶
click on
Use this templatethen
Create a new repositorycomplete the procedure by naming your repository
follow the instructions in the
Develop a pars applicationsection
Using git¶
create the repository somewhere, say it’s
git@somewhere:somebody/my-pars-app.gitclone the template
git clone https://github.com/grobx/pars-cxx-template my-pars-appchange directory to it
cd my-pars-appset origin url
git remote set-url origin git@somewhere:somebody/my-pars-app.gitpush set upstream
git push -u originfollow the instructions in the
Develop a pars applicationsection
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_ROOTenvironment variableinstall my-vcpkg-triplets to
${VCPKG_ROOT}/../my-vcpkg-tripletsby 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/parscopy there the files
portfile.cmakeandvcpkg.jsonfrom the repository https://github.com/grobx/pars-cxx-templateenable the overlay by adding it in the
overlay-portsof thevcpkg-configuration.jsonfile:
"overlay-ports": [
"./ports/pars"
]
Add pars port¶
run
vcpkg add port parsinclude
<pars/pars.h>build the project
Develop a pars application¶
Using CMake¶
change directory to where your project is
run
cmake --list-presetschoose a presets from the list, let’s say
linux-debug-llvmrun
cmake --preset linux-debug-llvmrun
cmake --build out/build/linux-debug-llvm
Using Qt Creator¶
This procesure was tested on Qt Creator 16.0.0:
start
Qt Creatornavigate where the
CMakeLists.txtof your project isopen it
on the configure page, select the LLVM kits
click
Configure Projectbuild the project
Using Visual Studio¶
This procedure was tested on Microsoft Visual Studio Community 2022 (64-bit) version 17.13.6.
start
Visual Studioclick
Open a Local Folderopen the root directory of your project
click
Project > CMake Workspace Settingsturn
enableCmakefromfalsetotruesave
build the project