forked from diffblue/cbmc
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request diffblue#1293 from reuk/cmake-develop
Add CMakeLists alongside existing makefiles
- Loading branch information
Showing
61 changed files
with
1,292 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
cmake_minimum_required(VERSION 3.2) | ||
|
||
find_program(CCACHE_PROGRAM ccache) | ||
if(CCACHE_PROGRAM) | ||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}") | ||
endif() | ||
|
||
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9) | ||
|
||
include(GNUInstallDirs) | ||
|
||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
|
||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR | ||
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" | ||
) | ||
# Ensure NDEBUG is not set for release builds | ||
set(CMAKE_CXX_FLAGS_RELEASE "-O2") | ||
# Enable lots of warnings | ||
set(CMAKE_CXX_FLAGS "-Wall -Wpedantic -Werror") | ||
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") | ||
# This would be the place to enable warnings for Windows builds, although | ||
# config.inc doesn't seem to do that currently | ||
endif() | ||
|
||
set(enable_cbmc_tests on CACHE BOOL "Whether CBMC tests should be enabled") | ||
|
||
set(sat_impl "minisat2" CACHE STRING | ||
"This setting controls the SAT library which is used. Valid values are 'minisat2' and 'glucose'" | ||
) | ||
|
||
add_subdirectory(src) | ||
|
||
if(${enable_cbmc_tests}) | ||
enable_testing() | ||
endif() | ||
add_subdirectory(unit) | ||
add_subdirectory(regression) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED true) | ||
|
||
set(test_pl_path "${CMAKE_CURRENT_SOURCE_DIR}/test.pl") | ||
|
||
macro(add_test_pl_profile name cmdline flag profile) | ||
add_test( | ||
NAME "${name}-${profile}" | ||
COMMAND ${test_pl_path} -c ${cmdline} ${flag} | ||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" | ||
) | ||
set_tests_properties("${name}-${profile}" PROPERTIES | ||
LABELS "${profile}" | ||
) | ||
endmacro(add_test_pl_profile) | ||
|
||
macro(add_test_pl_tests name cmdline) | ||
add_test_pl_profile("${name}" "${cmdline}" -C CORE) | ||
add_test_pl_profile("${name}" "${cmdline}" -T THOROUGH) | ||
add_test_pl_profile("${name}" "${cmdline}" -F FUTURE) | ||
add_test_pl_profile("${name}" "${cmdline}" -K KNOWNBUG) | ||
endmacro(add_test_pl_tests) | ||
|
||
add_subdirectory(ansi-c) | ||
add_subdirectory(cbmc) | ||
add_subdirectory(cbmc-java) | ||
add_subdirectory(cbmc-java-inheritance) | ||
add_subdirectory(cpp) | ||
add_subdirectory(goto-analyzer) | ||
add_subdirectory(goto-diff) | ||
add_subdirectory(goto-instrument) | ||
add_subdirectory(goto-instrument-typedef) | ||
add_subdirectory(invariants) | ||
add_subdirectory(strings) | ||
add_subdirectory(strings-smoke-tests) | ||
add_subdirectory(test-script) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
add_test_pl_tests( | ||
"ansi-c" | ||
"$<TARGET_FILE:goto-cc>" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
add_test_pl_tests( | ||
"cbmc-java-inheritance" | ||
"$<TARGET_FILE:cbmc>" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
add_test_pl_tests( | ||
"cbmc-java" | ||
"$<TARGET_FILE:cbmc>" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
add_test_pl_tests( | ||
"cbmc" | ||
"$<TARGET_FILE:cbmc>" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
add_test_pl_tests( | ||
"cpp" | ||
"$<TARGET_FILE:goto-cc>" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
add_test_pl_tests( | ||
"goto-analyzer" | ||
"$<TARGET_FILE:goto-analyzer>" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
add_test_pl_tests( | ||
"goto-diff" | ||
"$<TARGET_FILE:goto-diff>" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
if(WIN32) | ||
set(is_windows true) | ||
else() | ||
set(is_windows false) | ||
endif() | ||
|
||
add_test_pl_tests( | ||
"goto-instrument-typedef" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/chain.sh $<TARGET_FILE:goto-cc> $<TARGET_FILE:goto-instrument> ${is_windows}" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
#!/bin/bash | ||
|
||
SRC=../../../src | ||
GC=$1 | ||
GI=$2 | ||
is_windows=$3 | ||
|
||
GC=$SRC/goto-cc/goto-cc | ||
GI=$SRC/goto-instrument/goto-instrument | ||
name=${*:$#} | ||
name=${name%.c} | ||
|
||
OPTS=$1 | ||
NAME=${2%.c} | ||
args=${*:4:$#-4} | ||
|
||
rm $NAME.gb | ||
$GC $NAME.c --function fun -o $NAME.gb | ||
echo $GI $OPTS $NAME.gb | ||
$GI $OPTS $NAME.gb | ||
rm "${name}.gb" | ||
if [[ "${is_windows}" == "true" ]]; then | ||
"$GC" "${name}.c" --function fun | ||
mv "${name}.exe" "${name}.gb" | ||
else | ||
"$GC" "${name}.c" --function fun -o "${name}.gb" | ||
fi | ||
|
||
echo "$GI" ${args} "${name}.gb" | ||
"$GI" ${args} "${name}.gb" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
if(WIN32) | ||
set(is_windows true) | ||
else() | ||
set(is_windows false) | ||
endif() | ||
|
||
add_test_pl_tests( | ||
"goto-instrument" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/chain.sh $<TARGET_FILE:goto-cc> $<TARGET_FILE:goto-instrument> $<TARGET_FILE:cbmc> ${is_windows}" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.