mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 20:18:18 +00:00
Add check for libatomic requirement to Python build system (#7184)
* Add check for libatomic requirement to Python build system * More thorough check * Fix typos
This commit is contained in:
parent
648e05754c
commit
80642e5a7c
|
@ -314,6 +314,26 @@ def test_fpmath(cc):
|
||||||
FPMATH_FLAGS=""
|
FPMATH_FLAGS=""
|
||||||
return "UNKNOWN"
|
return "UNKNOWN"
|
||||||
|
|
||||||
|
def test_atomic_required(cc):
|
||||||
|
t = TempFile('tstatomic.cpp')
|
||||||
|
t.add("""
|
||||||
|
#include <atomic>
|
||||||
|
std::atomic<int> x;
|
||||||
|
std::atomic<short> y;
|
||||||
|
std::atomic<char> z;
|
||||||
|
std::atomic<long long> w;
|
||||||
|
int main() {
|
||||||
|
++z;
|
||||||
|
++y;
|
||||||
|
++w;
|
||||||
|
return ++x;
|
||||||
|
}
|
||||||
|
""")
|
||||||
|
t.commit()
|
||||||
|
fails_without = exec_compiler_cmd([cc, CPPFLAGS, '', 'tstatomic.cpp', LDFLAGS, '']) != 0
|
||||||
|
ok_with = exec_compiler_cmd([cc, CPPFLAGS, '', 'tstatomic.cpp', LDFLAGS + ' -latomic', '']) == 0
|
||||||
|
return fails_without and ok_with
|
||||||
|
|
||||||
|
|
||||||
def find_jni_h(path):
|
def find_jni_h(path):
|
||||||
for root, dirs, files in os.walk(path):
|
for root, dirs, files in os.walk(path):
|
||||||
|
@ -2600,6 +2620,9 @@ def mk_config():
|
||||||
CXXFLAGS = '%s -fvisibility=hidden -fvisibility-inlines-hidden -c' % CXXFLAGS
|
CXXFLAGS = '%s -fvisibility=hidden -fvisibility-inlines-hidden -c' % CXXFLAGS
|
||||||
FPMATH = test_fpmath(CXX)
|
FPMATH = test_fpmath(CXX)
|
||||||
CXXFLAGS = '%s %s' % (CXXFLAGS, FPMATH_FLAGS)
|
CXXFLAGS = '%s %s' % (CXXFLAGS, FPMATH_FLAGS)
|
||||||
|
atomic_required = test_atomic_required(CXX)
|
||||||
|
if atomic_required:
|
||||||
|
LDFLAGS = '%s -latomic' % LDFLAGS
|
||||||
if LOG_SYNC:
|
if LOG_SYNC:
|
||||||
CXXFLAGS = '%s -DZ3_LOG_SYNC' % CXXFLAGS
|
CXXFLAGS = '%s -DZ3_LOG_SYNC' % CXXFLAGS
|
||||||
if SINGLE_THREADED:
|
if SINGLE_THREADED:
|
||||||
|
@ -2710,6 +2733,7 @@ def mk_config():
|
||||||
print('Prefix: %s' % PREFIX)
|
print('Prefix: %s' % PREFIX)
|
||||||
print('64-bit: %s' % is64())
|
print('64-bit: %s' % is64())
|
||||||
print('FP math: %s' % FPMATH)
|
print('FP math: %s' % FPMATH)
|
||||||
|
print('libatomic: %s' % ('required' if atomic_required else 'not required'))
|
||||||
print("Python pkg dir: %s" % PYTHON_PACKAGE_DIR)
|
print("Python pkg dir: %s" % PYTHON_PACKAGE_DIR)
|
||||||
if GPROF:
|
if GPROF:
|
||||||
print('gprof: enabled')
|
print('gprof: enabled')
|
||||||
|
|
Loading…
Reference in a new issue