cmake: Added java examples
authorAina Niemetz <aina.niemetz@gmail.com>
Fri, 14 Sep 2018 18:24:15 +0000 (11:24 -0700)
committerMathias Preiner <mathias.preiner@gmail.com>
Sat, 22 Sep 2018 23:30:59 +0000 (16:30 -0700)
examples/CMakeLists.txt
examples/api/java/CMakeLists.txt

index a3f4f5e30731889df6f18659b4074901498d5151..be278f2abb258d5e96586764cfeca6c1b72a751e 100644 (file)
@@ -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)
+
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..049d390bd73bd8c4803f81f5b5712d4e8895636e 100644 (file)
@@ -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)