-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
33 lines (29 loc) · 1.14 KB
/
Copy pathsetup.py
File metadata and controls
33 lines (29 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Copyright 2024 ETH Zurich and University of Bologna.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
#
# Author: Luca Colagrande <colluca@iis.ee.ethz.ch>
import os
import setuptools
from setuptools.command.build import build
import subprocess
from pathlib import Path
class CMakeBuild(build):
def run(self):
# Required to generate "flexfloat_config.h"
builddir = Path(__file__).parent / 'flexfloat/build'
builddir.mkdir(parents=True, exist_ok=True)
subprocess.run(['pwd'], cwd=builddir, check=True)
subprocess.run(['ls', '..'], cwd=builddir, check=True)
# flexfloat's CMakeLists.txt requires CMake < 3.5, unsupported by
# recent CMake. Set via env (not -D) so it also propagates to the
# nested cmake invocation used to fetch googletest.
env = {**os.environ, 'CMAKE_POLICY_VERSION_MINIMUM': '3.5'}
subprocess.run(['cmake', '..'], cwd=builddir, check=True, env=env)
setuptools.setup(
packages=setuptools.find_packages(),
setup_requires=['cffi'],
install_requires=['cffi'],
cffi_modules=["pyflexfloat/build_flexfloat_ffi.py:ffibuilder"],
cmdclass={'build': CMakeBuild}
)