Skip to content

Commit 081f3aa

Browse files
committed
new wheel build with multi config
1 parent 2eb46cf commit 081f3aa

File tree

1 file changed

+13
-25
lines changed

1 file changed

+13
-25
lines changed

hatch_build.py

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ def is_windows():
2828
return platform.system() == "Windows"
2929

3030

31+
def is_macos():
32+
return platform.system() == "Darwin"
33+
34+
3135
def sync():
3236
sys.stdout.flush()
3337
sys.stderr.flush()
@@ -111,42 +115,26 @@ def initialize(self, version, build_data):
111115
pprint(build_data)
112116
pprint(self.build_config.__dict__)
113117

114-
# disable march=native optimizations (including SSE3)
115-
if is_cibuildwheel():
116-
comp_spec_cmake = self.ogdf_src_dir / "cmake" / "compiler-specifics.cmake"
117-
with open(comp_spec_cmake, "rt") as f:
118-
lines = f.readlines()
119-
with open(comp_spec_cmake, "wt") as f:
120-
f.writelines("# " + l if "march=native" in l and not l.strip().startswith("#") else l for l in lines)
121-
122-
CONFIG = "Debug"
123118
flags = [
124-
"-DCMAKE_BUILD_TYPE=" + CONFIG, "-DBUILD_SHARED_LIBS=ON",
119+
"-DCMAKE_CONFIGURATION_TYPES=Debug;Release",
120+
"-DCMAKE_CROSS_CONFIGS=all", "-DCMAKE_DEFAULT_CONFIGS=all",
121+
"-DBUILD_SHARED_LIBS=ON",
125122
"-DCMAKE_INSTALL_PREFIX=%s" % self.cmake_install_dir,
126123
"-DOGDF_WARNING_ERRORS=OFF",
127124
"-DCMAKE_BUILD_RPATH=$ORIGIN;@loader_path", "-DCMAKE_INSTALL_RPATH=$ORIGIN;@loader_path",
128125
"-DMACOSX_RPATH=TRUE",
126+
"-DOGDF_USE_ASSERT_EXCEPTIONS=ON", # "-DOGDF_USE_ASSERT_EXCEPTIONS_WITH=ON_LIBUNWIND",
127+
"-DOGDF_MEMORY_MANAGER=POOL_TS", # "-DOGDF_MEMORY_MANAGER=MALLOC_TS", "-DOGDF_LEAK_CHECK=ON",
129128
]
130-
if CONFIG == "Debug" and not is_windows():
131-
flags.extend([
132-
"-DOGDF_USE_ASSERT_EXCEPTIONS=ON", # "-DOGDF_USE_ASSERT_EXCEPTIONS_WITH=ON_LIBUNWIND",
133-
])
134-
flags.extend([
135-
"-DOGDF_MEMORY_MANAGER=POOL_TS",
136-
# "-DOGDF_MEMORY_MANAGER=MALLOC_TS", "-DOGDF_LEAK_CHECK=ON",
137-
])
129+
if not is_windows() and not is_macos(): # XCode and VS are multi-config by default
130+
flags.append("-G Ninja Multi-Config")
138131
self.run("cmake", self.ogdf_src_dir, *flags)
139132

140133
# import IPython
141134
# IPython.embed()
142135

143-
# windows needs config repeated but no parallel
144-
build_opts = []
145-
if not is_windows():
146-
build_opts = ["--parallel", str(multiprocessing.cpu_count())]
147-
self.run("cmake", "--build", ".", "--config", CONFIG, *build_opts)
148-
149-
self.run("cmake", "--install", ".", "--config", CONFIG)
136+
self.run("cmake", "--build", ".")
137+
self.run("cmake", "--install", ".")
150138

151139
self.dump_files(self.directory)
152140
self.dump_files(self.root)

0 commit comments

Comments
 (0)