Skip to content

Commit

Permalink
Merge pull request #7958 from tautschnig/bugfixes/memory-analyzer-config
Browse files Browse the repository at this point in the history
Restrict memory-analyzer build to Linux x86_64/i386
  • Loading branch information
Enrico Steffinlongo authored Oct 20, 2023
2 parents 2bab0b3 + a738f6d commit 10f277c
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 26 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ function(cprover_default_properties)
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ${CBMC_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY})
endfunction()

if(CMAKE_SYSTEM_NAME STREQUAL Linux)
if(CMAKE_SYSTEM_NAME STREQUAL Linux AND
(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR
CMAKE_SYSTEM_PROCESSOR STREQUAL "i386"))
set(WITH_MEMORY_ANALYZER_DEFAULT ON)
else()
set(WITH_MEMORY_ANALYZER_DEFAULT OFF)
Expand Down
19 changes: 10 additions & 9 deletions regression/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,17 @@ DIRS = cbmc-shadow-memory \
book-examples \
# Empty last line

ifeq ($(OS),Windows_NT)
detected_OS := Windows
else
ifndef WITH_MEMORY_ANALYZER
ifeq ($(OS),Windows_NT)
WITH_MEMORY_ANALYZER = 0
else
detected_OS := $(shell sh -c 'uname 2>/dev/null || echo Unknown')
endif

ifeq ($(detected_OS),Linux)
ifneq ($(WITH_MEMORY_ANALYZER),0)
# only set if it wasn't explicitly unset
WITH_MEMORY_ANALYZER=1
detected_ARCH := $(shell sh -c 'uname -m 2>/dev/null || echo Unknown')
ifeq ($(filter-out Linux_x86_64 Linux_i386,$(detected_OS)_$(detected_ARCH)),)
WITH_MEMORY_ANALYZER = 1
else
WITH_MEMORY_ANALYZER = 0
endif
endif
endif

Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,6 @@ add_subdirectory(symtab2gb)
add_subdirectory(libcprover-cpp)
add_subdirectory(goto-bmc)

if((NOT WIN32 AND NOT APPLE) OR WITH_MEMORY_ANALYZER)
if(WITH_MEMORY_ANALYZER)
add_subdirectory(memory-analyzer)
endif()
18 changes: 12 additions & 6 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,22 @@ all: cbmc.dir \
symtab2gb.dir \
# Empty last line

ifeq ($(OS),Windows_NT)
detected_OS := Windows
else
detected_OS := $(shell sh -c 'uname 2>/dev/null || echo Unknown')
ifndef WITH_MEMORY_ANALYZER
ifeq ($(OS),Windows_NT)
WITH_MEMORY_ANALYZER = 0
else
detected_OS := $(shell sh -c 'uname 2>/dev/null || echo Unknown')
detected_ARCH := $(shell sh -c 'uname -m 2>/dev/null || echo Unknown')
ifeq ($(filter-out Linux_x86_64 Linux_i386,$(detected_OS)_$(detected_ARCH)),)
WITH_MEMORY_ANALYZER = 1
else
WITH_MEMORY_ANALYZER = 0
endif
endif
endif

ifeq ($(WITH_MEMORY_ANALYZER),1)
all: memory-analyzer.dir
else ifneq ($(filter-out Windows Darwin,$(detected_OS)),)
all: memory-analyzer.dir
endif

###############################################################################
Expand Down
19 changes: 10 additions & 9 deletions unit/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,17 @@ SRC += analyses/ai/ai.cpp \
util/xml.cpp \
# Empty last line

ifeq ($(OS),Windows_NT)
detected_OS := Windows
else
ifndef WITH_MEMORY_ANALYZER
ifeq ($(OS),Windows_NT)
WITH_MEMORY_ANALYZER = 0
else
detected_OS := $(shell sh -c 'uname 2>/dev/null || echo Unknown')
endif

ifeq ($(detected_OS),Linux)
ifneq ($(WITH_MEMORY_ANALYZER),0)
# only set if it wasn't explicitly unset
WITH_MEMORY_ANALYZER=1
detected_ARCH := $(shell sh -c 'uname -m 2>/dev/null || echo Unknown')
ifeq ($(filter-out Linux_x86_64 Linux_i386,$(detected_OS)_$(detected_ARCH)),)
WITH_MEMORY_ANALYZER = 1
else
WITH_MEMORY_ANALYZER = 0
endif
endif
endif

Expand Down

0 comments on commit 10f277c

Please sign in to comment.