google-research
63 строки · 1.7 Кб
1# coding=utf-8
2# Copyright 2024 The Google Research Authors.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16# pylint: skip-file
17from setuptools import setup18from distutils.command.build import build19from setuptools.command.install import install20
21from setuptools.command.develop import develop22from torch.utils.cpp_extension import CppExtension, BuildExtension, CUDAExtension23
24import os25import subprocess26BASEPATH = os.path.dirname(os.path.abspath(__file__))27
28extlib_path = 'lego/ext_ops'29compile_args = ['-Wno-deprecated-declarations']30link_args = []31ext_modules = []32
33class custom_develop(develop):34def run(self):35original_cwd = os.getcwd()36
37# build custom ops38folders = [39os.path.join(BASEPATH, 'lego/cpp_sampler'),40]41for folder in folders:42os.chdir(folder)43subprocess.check_call(['make'])44
45os.chdir(original_cwd)46
47super().run()48
49
50setup(name='lego',51py_modules=['lego'],52ext_modules=ext_modules,53install_requires=[54'torch>=1.7.0',55'scikit-learn',56'tensorboardX',57'gym'58],59cmdclass={60'build_ext': BuildExtension,61'develop': custom_develop,62}63)
64