-
Notifications
You must be signed in to change notification settings - Fork 273
Add CMakeLists alongside existing makefiles #1293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
22c2ab9
Add CMakeLists
reuk e609bbb
Add CMake howto to COMPILING file
reuk f6e4968
Enable running tests from CMake
reuk 3c36aa5
Enable CMake in Travis
reuk 6251055
Fix and refactor library_check target
reuk d953327
Enable caching for CMake builds (hopefully)
reuk 9afbced
Disable 32-bit builds in Travis
reuk 5afa929
Quote paths in flex/bison commands
reuk ad486f8
Set up glucose externalproject
reuk 5ee349f
Control SAT library from makefiles
reuk 7d4e9b5
Make CMake release flags similar to Makefile build
reuk 91684da
Clean up CMake files after #1321
reuk 4dde3c5
Disable glucose in Travis
reuk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the detailed instructions. Yet: how to set compiler options? For example, how to change optimisation, how to set additional linking flags? The bits currently in config.inc must be clearly documented here.