Skip to content

Commit 562fad2

Browse files
committed
Make JBMC build optional with cmake
This commit adds an option to CMake, `WITH_JBMC`, that controls whether the jbmc directory will be built. It is switched on by default, preserving the current behaviour. The motivation is to make it as easy as possible for users to get started with CBMC, especially users who are only interested in the C front-end and are on Windows, where installing the JDK and Maven is a painful exercise. Also updated `COMPILING.md` to note that you can pass `-DWITH_JBMC=OFF` to cmake to avoid building jbmc.
1 parent 2c63234 commit 562fad2

File tree

3 files changed

+34
-16
lines changed

3 files changed

+34
-16
lines changed

CMakeLists.txt

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ add_subdirectory(src)
117117
add_subdirectory(regression)
118118
add_subdirectory(unit)
119119

120-
add_subdirectory(jbmc)
120+
set(CBMC_CXX_STANDARD 11)
121+
set(CBMC_CXX_STANDARD_REQUIRED true)
122+
set(CBMC_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY
123+
"Developer ID Application: Daniel Kroening")
121124

122125
set_target_properties(
123126
analyses
@@ -152,20 +155,13 @@ set_target_properties(
152155
util
153156
xml
154157

155-
java_bytecode
156-
java-models-library
157-
jbmc
158-
jbmc-lib
159-
janalyzer
160-
janalyzer-lib
161-
jdiff
162-
jdiff-lib
163-
java-testing-utils
164-
java-unit
165-
miniz
166-
167158
PROPERTIES
168-
CXX_STANDARD 11
169-
CXX_STANDARD_REQUIRED true
170-
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "Developer ID Application: Daniel Kroening"
159+
CXX_STANDARD ${CBMC_CXX_STANDARD}
160+
CXX_STANDARD_REQUIRED ${CBMC_CXX_STANDARD_REQUIRED}
161+
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ${CBMC_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY}
171162
)
163+
164+
option(WITH_JBMC "Build the JBMC Java front-end" ON)
165+
if(WITH_JBMC)
166+
add_subdirectory(jbmc)
167+
endif()

COMPILING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ require manual modification of build files.
219219
```
220220
You shoud also install [Homebrew](https://brew.sh), after which you can
221221
run `brew install cmake` to install CMake.
222+
- On platforms where installing the Java Development Kit and Maven is
223+
difficult, you can avoid needing these dependencies by not building
224+
JBMC. Just pass `-DWITH_JBMC=OFF` to cmake in step (4) below.
222225
- On Windows, ensure you have Visual Studio 2015 or later installed.
223226
Then, download CMake from the [official download
224227
page](https://cmake.org/download).

jbmc/CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,22 @@ add_custom_target(java-models-library ALL
77
COMMAND cp target/core-models.jar ${CMAKE_CURRENT_SOURCE_DIR}/src/java_bytecode/library/
88
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/java-models-library
99
)
10+
11+
set_target_properties(
12+
java_bytecode
13+
java-models-library
14+
jbmc
15+
jbmc-lib
16+
janalyzer
17+
janalyzer-lib
18+
jdiff
19+
jdiff-lib
20+
java-testing-utils
21+
java-unit
22+
miniz
23+
24+
PROPERTIES
25+
CXX_STANDARD ${CBMC_CXX_STANDARD}
26+
CXX_STANDARD_REQUIRED ${CBMC_CXX_STANDARD_REQUIRED}
27+
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ${CBMC_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY}
28+
)

0 commit comments

Comments
 (0)