diff --git a/.github/workflows/python.yaml b/.github/workflows/python.yaml new file mode 100644 index 0000000..9692968 --- /dev/null +++ b/.github/workflows/python.yaml @@ -0,0 +1,59 @@ +name: COBS Python + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + linux_build: + name: Build and test with Python ${{ matrix.python-version }} (Linux) + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + fail-fast: false + steps: + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Check out code for the build + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Build and test + run: | + pip install . + python -m unittest discover python/tests + + mac_build_clang: + name: Build and test with Python ${{ matrix.python-version }} (macOS) + runs-on: macos-13 + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + fail-fast: false + steps: + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + brew install boost-python3 + + - name: Check out code for the build + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Build and test + run: | + pip install . + python -m unittest discover python/tests \ No newline at end of file diff --git a/.gitignore b/.gitignore index b83277b..5eadb2a 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,7 @@ __pycache__ cobs*.tar cobs*.tar.gz !tests/data/non_acgt_test/index.cobs_classic +.devcontainer/ +cobs_index.egg-info +*.so +*.bin \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index 2934b4d..2fc03fd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -12,4 +12,5 @@ url = https://github.com/Cyan4973/xxHash.git [submodule "python/pybind11"] path = python/pybind11 - url = https://github.com/pybind/pybind11.git + url = ../../pybind/pybind11 + branch = stable diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a10d0e..5f74b29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,8 +65,13 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") if(NOOPENMP) message(WARNING "COMPILING WITHOUT OPENMP!") else() - set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp") + find_package(OpenMP) + if(OpenMP_CXX_FOUND) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") + else() + message(WARNING "OpenMP not found!") + endif() endif() # with run-time STL checks diff --git a/README.md b/README.md index cb5d6fd..723cecb 100644 --- a/README.md +++ b/README.md @@ -48,13 +48,13 @@ COBS requires CMake, a C++17 compiler or the Boost.Filesystem library. To download and install COBS run: ``` -git clone --recursive https://github.com/bingmann/cobs.git +git clone --recursive https://github.com/iqbal-lab-org/cobs.git mkdir cobs/build cd cobs/build cmake -DCMAKE_BUILD_TYPE=Release .. make -j4 ``` -and optionally run `make test` to check the build. +and optionally run `make test` to check the build. Note that to download submodules, `--recursive` has to be provided. ## OS X compilation diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b7b3aea --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,5 @@ +[build-system] +requires = ["setuptools==69.5.1", + "cmake==3.29.2", +] +build-backend = "setuptools.build_meta" \ No newline at end of file diff --git a/python/pybind11 b/python/pybind11 index 80d4524..01ab935 160000 --- a/python/pybind11 +++ b/python/pybind11 @@ -1 +1 @@ -Subproject commit 80d452484c5409444b0ec19383faa84bb7a4d351 +Subproject commit 01ab935612a6800c4ad42957808d6cbd30047902 diff --git a/setup.py b/setup.py index a4041fa..5d33463 100644 --- a/setup.py +++ b/setup.py @@ -47,7 +47,7 @@ def build_extension(self, ext): build_args += ['--', '/m'] else: cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg] - build_args += ['--', '-j2'] + build_args += ['--'] env = os.environ.copy() env['CXXFLAGS'] = '{} -DVERSION_INFO=\\"{}\\"'.format(