Skip to content

Commit

Permalink
Make: Trace used compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
ashvardanian committed Nov 13, 2023
1 parent 8a77b3e commit 7d17eab
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jobs:
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 16
cmake -B build_artifacts -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUSEARCH_BUILD_TEST_CPP=1 -DUSEARCH_BUILD_TEST_C=1 -DUSEARCH_BUILD_LIB_C=1 -DDUSEARCH_USE_OPENMP=0 -DUSEARCH_USE_SIMSIMD=1 -DUSEARCH_USE_JEMALLOC=1
cmake -B build_artifacts -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUSEARCH_BUILD_TEST_CPP=1 -DUSEARCH_BUILD_TEST_C=1 -DUSEARCH_BUILD_LIB_C=1 -DUSEARCH_USE_OPENMP=0 -DUSEARCH_USE_SIMSIMD=1 -DUSEARCH_USE_JEMALLOC=1
cmake --build build_artifacts --config RelWithDebInfo
- name: Test C++
run: ./build_artifacts/test_cpp
Expand Down
17 changes: 15 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import sys
import platform
import subprocess
from setuptools import setup

from pybind11.setup_helpers import Pybind11Extension
Expand All @@ -19,11 +19,24 @@ def get_bool_env_w_name(name: str, preference: bool) -> tuple:


# Check the environment variables
is_gcc = "GCC" in platform.python_compiler().upper()
is_linux: bool = sys.platform == "linux"
is_macos: bool = sys.platform == "darwin"
is_windows: bool = sys.platform == "win32"


is_gcc = False
if is_linux:
cxx = os.environ.get("CXX")
if cxx:
try:
command = "where" if os.name == "nt" else "which"
full_path = subprocess.check_output([command, cxx], text=True).strip()
compiler_name = os.path.basename(full_path)
is_gcc = ("g++" in compiler_name) and ("clang++" not in compiler_name)
except subprocess.CalledProcessError:
pass


prefer_simsimd: bool = is_linux or is_macos
prefer_fp16lib: bool = True
prefer_openmp: bool = is_linux and is_gcc
Expand Down

0 comments on commit 7d17eab

Please sign in to comment.