Skip to content

Commit 921e5ad

Browse files
authored
provide an alternate way to set liboqs path (#95)
Also check lib64 directory for liboqs Signed-off-by: Vysakh P Pillai <vysakhpillai@gmail.com> Signed-off-by: Vysakh Pillai <vysakhpillai@gmail.com>
1 parent 7a1c2f6 commit 921e5ad

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ an alternative path, e.g., `C:\liboqs`, by passing the
8484
cmake -S liboqs -B liboqs/build -DCMAKE_INSTALL_PREFIX="C:\liboqs" -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=TRUE -DBUILD_SHARED_LIBS=ON
8585
```
8686

87+
Alternatively you can set the `OQS_INSTALL_PATH` environment variable to point to the installation directory, e.g., on a UNIX-like system execute:
88+
89+
```shell
90+
export OQS_INSTALL_PATH=/path/to/liboqs
91+
```
92+
8793
### Let liboqs-python install liboqs automatically
8894

8995
If liboqs is not detected at runtime by liboqs-python, it will be downloaded,

oqs/oqs.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,24 @@ def _install_liboqs(target_directory, oqs_version=None):
108108

109109

110110
def _load_liboqs():
111-
home_dir = os.path.expanduser("~")
112-
oqs_install_dir = os.path.abspath(home_dir + os.path.sep + "_oqs") # $HOME/_oqs
111+
if "OQS_INSTALL_PATH" in os.environ:
112+
oqs_install_dir = os.path.abspath(os.environ["OQS_INSTALL_PATH"])
113+
else:
114+
home_dir = os.path.expanduser("~")
115+
oqs_install_dir = os.path.abspath(home_dir + os.path.sep + "_oqs") # $HOME/_oqs
116+
113117
oqs_lib_dir = (
114118
os.path.abspath(oqs_install_dir + os.path.sep + "bin") # $HOME/_oqs/bin
115119
if platform.system() == "Windows"
116120
else os.path.abspath(oqs_install_dir + os.path.sep + "lib") # $HOME/_oqs/lib
117121
)
122+
oqs_lib64_dir = (
123+
os.path.abspath(oqs_install_dir + os.path.sep + "bin") # $HOME/_oqs/bin
124+
if platform.system() == "Windows"
125+
else os.path.abspath(oqs_install_dir + os.path.sep + "lib64") # $HOME/_oqs/lib64
126+
)
118127
try:
119-
_liboqs = _load_shared_obj(name="oqs", additional_searching_paths=[oqs_lib_dir])
128+
_liboqs = _load_shared_obj(name="oqs", additional_searching_paths=[oqs_lib_dir, oqs_lib64_dir])
120129
assert _liboqs
121130
except RuntimeError:
122131
# We don't have liboqs, so we try to install it automatically

0 commit comments

Comments
 (0)