Skip to content
Snippets Groups Projects
Commit 1422bcae authored by Christophe Guillon's avatar Christophe Guillon
Browse files

[Setup] Add env var for tests

Add AIDGE_TEST=OFF|ON env vars to cmake configuration.
Defaults to OFF, use AIDGE_TEST=ON to configure build of tests
in development mode.
parent 733b9b23
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !154. Comments created here will be created in the context of that merge request.
......@@ -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])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment