Skip to content

Commit a48f381

Browse files
Merge pull request #754 from vlad-perevezentsev/build_for_win
Update build_locally.py for Windows support and compilation mode selection
2 parents a7eafae + 4e38ae1 commit a48f381

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

scripts/build_locally.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,23 @@
55

66
def run(
77
use_oneapi=True,
8+
build_type="Release",
89
c_compiler=None,
910
cxx_compiler=None,
1011
level_zero=True,
1112
compiler_root=None,
1213
cmake_executable=None,
1314
use_glog=False,
1415
):
15-
IS_LIN = False
16+
build_system = None
1617

1718
if "linux" in sys.platform:
18-
IS_LIN = True
19+
build_system = "Unix Makefiles"
1920
elif sys.platform in ["win32", "cygwin"]:
20-
pass
21+
build_system = "Ninja"
2122
else:
2223
assert False, sys.platform + " not supported"
2324

24-
if not IS_LIN:
25-
raise RuntimeError(
26-
"This scripts only supports coverage collection on Linux"
27-
)
2825
setup_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
2926
cmake_args = [
3027
sys.executable,
@@ -38,8 +35,8 @@ def run(
3835
cmake_args += [
3936
"--",
4037
"-G",
41-
"Unix Makefiles",
42-
"-DCMAKE_BUILD_TYPE=Debug",
38+
build_system,
39+
"-DCMAKE_BUILD_TYPE=" + build_type,
4340
"-DCMAKE_C_COMPILER:PATH=" + c_compiler,
4441
"-DCMAKE_CXX_COMPILER:PATH=" + cxx_compiler,
4542
"-DDPCTL_ENABLE_LO_PROGRAM_CREATION=" + ("ON" if level_zero else "OFF"),
@@ -72,6 +69,13 @@ def run(
7269
dest="oneapi",
7370
action="store_true",
7471
)
72+
driver.add_argument(
73+
"--debug",
74+
default="Release",
75+
const="Debug",
76+
action="store_const",
77+
help="Set the compilation mode to debugging",
78+
)
7579
driver.add_argument(
7680
"--compiler-root", type=str, help="Path to compiler home directory"
7781
)
@@ -94,7 +98,7 @@ def run(
9498

9599
if args.oneapi:
96100
args.c_compiler = "icx"
97-
args.cxx_compiler = "icpx"
101+
args.cxx_compiler = "icpx" if "linux" in sys.platform else "icx"
98102
args.compiler_root = None
99103
else:
100104
args_to_validate = [
@@ -115,6 +119,7 @@ def run(
115119

116120
run(
117121
use_oneapi=args.oneapi,
122+
build_type=args.debug,
118123
c_compiler=args.c_compiler,
119124
cxx_compiler=args.cxx_compiler,
120125
level_zero=args.level_zero,

0 commit comments

Comments
 (0)