3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-06 01:24:08 +00:00

Remove all per-OS defines apart from _WINDOWS.

These are all unused and shouldn't be needed. Mostly we need
something for differentiating between POSIX and non-POSIX
(until we can reduce some of those differences as well).

We shouldn't need to modify the build system to build on a new
OS if it is basically a Unix and is supported by cmake.
This commit is contained in:
Bruce Mitchener 2022-08-03 15:21:23 +07:00 committed by Nikolaj Bjorner
parent 85b96dc877
commit dc75031a36
2 changed files with 1 additions and 41 deletions

View file

@ -178,32 +178,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
################################################################################ ################################################################################
# Platform detection # Platform detection
################################################################################ ################################################################################
if (CMAKE_SYSTEM_NAME STREQUAL "Linux") if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
message(STATUS "Platform: Linux")
list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_LINUX_")
elseif (CMAKE_SYSTEM_NAME STREQUAL "Android")
message(STATUS "Platform: Android")
list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_ANDROID_")
elseif (CMAKE_SYSTEM_NAME MATCHES "GNU")
message(STATUS "Platform: GNU/Hurd")
list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_HURD_")
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
if (TARGET_ARCHITECTURE STREQUAL "arm64") if (TARGET_ARCHITECTURE STREQUAL "arm64")
set(CMAKE_OSX_ARCHITECTURES "arm64") set(CMAKE_OSX_ARCHITECTURES "arm64")
endif() endif()
message(STATUS "Platform: Darwin")
elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
message(STATUS "Platform: FreeBSD")
list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_FREEBSD_")
elseif (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
message(STATUS "Platform: NetBSD")
list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_NetBSD_")
elseif (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
message(STATUS "Platform: OpenBSD")
list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_OPENBSD_")
elseif (CYGWIN)
message(STATUS "Platform: Cygwin")
list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_CYGWIN")
elseif (WIN32) elseif (WIN32)
message(STATUS "Platform: Windows") message(STATUS "Platform: Windows")
list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_WINDOWS") list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_WINDOWS")
@ -216,8 +194,6 @@ elseif (EMSCRIPTEN)
"-s DISABLE_EXCEPTION_CATCHING=0" "-s DISABLE_EXCEPTION_CATCHING=0"
"-s ERROR_ON_UNDEFINED_SYMBOLS=1" "-s ERROR_ON_UNDEFINED_SYMBOLS=1"
) )
else()
message(FATAL_ERROR "Platform \"${CMAKE_SYSTEM_NAME}\" not recognised")
endif() endif()
list(APPEND Z3_COMPONENT_EXTRA_INCLUDE_DIRS list(APPEND Z3_COMPONENT_EXTRA_INCLUDE_DIRS

View file

@ -2594,46 +2594,30 @@ def mk_config():
SO_EXT = '.dylib' SO_EXT = '.dylib'
SLIBFLAGS = '-dynamiclib' SLIBFLAGS = '-dynamiclib'
elif sysname == 'Linux': elif sysname == 'Linux':
CXXFLAGS = '%s -D_LINUX_' % CXXFLAGS
OS_DEFINES = '-D_LINUX_'
SO_EXT = '.so' SO_EXT = '.so'
SLIBFLAGS = '-shared' SLIBFLAGS = '-shared'
SLIBEXTRAFLAGS = '%s -Wl,-soname,libz3.so' % SLIBEXTRAFLAGS SLIBEXTRAFLAGS = '%s -Wl,-soname,libz3.so' % SLIBEXTRAFLAGS
elif sysname == 'GNU': elif sysname == 'GNU':
CXXFLAGS = '%s -D_HURD_' % CXXFLAGS
OS_DEFINES = '-D_HURD_'
SO_EXT = '.so' SO_EXT = '.so'
SLIBFLAGS = '-shared' SLIBFLAGS = '-shared'
elif sysname == 'FreeBSD': elif sysname == 'FreeBSD':
CXXFLAGS = '%s -D_FREEBSD_' % CXXFLAGS
OS_DEFINES = '-D_FREEBSD_'
SO_EXT = '.so' SO_EXT = '.so'
SLIBFLAGS = '-shared' SLIBFLAGS = '-shared'
SLIBEXTRAFLAGS = '%s -Wl,-soname,libz3.so' % SLIBEXTRAFLAGS SLIBEXTRAFLAGS = '%s -Wl,-soname,libz3.so' % SLIBEXTRAFLAGS
elif sysname == 'NetBSD': elif sysname == 'NetBSD':
CXXFLAGS = '%s -D_NETBSD_' % CXXFLAGS
OS_DEFINES = '-D_NETBSD_'
SO_EXT = '.so' SO_EXT = '.so'
SLIBFLAGS = '-shared' SLIBFLAGS = '-shared'
elif sysname == 'OpenBSD': elif sysname == 'OpenBSD':
CXXFLAGS = '%s -D_OPENBSD_' % CXXFLAGS
OS_DEFINES = '-D_OPENBSD_'
SO_EXT = '.so' SO_EXT = '.so'
SLIBFLAGS = '-shared' SLIBFLAGS = '-shared'
elif sysname == 'SunOS': elif sysname == 'SunOS':
CXXFLAGS = '%s -D_SUNOS_' % CXXFLAGS
OS_DEFINES = '-D_SUNOS_'
SO_EXT = '.so' SO_EXT = '.so'
SLIBFLAGS = '-shared' SLIBFLAGS = '-shared'
SLIBEXTRAFLAGS = '%s -mimpure-text' % SLIBEXTRAFLAGS SLIBEXTRAFLAGS = '%s -mimpure-text' % SLIBEXTRAFLAGS
elif sysname.startswith('CYGWIN'): elif sysname.startswith('CYGWIN'):
CXXFLAGS = '%s -D_CYGWIN' % CXXFLAGS
OS_DEFINES = '-D_CYGWIN'
SO_EXT = '.dll' SO_EXT = '.dll'
SLIBFLAGS = '-shared' SLIBFLAGS = '-shared'
elif sysname.startswith('MSYS_NT') or sysname.startswith('MINGW'): elif sysname.startswith('MSYS_NT') or sysname.startswith('MINGW'):
CXXFLAGS = '%s -D_MINGW' % CXXFLAGS
OS_DEFINES = '-D_MINGW'
SO_EXT = '.dll' SO_EXT = '.dll'
SLIBFLAGS = '-shared' SLIBFLAGS = '-shared'
EXE_EXT = '.exe' EXE_EXT = '.exe'