summaryrefslogtreecommitdiff
path: root/test/unit/api/java/CMakeLists.txt
blob: 66b764ca4944c940ecc905463026234b567ef928 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
###############################################################################
# Top contributors (to current version):
#   Mudathir Mohamed
#
# This file is part of the cvc5 project.
#
# Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
# in the top-level source directory and their institutional affiliations.
# All rights reserved.  See the file COPYING in the top-level source
# directory for licensing information.
# #############################################################################
#
# The build system configuration.
##

find_package(Java REQUIRED)
include(UseJava)
find_package(JUnit REQUIRED)

get_target_property(CVC5_JAR_PATH cvc5jar JAR_FILE)

# specify source files for junit tests
set(java_test_src_files
  ${CMAKE_CURRENT_SOURCE_DIR}/cvc5/DatatypeTest.java
  ${CMAKE_CURRENT_SOURCE_DIR}/cvc5/GrammarTest.java
  ${CMAKE_CURRENT_SOURCE_DIR}/cvc5/OpTest.java
  ${CMAKE_CURRENT_SOURCE_DIR}/cvc5/ResultTest.java
  ${CMAKE_CURRENT_SOURCE_DIR}/cvc5/SolverTest.java
  ${CMAKE_CURRENT_SOURCE_DIR}/cvc5/SortTest.java
  ${CMAKE_CURRENT_SOURCE_DIR}/cvc5/TermTest.java
)

# build junit tests
add_custom_target(
  build-junit-tests
  ALL
  COMMAND
    ${Java_JAVAC_EXECUTABLE} ${java_test_src_files}
    -cp ${JUnit_JAR}:${CVC5_JAR_PATH} # add JUnit and cvc5 jar files to the class path
    -d . # specify the output directory for the generated .class files
  COMMENT "Build junit tests"
  VERBATIM
)

# make sure junit jar file is present
add_dependencies(build-junit-tests JUnit-EP-jar)
# make sure cvc.jar file is built first
add_dependencies(build-junit-tests cvc5jar)

get_filename_component(CVC5_JNI_PATH ${CVC5_JAR_PATH} DIRECTORY)

# run junit tests
add_custom_target(
  run-junit-tests
  ALL
  COMMAND
    # run junit tests
    ${Java_JAVA_EXECUTABLE}
    -Djava.library.path=${CVC5_JNI_PATH}
    -jar ${JUnit_JAR}
    -cp ${JUnit_JAR}:${CVC5_JAR_PATH}:.
    -select-package cvc5
  COMMENT "Run junit tests"
  VERBATIM
)

add_dependencies(run-junit-tests build-junit-tests)
add_dependencies(units run-junit-tests)
add_dependencies(check run-junit-tests)
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback