diff --git a/setup.py b/setup.py index 71f04d02f84b726c563ed6b0f913cfca557483b8..e88e10ef56e55614199e50c7a33cd0cfe5ecbbc0 100644 --- a/setup.py +++ b/setup.py @@ -20,6 +20,7 @@ will not be automatically installed: Some envvars are available to configure the cmake build: - AIDGE_BUILD_MODE=Debug|Release to configure the build type, defaults to Debug. - AIDGE_BUILD_GEN=<build_backend>, passed as -G<build_backend>, defaults to cmake default. +- AIDGE_TEST=OFF|ON to build tests, defaults to OFF. For instance to use ninja backend on linux, use AIDGE_BUILD_GEN=Ninja. In this case install ninja first with: pip install ninja. @@ -113,10 +114,11 @@ class CMakeBuild(build_ext): cmake_type_opts = ['-G', build_gen] if build_gen else [] cmake_job_opts = ['-j', max_jobs] if build_gen != "Ninja" else [] compile_type = os.environ.get("AIDGE_BUILD_MODE", "Debug") + compile_test = os.environ.get("AIDGE_TEST", "OFF") install_path = os.path.join(sys.prefix, "lib", "libAidge") if "AIDGE_INSTALL" not in os.environ else os.environ["AIDGE_INSTALL"] os.chdir(str(build_temp)) - self.spawn(['cmake', *cmake_type_opts, str(cwd), param_py, '-DTEST=OFF', f'-DCMAKE_INSTALL_PREFIX:PATH={install_path}', f'-DCMAKE_BUILD_TYPE={compile_type}']) + self.spawn(['cmake', *cmake_type_opts, str(cwd), param_py, f'-DTEST={compile_test}', f'-DCMAKE_INSTALL_PREFIX:PATH={install_path}', f'-DCMAKE_BUILD_TYPE={compile_type}']) if not self.dry_run: self.spawn(['cmake', '--build', '.', '--config', compile_type, *cmake_job_opts]) self.spawn(['cmake', '--install', '.', '--config', compile_type])