Skip to content

Commit

Permalink
Use build directory instead of _build. (#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas authored Dec 12, 2023
1 parent 99f4271 commit f205f11
Show file tree
Hide file tree
Showing 14 changed files with 89 additions and 89 deletions.
36 changes: 18 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
name: Clone and build liboqs (<< parameters.CMAKE_ARGS >>)
command: |
git clone --depth 1 --branch main https://github.com/open-quantum-safe/liboqs.git &&
cd liboqs && mkdir _build && cd _build &&
cd liboqs && mkdir build && cd build &&
cmake -GNinja << parameters.CMAKE_ARGS >> -DCMAKE_INSTALL_PREFIX=$(pwd)/../../.local .. && ninja install &&
cd .. && cd .. && pwd
- when:
Expand All @@ -61,9 +61,9 @@ jobs:
if << parameters.OQS_PROVIDER_BUILD_STATIC >> ; then
oqsprovider_cmake_args="${oqsprovider_cmake_args} -DOQS_PROVIDER_BUILD_STATIC=ON"
fi
mkdir _build && cd _build && cmake -GNinja ${oqsprovider_cmake_args} -DUSE_ENCODING_LIB=ON -DOPENSSL_ROOT_DIR=$(pwd)/../.local -DCMAKE_PREFIX_PATH=$(pwd)/../.local .. && ninja && cd ..
mkdir build && cd build && cmake -GNinja ${oqsprovider_cmake_args} -DUSE_ENCODING_LIB=ON -DOPENSSL_ROOT_DIR=$(pwd)/../.local -DCMAKE_PREFIX_PATH=$(pwd)/../.local .. && ninja && cd ..
if << parameters.OQS_PROVIDER_BUILD_STATIC >> ; then
file _build/lib/oqsprovider.a
file build/lib/oqsprovider.a
fi
- when:
condition:
Expand All @@ -76,15 +76,15 @@ jobs:
if << parameters.OQS_PROVIDER_BUILD_STATIC >> ; then
oqsprovider_cmake_args="${oqsprovider_cmake_args} -DOQS_PROVIDER_BUILD_STATIC=ON"
fi
mkdir _build && cd _build && cmake -GNinja ${oqsprovider_cmake_args} -DUSE_ENCODING_LIB=ON -DCMAKE_PREFIX_PATH=$(pwd)/../.local .. && ninja && cd ..
mkdir build && cd build && cmake -GNinja ${oqsprovider_cmake_args} -DUSE_ENCODING_LIB=ON -DCMAKE_PREFIX_PATH=$(pwd)/../.local .. && ninja && cd ..
if << parameters.OQS_PROVIDER_BUILD_STATIC >> ; then
file _build/lib/oqsprovider.a
file build/lib/oqsprovider.a
fi
- run:
name: Run tests
command: |
if << parameters.OQS_PROVIDER_BUILD_STATIC >> ; then
ctest --test-dir _build/
ctest --test-dir build/
else
./scripts/runtests.sh -V
fi
Expand All @@ -107,15 +107,15 @@ jobs:
if << parameters.OQS_PROVIDER_BUILD_STATIC >> ; then
oqsprovider_cmake_args="${oqsprovider_cmake_args} -DOQS_PROVIDER_BUILD_STATIC=ON"
fi
rm -rf _build && mkdir _build && cd _build && cmake -GNinja ${oqsprovider_cmake_args} -DNOPUBKEY_IN_PRIVKEY=ON -DUSE_ENCODING_LIB=ON -DOPENSSL_ROOT_DIR=$(pwd)/../.local -DCMAKE_PREFIX_PATH=$(pwd)/../.local .. && ninja
rm -rf build && mkdir build && cd build && cmake -GNinja ${oqsprovider_cmake_args} -DNOPUBKEY_IN_PRIVKEY=ON -DUSE_ENCODING_LIB=ON -DOPENSSL_ROOT_DIR=$(pwd)/../.local -DCMAKE_PREFIX_PATH=$(pwd)/../.local .. && ninja
if << parameters.OQS_PROVIDER_BUILD_STATIC >> ; then
file _build/lib/oqsprovider.a
file build/lib/oqsprovider.a
fi
- run:
name: Run tests (-DNOPUBKEY_IN_PRIVKEY=ON)
command: |
if << parameters.OQS_PROVIDER_BUILD_STATIC >> ; then
ctest --test-dir _build/
ctest --test-dir build/
else
./scripts/runtests.sh -V
fi
Expand Down Expand Up @@ -159,7 +159,7 @@ jobs:
name: Clone and build liboqs
command: |
git clone --depth 1 --branch main https://github.com/open-quantum-safe/liboqs.git &&
export LIBOQS_INSTALLPATH=$(pwd)/.local && cd liboqs && mkdir _build && cd _build &&
export LIBOQS_INSTALLPATH=$(pwd)/.local && cd liboqs && mkdir build && cd build &&
export OPENSSL_INSTALL="$(brew --prefix << parameters.OPENSSL_PREINSTALL >> || echo "")"
cmake -GNinja -DOPENSSL_ROOT_DIR="${OPENSSL_INSTALL}" -DCMAKE_INSTALL_PREFIX=$LIBOQS_INSTALLPATH << parameters.CMAKE_ARGS >> .. && ninja install &&
cd .. && cd .. && echo "export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$LIBOQS_INSTALLPATH/lib" >> "$BASH_ENV"
Expand All @@ -180,9 +180,9 @@ jobs:
if << parameters.OQS_PROVIDER_BUILD_STATIC >> ; then
oqsprovider_cmake_args="${oqsprovider_cmake_args} -DOQS_PROVIDER_BUILD_STATIC=ON"
fi
export OPENSSL_INSTALL=$(pwd)/.local && mkdir _build && cd _build && cmake -GNinja -DOPENSSL_ROOT_DIR=$OPENSSL_INSTALL -DCMAKE_PREFIX_PATH=$(pwd)/../.local ${oqsprovider_cmake_args} .. && ninja && echo "export OPENSSL_INSTALL=$OPENSSL_INSTALL" >> "$BASH_ENV"
export OPENSSL_INSTALL=$(pwd)/.local && mkdir build && cd build && cmake -GNinja -DOPENSSL_ROOT_DIR=$OPENSSL_INSTALL -DCMAKE_PREFIX_PATH=$(pwd)/../.local ${oqsprovider_cmake_args} .. && ninja && echo "export OPENSSL_INSTALL=$OPENSSL_INSTALL" >> "$BASH_ENV"
if << parameters.OQS_PROVIDER_BUILD_STATIC >> ; then
file _build/lib/oqsprovider.a
file build/lib/oqsprovider.a
fi
- when:
condition:
Expand All @@ -196,15 +196,15 @@ jobs:
oqsprovider_cmake_args="${oqsprovider_cmake_args} -DOQS_PROVIDER_BUILD_STATIC=ON"
fi
export OPENSSL_INSTALL="$(brew --prefix << parameters.OPENSSL_PREINSTALL >>)"
mkdir _build && cd _build && liboqs_DIR=`pwd`/../.local cmake -GNinja -DOPENSSL_ROOT_DIR="${OPENSSL_INSTALL}" ${oqsprovider_cmake_args} .. && ninja && echo "export OPENSSL_INSTALL=$OPENSSL_INSTALL" >> "$BASH_ENV" && cd .. && echo "export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$OPENSSL_INSTALL/lib" >> "$BASH_ENV"
mkdir build && cd build && liboqs_DIR=`pwd`/../.local cmake -GNinja -DOPENSSL_ROOT_DIR="${OPENSSL_INSTALL}" ${oqsprovider_cmake_args} .. && ninja && echo "export OPENSSL_INSTALL=$OPENSSL_INSTALL" >> "$BASH_ENV" && cd .. && echo "export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$OPENSSL_INSTALL/lib" >> "$BASH_ENV"
if << parameters.OQS_PROVIDER_BUILD_STATIC >> ; then
file _build/lib/oqsprovider.a
file build/lib/oqsprovider.a
fi
- run:
name: Run tests
command: |
if << parameters.OQS_PROVIDER_BUILD_STATIC >> ; then
ctest --test-dir _build/ --output-on-failure
ctest --test-dir build/ --output-on-failure
else
./scripts/runtests.sh -V
fi
Expand All @@ -215,15 +215,15 @@ jobs:
if << parameters.OQS_PROVIDER_BUILD_STATIC >> ; then
oqsprovider_cmake_args="${oqsprovider_cmake_args} -DOQS_PROVIDER_BUILD_STATIC=ON"
fi
rm -rf _build && mkdir _build && cd _build && cmake -GNinja -DUSE_ENCODING_LIB=ON -DOPENSSL_ROOT_DIR=$OPENSSL_INSTALL -DCMAKE_PREFIX_PATH=$(pwd)/../.local ${oqsprovider_cmake_args} .. && ninja
rm -rf build && mkdir build && cd build && cmake -GNinja -DUSE_ENCODING_LIB=ON -DOPENSSL_ROOT_DIR=$OPENSSL_INSTALL -DCMAKE_PREFIX_PATH=$(pwd)/../.local ${oqsprovider_cmake_args} .. && ninja
if << parameters.OQS_PROVIDER_BUILD_STATIC >> ; then
file _build/lib/oqsprovider.a
file build/lib/oqsprovider.a
fi
- run:
name: Run tests
command: |
if << parameters.OQS_PROVIDER_BUILD_STATIC >> ; then
ctest --test-dir _build/ --output-on-failure
ctest --test-dir build/ --output-on-failure
else
./scripts/runtests.sh -V
fi
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Full build
run: OQSPROV_CMAKE_PARAMS=${{ matrix.cmake-params}} ./scripts/fullbuild.sh
- name: Enable sibling oqsprovider for testing
run: cd _build/lib && ln -s oqsprovider.so oqsprovider2.so
run: cd build/lib && ln -s oqsprovider.so oqsprovider2.so
- name: Test
run: ./scripts/runtests.sh -V

Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Full build
run: OPENSSL_BRANCH=${{ matrix.ossl-branch }} ./scripts/fullbuild.sh
- name: Enable sibling oqsprovider for testing
run: cd _build/lib && ln -s oqsprovider.so oqsprovider2.so
run: cd build/lib && ln -s oqsprovider.so oqsprovider2.so
- name: Test
run: ./scripts/runtests.sh -V
- name: Verify nothing changes on re-generate code
Expand All @@ -68,12 +68,12 @@ jobs:
! git status | grep modified
- name: Build .deb install package
run: cpack
working-directory: _build
working-directory: build
- name: Retain .deb installer
uses: actions/upload-artifact@v3
with:
name: oqsprovider-x64
path: _build/*.deb
path: build/*.deb

asan_linux_intel:
name: "Security checks"
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ jobs:
key: ${{ runner.os }}-openssl32
- name: build liboqs
run: |
cmake -DOPENSSL_ROOT_DIR=../.localopenssl32 -DCMAKE_INSTALL_PREFIX=../.localliboqs ${{ matrix.params.oqsconfig }} -S . -B _build
cmake --build _build
cmake --install _build
cmake -DOPENSSL_ROOT_DIR=../.localopenssl32 -DCMAKE_INSTALL_PREFIX=../.localliboqs ${{ matrix.params.oqsconfig }} -S . -B build
cmake --build build
cmake --install build
working-directory: liboqs
- name: build oqs-provider
run: liboqs_DIR=.localliboqs cmake -DOPENSSL_ROOT_DIR=.localopenssl32 -S . -B _build && cmake --build _build
run: liboqs_DIR=.localliboqs cmake -DOPENSSL_ROOT_DIR=.localopenssl32 -S . -B build && cmake --build build
- name: Check Openssl providers
run: OPENSSL_MODULES=_build/lib .localopenssl32/bin/openssl list -providers -provider oqsprovider -provider default
run: OPENSSL_MODULES=build/lib .localopenssl32/bin/openssl list -providers -provider oqsprovider -provider default
- name: Run tests
run: PATH=../.localopenssl32/bin:$PATH ctest -V
working-directory: _build
working-directory: build
# Try brew install of head: If error message below appears, build and test passed successfully
- name: brew install test
run: brew install --HEAD --formula -s oqsprovider.rb 2>&1 | grep "Empty installation"
Expand All @@ -76,4 +76,4 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: oqs-provider-${{matrix.os}}-x64
path: _build/lib/oqsprovider.dylib
path: build/lib/oqsprovider.dylib
6 changes: 3 additions & 3 deletions .github/workflows/standalone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches: [ '*' ]
pull_request:
branches: [ "main" ]

jobs:

macos_intel:
Expand All @@ -18,9 +18,9 @@ jobs:
- name: Checkout oqsprovider code
uses: actions/checkout@v2
- name: Build oqsprovider
run: cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl@3 -S . -B _build && cmake --build _build
run: cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl@3 -S . -B build && cmake --build build
- name: Test oqsprovider
run: ctest --parallel 5 --test-dir _build
run: ctest --parallel 5 --test-dir build

linux_intel:
runs-on: ubuntu-latest
Expand Down
46 changes: 23 additions & 23 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ jobs:
which cmake
cmake --version
gcc --version
mkdir _build
cd _build
mkdir build
cd build
cmake -GNinja -DOPENSSL_ROOT_DIR=/opt/openssl32 -DCMAKE_INSTALL_PREFIX="${{ env.IP }}" ${{ matrix.platform.oqsconfig }} -DCMAKE_C_COMPILER=gcc ..
ninja
ninja install
Expand All @@ -79,17 +79,17 @@ jobs:
c:\cygwin\opt\openssl32
key: ${{ runner.os }}-cygwinopenssl32
- name: build oqs-provider
run: bash -c "git config --global --add safe.directory $(cygpath -u $PWD) && liboqs_DIR='${{ env.IP }}' cmake -GNinja -DCMAKE_C_COMPILER=gcc -DOPENSSL_ROOT_DIR=/opt/openssl32 -S . -B _build && cd _build && ninja && cd .."
run: bash -c "git config --global --add safe.directory $(cygpath -u $PWD) && liboqs_DIR='${{ env.IP }}' cmake -GNinja -DCMAKE_C_COMPILER=gcc -DOPENSSL_ROOT_DIR=/opt/openssl32 -S . -B build && cd build && ninja && cd .."
- name: Check Openssl providers
run: bash -c "OPENSSL_MODULES=_build/lib /opt/openssl32/bin/openssl list -providers -provider oqsprovider -provider default"
run: bash -c "OPENSSL_MODULES=build/lib /opt/openssl32/bin/openssl list -providers -provider oqsprovider -provider default"
- name: Run tests
run: bash -c "echo $PATH && PATH=/opt/openssl32/bin:/usr/bin ctest -V"
working-directory: _build
working-directory: build
- name: Retain oqsprovider.dll
uses: actions/upload-artifact@v3
with:
name: oqs-provider-cygwin
path: D:/a/oqs-provider/oqs-provider/_build/bin/oqsprovider.dll
path: D:/a/oqs-provider/oqs-provider/build/bin/oqsprovider.dll

msvc:
# Run a job for each of the specified target architectures:
Expand Down Expand Up @@ -139,10 +139,10 @@ jobs:
if: steps.cache-openssl32.outputs.cache-hit != 'true'
# OQS_USE_OPENSSL=OFF by default on Win32
# if cmake --build fails, try explicit
# cd _build && msbuild ALL_BUILD.vcxproj -p:Configuration=Release
# fails: cmake -DCMAKE_C_FLAGS="/wd5105" -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_PREFIX="c:\liboqs" ${{ matrix.platform.oqsconfig }} -S . -B _build
# cd _build && msbuild ALL_BUILD.vcxproj -p:Configuration=Release && cd ..
# cmake --install _build
# cd build && msbuild ALL_BUILD.vcxproj -p:Configuration=Release
# fails: cmake -DCMAKE_C_FLAGS="/wd5105" -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_PREFIX="c:\liboqs" ${{ matrix.platform.oqsconfig }} -S . -B build
# cd build && msbuild ALL_BUILD.vcxproj -p:Configuration=Release && cd ..
# cmake --install build
- name: build liboqs
run: |
cmake --version
Expand All @@ -154,7 +154,7 @@ jobs:
working-directory: liboqs
- name: prepare the OpenSSL build directory
if: steps.cache-openssl32.outputs.cache-hit != 'true'
run: mkdir _build
run: mkdir build
working-directory: openssl
- name: OpenSSL config
if: steps.cache-openssl32.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -187,17 +187,17 @@ jobs:
key: ${{ runner.os }}-msvcopenssl32
- name: build oqs-provider
run: |
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="/wd5105" -DOPENSSL_ROOT_DIR="c:\openssl32" -Dliboqs_DIR="c:\liboqs\lib\cmake\liboqs" -S . -B _build
cd _build
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="/wd5105" -DOPENSSL_ROOT_DIR="c:\openssl32" -Dliboqs_DIR="c:\liboqs\lib\cmake\liboqs" -S . -B build
cd build
ninja
- name: Run tests
run: |
ctest -V --test-dir _build
ctest -V --test-dir build
- name: Retain oqsprovider.dll
uses: actions/upload-artifact@v3
with:
name: oqs-provider-msvc
path: D:/a/oqs-provider/oqs-provider/_build/lib/oqsprovider.dll
path: D:/a/oqs-provider/oqs-provider/build/lib/oqsprovider.dll

msvc_native:
# Run a job for each of the specified target architectures:
Expand All @@ -210,7 +210,7 @@ jobs:
- arch: win64
oqsconfig: -DOQS_ALGS_ENABLED=STD
osslconfig: no-shared no-fips VC-WIN64A
toolchain:
toolchain:
- .CMake/toolchain_windows_amd64.cmake
msarch:
- x64
Expand Down Expand Up @@ -258,12 +258,12 @@ jobs:
run: |
cmake --version
cmake -B build --toolchain ${{ matrix.toolchain }} .
cmake --build build
cmake --build build
cmake --build build --target INSTALL
working-directory: liboqs
- name: prepare the OpenSSL build directory
if: steps.cache-openssl32n.outputs.cache-hit != 'true'
run: mkdir _build
run: mkdir build
working-directory: openssl
- name: OpenSSL config
if: steps.cache-openssl32n.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -292,14 +292,14 @@ jobs:
key: ${{ runner.os }}-msvcopenssl32n
- name: build oqs-provider
run: |
cmake -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DCMAKE_C_FLAGS="/wd5105" -DOPENSSL_ROOT_DIR="c:\openssl32n" -Dliboqs_DIR="c:\liboqs\lib\cmake\liboqs" -S . -B _build
cmake --build _build --config=${{ matrix.type }}
cmake -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DCMAKE_C_FLAGS="/wd5105" -DOPENSSL_ROOT_DIR="c:\openssl32n" -Dliboqs_DIR="c:\liboqs\lib\cmake\liboqs" -S . -B build
cmake --build build --config=${{ matrix.type }}
- name: Run tests
run: |
ctest --test-dir _build -C ${{ matrix.type }}
ctest --test-dir build -C ${{ matrix.type }}
- name: Retain oqsprovider.dll
uses: actions/upload-artifact@v3
with:
name: oqs-provider-msvc
path: D:/a/oqs-provider/oqs-provider/_build/lib/oqsprovider.dll
path: D:/a/oqs-provider/oqs-provider/build/lib/oqsprovider.dll

4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# checked out OSSL variants
openssl*/*
openssl*/*
openssl
# checked out liboqs
liboqs
# installed SW
.local
# build directory
_build
build
# generated from openssl src:
test/ssltestlib.c
test/ssltestlib.h
Expand Down
2 changes: 1 addition & 1 deletion ALGORITHMS.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ can be used to successfully confirm interoperability between the oqs-provider
and the Cloudflare infrastructure using this hybrid classic/quantum-safe algorithm:

```
OQS_CODEPOINT_X25519_KYBER512=65072 ./openssl/apps/openssl s_client -groups x25519_kyber512 -connect cloudflare.com:443 -provider-path _build/oqsprov -provider oqsprovider -provider default
OQS_CODEPOINT_X25519_KYBER512=65072 ./openssl/apps/openssl s_client -groups x25519_kyber512 -connect cloudflare.com:443 -provider-path build/oqsprov -provider oqsprovider -provider default
```

# OIDs
Expand Down
14 changes: 7 additions & 7 deletions NOTES-UNIX.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,30 @@ to be present to be build, e.g., via `apt install cmake build-essential git`.
## Build

Standard `cmake` build sequence can be used (assuming prerequisites are installed)
to build in/install from directory `_build`:
to build in/install from directory `build`:

cmake -S . -B _build && cmake --build _build && cmake --install _build
cmake -S . -B build && cmake --build build && cmake --install build

If `openssl` and/or `liboqs` have not been installed to system standard locations
use the `cmake` define "-DOPENSSL_ROOT_DIR" and/or the environment variable
use the `cmake` define "-DOPENSSL_ROOT_DIR" and/or the environment variable
"liboqs_DIR" to utilize those, e.g., like this:

liboqs_DIR=../liboqs cmake -DOPENSSL_ROOT_DIR=/opt/openssl3 -S . -B _build && cmake --build _build && cmake --install _build
liboqs_DIR=../liboqs cmake -DOPENSSL_ROOT_DIR=/opt/openssl3 -S . -B build && cmake --build build && cmake --install build

Further configuration options are documented [here](CONFIGURE.md#build-install-options).

## Test

Standard `ctest` can be used to validate correct operation in build directory `_build`, e.g.:
Standard `ctest` can be used to validate correct operation in build directory `build`, e.g.:

cd _build && ctest --parallel 5 --rerun-failed --output-on-failure -V
cd build && ctest --parallel 5 --rerun-failed --output-on-failure -V

## Packaging

### Debian

A build target to create UNIX .deb packaging is available via the standard
`package` target, e.g., executing `make package` in the `_build` subdirectory.
`package` target, e.g., executing `make package` in the `build` subdirectory.
The resultant file can be installed as usual via `dpkg -i ...`.

### MacOS
Expand Down
Loading

0 comments on commit f205f11

Please sign in to comment.