diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c53c345e..23134c5d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,7 +3,7 @@ name: Test on: push: branches: - - develop + - add_conan_profiles pull_request: jobs: @@ -43,7 +43,9 @@ jobs: - name: Configure and build run: | conan profile detect - conan build . -s:h compiler.cppstd=20 -s:h libqasm/*:build_type=${{ matrix.build_type }} -o libqasm/*:build_tests=True -o libqasm/*:compat=True -o libqasm/*:asan_enabled=True -b missing + build_type=${{ matrix.build_type }} + build_type=${build_type@L} + conan build . -pr=conan/profiles/tests-${build_type}-compat -b missing - name: Test working-directory: build/${{ matrix.build_type }} run: ctest -C ${{ matrix.build_type }} --output-on-failure @@ -87,7 +89,7 @@ jobs: python3 -m venv venv source venv/bin/activate python3 -m pip install --upgrade pip conan - conan build . -s:h compiler.cppstd=20 -s:h libqasm/*:build_type=Release -o libqasm/*:build_tests=True -o libqasm/*:compat=True -o libqasm/*:asan_enabled=True -b missing + conan build . -pr=conan/profiles/tests-release-compat -b missing - name: Test working-directory: build/Release run: ctest -C Release --output-on-failure diff --git a/README.md b/README.md index 6cc1e8a1..5a1ff845 100644 --- a/README.md +++ b/README.md @@ -57,14 +57,43 @@ conan profile detect ``` The installation of `libqasm` dependencies, as well as the compilation, can be done in one go.
-Notice the command below is building `libqasm` in Debug mode with tests. ``` git clone https://github.com/QuTech-Delft/libqasm.git cd libqasm -conan build . -s:h compiler.cppstd=20 -s:h libqasm/*:build_type=Debug -o libqasm/*:build_tests=True -b missing +conan build . -pr=conan/profiles/tests-debug -b missing ``` +### Build profiles + +The command above is building `libqasm` in debug mode with tests using the `debug-tests` profile. + +libqasm provides a set of predefined profiles under the `conan/profiles` folder. + +All these files follow the `{tests,}-{debug,release}-{compat,}` naming convention. For example: + - `release` sets `build_tests=False`, `build_type=Release` and `libqasm_compat=False`, and + - `test-debug-compat` sets `build_tests=True`, `build_type=Debug` and `libqasm_compat=True`. + +All the profiles set `compiler.cppstd=20`. + +All the `tests` profiles set `asan_enabled=True`. + +### Build options + +Profiles are a shorthand for command line options. The command above could be written as well as: + +``` +conan build . -s:h compiler.cppstd=20 -s:h libqasm/*:build_type=Debug -o libqasm/*:asan_enabled=True -o libqasm/*:build_tests=True -o libqasm/*:compat=False -b missing +``` + +These are the list of options that could be specified whether in a profile or in the command line: + +- `libqasm/*:build_tests={True,False}`: build tests or not. +- `libqasm/*:build_type={Debug,Release}`: builds in debug or release mode. +- `libqasm/*:asan_enabled={True,False}`: enables Address Sanitizer. +- `libqasm/*:compat={True,False}`: enables the compatibility layer. +- `libqasm/*:shared={True,False}`: builds libqasm as a shared library. + ## Install ### From Python @@ -72,7 +101,7 @@ conan build . -s:h compiler.cppstd=20 -s:h libqasm/*:build_type=Debug -o libqasm Install from the project root directory as follows: ``` -python -m pip install --verbose . +python3 -m pip install --verbose . ``` or if you'd rather use conda: @@ -85,7 +114,7 @@ conda install libqasm --use-local You can test if it works by running: ``` -python -m pytest +python3 -m pytest ``` ### From C++ diff --git a/conan/profiles/debug b/conan/profiles/debug new file mode 100644 index 00000000..405995d9 --- /dev/null +++ b/conan/profiles/debug @@ -0,0 +1,10 @@ +include(default) + +[settings] +compiler.cppstd=20 +libqasm/*:build_type=Debug + +[options] +libqasm/*:asan_enabled=False +libqasm/*:build_tests=False +libqasm/*:compat=False diff --git a/conan/profiles/debug-compat b/conan/profiles/debug-compat new file mode 100644 index 00000000..e070c6d1 --- /dev/null +++ b/conan/profiles/debug-compat @@ -0,0 +1,10 @@ +include(default) + +[settings] +compiler.cppstd=20 +libqasm/*:build_type=Debug + +[options] +libqasm/*:asan_enabled=False +libqasm/*:build_tests=False +libqasm/*:compat=True diff --git a/conan/profiles/release b/conan/profiles/release new file mode 100644 index 00000000..7842c688 --- /dev/null +++ b/conan/profiles/release @@ -0,0 +1,10 @@ +include(default) + +[settings] +compiler.cppstd=20 +libqasm/*:build_type=Release + +[options] +libqasm/*:asan_enabled=False +libqasm/*:build_tests=False +libqasm/*:compat=False diff --git a/conan/profiles/release-compat b/conan/profiles/release-compat new file mode 100644 index 00000000..696093b8 --- /dev/null +++ b/conan/profiles/release-compat @@ -0,0 +1,10 @@ +include(default) + +[settings] +compiler.cppstd=20 +libqasm/*:build_type=Release + +[options] +libqasm/*:asan_enabled=False +libqasm/*:build_tests=False +libqasm/*:compat=True diff --git a/conan/profiles/tests-debug b/conan/profiles/tests-debug new file mode 100644 index 00000000..6021f64d --- /dev/null +++ b/conan/profiles/tests-debug @@ -0,0 +1,10 @@ +include(default) + +[settings] +compiler.cppstd=20 +libqasm/*:build_type=Debug + +[options] +libqasm/*:asan_enabled=True +libqasm/*:build_tests=True +libqasm/*:compat=False diff --git a/conan/profiles/tests-debug-compat b/conan/profiles/tests-debug-compat new file mode 100644 index 00000000..4a7202d3 --- /dev/null +++ b/conan/profiles/tests-debug-compat @@ -0,0 +1,10 @@ +include(default) + +[settings] +compiler.cppstd=20 +libqasm/*:build_type=Debug + +[options] +libqasm/*:asan_enabled=True +libqasm/*:build_tests=True +libqasm/*:compat=True diff --git a/conan/profiles/tests-release b/conan/profiles/tests-release new file mode 100644 index 00000000..9bfd0fd6 --- /dev/null +++ b/conan/profiles/tests-release @@ -0,0 +1,10 @@ +include(default) + +[settings] +compiler.cppstd=20 +libqasm/*:build_type=Release + +[options] +libqasm/*:asan_enabled=False +libqasm/*:build_tests=True +libqasm/*:compat=False diff --git a/conan/profiles/tests-release-compat b/conan/profiles/tests-release-compat new file mode 100644 index 00000000..0cadc7f4 --- /dev/null +++ b/conan/profiles/tests-release-compat @@ -0,0 +1,10 @@ +include(default) + +[settings] +compiler.cppstd=20 +libqasm/*:build_type=Release + +[options] +libqasm/*:asan_enabled=False +libqasm/*:build_tests=True +libqasm/*:compat=True