1
+ message (STATUS "Downloading java-models-library..." )
2
+ include ("${CBMC_SOURCE_DIR} /../cmake/DownloadProject.cmake" )
3
+
4
+ # Note: 'PATCH_COMMAND' is being used instead of 'COMMAND' as
5
+ # 'download_project' does not work as expected if called without
6
+ # 'PATCH_COMMAND'.
7
+ download_project(PROJ java_models_library
8
+ URL https://github.com/diffblue/java-models-library/archive/master.zip
9
+ PATCH_COMMAND cmake -E copy_directory "${CMAKE_BINARY_DIR} /java_models_library-src/src"
10
+ "${JBMC_SOURCE_DIR} /java_bytecode/library/src"
11
+ )
12
+
1
13
find_package (Java REQUIRED)
2
14
include (UseJava)
15
+
3
16
set (CMAKE_JAVA_COMPILE_FLAGS -sourcepath "src" -d "classes" -XDignore.symbol.file)
4
17
5
18
# create a target for the executable performing the .jar -> .inc conversion
@@ -9,16 +22,11 @@ add_executable(java-converter converter.cpp)
9
22
file (GLOB_RECURSE java_sources "src/*.java" )
10
23
add_jar("core-models" ${java_sources} )
11
24
12
- # define a cmake variable with the full path of the .inc file
13
- set (JAVA_CORE_MODELS_INC "${CMAKE_CURRENT_BINARY_DIR} /java_core_models.inc" )
14
-
15
- # define a rule telling cmake how to generate the file ${JAVA_CORE_MODELS_INC} from
16
- # the .jar file by running the java-converter; the output file depends on the
17
- # .jar file but also on the converter (!)
18
- add_custom_command (OUTPUT ${JAVA_CORE_MODELS_INC}
19
- COMMAND java-converter "JAVA_CORE_MODELS" "core-models.jar" > ${JAVA_CORE_MODELS_INC}
20
- DEPENDS "core-models.jar" java-converter)
21
-
22
- # create a target 'core-models-inc' that depends on the .inc file
23
- add_custom_target (java-core-models-inc
24
- DEPENDS ${JAVA_CORE_MODELS_INC} )
25
+ # copy 'core-models.jar' to '<PROJECT_ROOT>/jbmc/src/java_bytecode/library'.
26
+ # This is needed to deal with unit tests that make use of the core-models
27
+ # library. So that they can find the 'core-models.jar' in the same place as
28
+ # if the project had been compiled with 'make'.
29
+ add_custom_command (TARGET core-models
30
+ POST_BUILD
31
+ COMMAND ${CMAKE_COMMAND} -E copy "core-models.jar" ${PROJECT_SOURCE_DIR} /java_bytecode/library
32
+ )
0 commit comments