Fix compilation issue for Java bindings + CLN (#3045)
authorAndres Noetzli <andres.noetzli@gmail.com>
Wed, 12 Jun 2019 00:21:54 +0000 (17:21 -0700)
committerGitHub <noreply@github.com>
Wed, 12 Jun 2019 00:21:54 +0000 (17:21 -0700)
Fixes #3044. When using CLN instead of GMP, SWIG produces different Java
files for the CLN classes. The bindings expected the GMP files even when
building with CLN, so compilation failed. This commit fixes the issue by
changing the list of files depending on whether we build with CLN or
GMP.

src/bindings/java/CMakeLists.txt

index b1631f369fe6f6f188ec9428745bf36644674ae1..6277b2794812bfc3eae46d4fe7a009fbc6b6e744 100644 (file)
@@ -175,8 +175,6 @@ set(gen_java_files
   ${CMAKE_CURRENT_BINARY_DIR}/SWIGTYPE_p_ListenerCollection__Registration.java
   ${CMAKE_CURRENT_BINARY_DIR}/SWIGTYPE_p_MaybeT_CVC4__Rational_t.java
   ${CMAKE_CURRENT_BINARY_DIR}/SWIGTYPE_p_Type.java
-  ${CMAKE_CURRENT_BINARY_DIR}/SWIGTYPE_p_mpq_class.java
-  ${CMAKE_CURRENT_BINARY_DIR}/SWIGTYPE_p_mpz_class.java
   ${CMAKE_CURRENT_BINARY_DIR}/SWIGTYPE_p_std__istream.java
   ${CMAKE_CURRENT_BINARY_DIR}/SWIGTYPE_p_std__ostream.java
   ${CMAKE_CURRENT_BINARY_DIR}/SWIGTYPE_p_std__shared_ptrT_CVC4__SygusPrintCallback_t.java
@@ -242,6 +240,18 @@ set(gen_java_files
   ${CMAKE_CURRENT_BINARY_DIR}/vectorVectorExpr.java
 )
 
+if(CVC4_USE_CLN_IMP)
+  list(APPEND gen_java_files
+    ${CMAKE_CURRENT_BINARY_DIR}/SWIGTYPE_p_cln__cl_I.java
+    ${CMAKE_CURRENT_BINARY_DIR}/SWIGTYPE_p_cln__cl_RA.java
+  )
+elseif(CVC4_USE_GMP_IMP)
+  list(APPEND gen_java_files
+    ${CMAKE_CURRENT_BINARY_DIR}/SWIGTYPE_p_mpq_class.java
+    ${CMAKE_CURRENT_BINARY_DIR}/SWIGTYPE_p_mpz_class.java
+  )
+endif()
+
 set(CMAKE_JNI_TARGET TRUE)
 add_jar(cvc4jar
         SOURCES ${gen_java_files}