mirror of
				https://github.com/Z3Prover/z3
				synced 2025-11-04 13:29:11 +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
					
				
					 1 changed files with 31 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -314,6 +314,26 @@ def test_fpmath(cc):
 | 
			
		|||
        FPMATH_FLAGS=""
 | 
			
		||||
        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):
 | 
			
		||||
    for root, dirs, files in os.walk(path):
 | 
			
		||||
| 
						 | 
				
			
			@ -2600,6 +2620,9 @@ def mk_config():
 | 
			
		|||
        CXXFLAGS = '%s -fvisibility=hidden -fvisibility-inlines-hidden -c' % CXXFLAGS
 | 
			
		||||
        FPMATH = test_fpmath(CXX)
 | 
			
		||||
        CXXFLAGS = '%s %s' % (CXXFLAGS, FPMATH_FLAGS)
 | 
			
		||||
        atomic_required = test_atomic_required(CXX)
 | 
			
		||||
        if atomic_required:
 | 
			
		||||
            LDFLAGS  = '%s -latomic' % LDFLAGS
 | 
			
		||||
        if LOG_SYNC:
 | 
			
		||||
            CXXFLAGS = '%s -DZ3_LOG_SYNC' % CXXFLAGS
 | 
			
		||||
        if SINGLE_THREADED:
 | 
			
		||||
| 
						 | 
				
			
			@ -2710,6 +2733,7 @@ def mk_config():
 | 
			
		|||
            print('Prefix:         %s' % PREFIX)
 | 
			
		||||
            print('64-bit:         %s' % is64())
 | 
			
		||||
            print('FP math:        %s' % FPMATH)
 | 
			
		||||
            print('libatomic:      %s' % ('required' if atomic_required else 'not required'))
 | 
			
		||||
            print("Python pkg dir: %s" % PYTHON_PACKAGE_DIR)
 | 
			
		||||
            if GPROF:
 | 
			
		||||
                print('gprof:          enabled')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue