From d4728dcea759504cba5c5d74ee256eecc64c712b Mon Sep 17 00:00:00 2001 From: Aina Niemetz Date: Fri, 14 Sep 2018 11:24:15 -0700 Subject: [PATCH] cmake: Added java examples --- examples/CMakeLists.txt | 24 +++++++--- examples/api/java/CMakeLists.txt | 76 ++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 5 deletions(-) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index a3f4f5e30..be278f2ab 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,3 +1,5 @@ +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/examples) + include_directories(${PROJECT_SOURCE_DIR}/src) include_directories(${PROJECT_SOURCE_DIR}/src/include) include_directories(${CMAKE_BINARY_DIR}/src) @@ -45,11 +47,6 @@ set(CVC4_EXAMPLES_SETS_TRANSLATE sets2axioms ) -add_subdirectory(api) -add_subdirectory(hashsmt) -add_subdirectory(nra-translate) -add_subdirectory(sets-translate) - add_executable(simple_vc_cxx EXCLUDE_FROM_ALL simple_vc_cxx.cpp) target_link_libraries(simple_vc_cxx cvc4 cvc4parser) @@ -68,3 +65,20 @@ add_custom_target(examples ${CVC4_EXAMPLES_SETS_TRANSLATE} ) +if(BUILD_BINDINGS_JAVA) + find_package(Java REQUIRED) + set(EXAMPLES_JAVA_CLASSPATH "${CMAKE_BINARY_DIR}/src/bindings/java/CVC4.jar") + add_custom_target(SimpleVCjava + COMMAND + ${Java_JAVAC_EXECUTABLE} + -cp ${EXAMPLES_JAVA_CLASSPATH} ${CMAKE_CURRENT_SOURCE_DIR}/SimpleVC.java + -d ${CMAKE_BINARY_DIR}/bin/examples + DEPENDS cvc4jar) + add_dependencies(examples SimpleVCjava) +endif() + +add_subdirectory(api) +add_subdirectory(hashsmt) +add_subdirectory(nra-translate) +add_subdirectory(sets-translate) + diff --git a/examples/api/java/CMakeLists.txt b/examples/api/java/CMakeLists.txt index e69de29bb..049d390bd 100644 --- a/examples/api/java/CMakeLists.txt +++ b/examples/api/java/CMakeLists.txt @@ -0,0 +1,76 @@ +set(EXAMPLES_API_JAVA_BIN_DIR ${CMAKE_BINARY_DIR}/bin/examples/api/java) +file(MAKE_DIRECTORY ${EXAMPLES_API_JAVA_BIN_DIR}) + +add_custom_target(BitVectorsjava + COMMAND + ${Java_JAVAC_EXECUTABLE} + -cp ${EXAMPLES_JAVA_CLASSPATH} ${CMAKE_CURRENT_SOURCE_DIR}/BitVectors.java + -d ${EXAMPLES_API_JAVA_BIN_DIR} + DEPENDS cvc4jar) +add_dependencies(examples BitVectorsjava) + +add_custom_target(BitVectorsAndArraysjava + COMMAND + ${Java_JAVAC_EXECUTABLE} + -cp ${EXAMPLES_JAVA_CLASSPATH} ${CMAKE_CURRENT_SOURCE_DIR}/BitVectorsAndArrays.java + -d ${EXAMPLES_API_JAVA_BIN_DIR} + DEPENDS cvc4jar) +add_dependencies(examples BitVectorsAndArraysjava) + +## disabled until bindings for the new API are in place (issue #2284) +# add_custom_target(CVC4Streamsjava +# COMMAND +# ${Java_JAVAC_EXECUTABLE} +# -cp ${EXAMPLES_JAVA_CLASSPATH} ${CMAKE_CURRENT_SOURCE_DIR}/CVC4Streams.java +# -d ${CMAKE_BINARY_DIR}/bin/examples/api/java +# DEPENDS cvc4jar) +# add_dependencies(examples CVC4Streamsjava) + +add_custom_target(Combinationjava + COMMAND + ${Java_JAVAC_EXECUTABLE} + -cp ${EXAMPLES_JAVA_CLASSPATH} ${CMAKE_CURRENT_SOURCE_DIR}/Combination.java + -d ${EXAMPLES_API_JAVA_BIN_DIR} + DEPENDS cvc4jar) +add_dependencies(examples Combinationjava) + +add_custom_target(Datatypesjava + COMMAND + ${Java_JAVAC_EXECUTABLE} + -cp ${EXAMPLES_JAVA_CLASSPATH} ${CMAKE_CURRENT_SOURCE_DIR}/Datatypes.java + -d ${EXAMPLES_API_JAVA_BIN_DIR} + DEPENDS cvc4jar) +add_dependencies(examples Datatypesjava) + +add_custom_target(HelloWorldjava + COMMAND + ${Java_JAVAC_EXECUTABLE} + -cp ${EXAMPLES_JAVA_CLASSPATH} ${CMAKE_CURRENT_SOURCE_DIR}/HelloWorld.java + -d ${EXAMPLES_API_JAVA_BIN_DIR} + DEPENDS cvc4jar) +add_dependencies(examples HelloWorldjava) + +add_custom_target(LinearArithjava + COMMAND + ${Java_JAVAC_EXECUTABLE} + -cp ${EXAMPLES_JAVA_CLASSPATH} ${CMAKE_CURRENT_SOURCE_DIR}/LinearArith.java + -d ${EXAMPLES_API_JAVA_BIN_DIR} + DEPENDS cvc4jar) +add_dependencies(examples LinearArithjava) + +## disabled until bindings for the new API are in place (issue #2284) +# add_custom_target(PipedInputjava +# COMMAND +# ${Java_JAVAC_EXECUTABLE} +# -cp ${EXAMPLES_JAVA_CLASSPATH} ${CMAKE_CURRENT_SOURCE_DIR}/PipedInput.java +# -d ${EXAMPLES_API_JAVA_BIN_DIR} +# DEPENDS cvc4jar) +# add_dependencies(examples PipedInputjava) + +add_custom_target(Stringsjava + COMMAND + ${Java_JAVAC_EXECUTABLE} + -cp ${EXAMPLES_JAVA_CLASSPATH} ${CMAKE_CURRENT_SOURCE_DIR}/Strings.java + -d ${EXAMPLES_API_JAVA_BIN_DIR} + DEPENDS cvc4jar) +add_dependencies(examples Stringsjava) -- 2.30.2