@@ -90,8 +90,7 @@ SPDX-License-Identifier: Apache-2.0
90
90
<arg value =" swig/opensmt.i" />
91
91
</exec >
92
92
93
- <!-- Copy (only!) the required java files to the source tree. This should make sure that compilation fails
94
- if the OpenSMT interface changed, but the swig header wasn't updated -->
93
+ <!-- Copy the generated Java classes and the c++ wrapper to the source tree -->
95
94
<copy todir =" ${path.source}/src/org/sosy_lab/java_smt/solvers/opensmt/api" >
96
95
<fileset dir =" ${path.install}/java/opensmt" >
97
96
<include name =" ArithLogic.java" />
@@ -121,6 +120,13 @@ SPDX-License-Identifier: Apache-2.0
121
120
<include name =" VectorVectorInt.java" />
122
121
</fileset >
123
122
</copy >
123
+ <copy file =" ${path.install}/opensmt-wrap.cpp" toFile =" ${path.source}/opensmt-wrap.cpp" />
124
+
125
+ <!-- Apply the patch to add the license headers -->
126
+ <exec executable =" git" failonerror =" true" >
127
+ <arg value =" apply" />
128
+ <arg value =" ${path.source}/swigWrapper.patch" />
129
+ </exec >
124
130
125
131
<!-- Package swig generated source code -->
126
132
<jar destfile =" opensmt-${opensmt.version}-sources.jar" basedir =" ${path.source}/src" />
@@ -131,14 +137,10 @@ SPDX-License-Identifier: Apache-2.0
131
137
<jar destfile =" opensmt-${opensmt.version}-javadoc.jar" basedir =" ${path.source}/doc" />
132
138
<delete dir =" ${path.source}/doc" />
133
139
134
- <!-- Copy the lib to the root directory for later packaging-->
135
- <copy file =" ${path.install}/lib/libopensmt.so" toFile =" libopensmt-${opensmt.version}.so" />
136
-
137
140
<!-- Dump ${opensmt.version} to a file so that we can use it for the swig wrapper -->
138
141
<echo file =" ${path.source}/version.h" >#define VERSION "${opensmt.version}"</echo >
139
142
140
- <!-- Copy the swig wrapper to the source tree and compile it-->
141
- <copy file =" ${path.install}/opensmt-wrap.cpp" toFile =" ${path.source}/opensmt-wrap.cpp" />
143
+ <!-- Compile the swig wrapper to create the library -->
142
144
<exec executable =" gcc" dir =" ${path.source}" failonerror =" true" >
143
145
<arg value =" -fPIC" />
144
146
<arg value =" -std=c++20" />
@@ -150,16 +152,22 @@ SPDX-License-Identifier: Apache-2.0
150
152
<arg value =" -I${java.home}/include/" />
151
153
<arg value =" -I${java.home}/include/linux" />
152
154
</exec >
155
+ <delete file =" ${path.source}/version.h" />
153
156
154
157
<!-- Link the wrapper and create a new lib -->
155
- <symlink link =" libopensmt.so" resource =" libopensmt-${opensmt.version}.so" />
156
158
<exec executable =" gcc" dir =" ${path.source}" failonerror =" true" >
157
159
<arg value =" -shared" />
158
160
<arg value =" -o" />
159
161
<arg value =" ${user.dir}/libopensmtjava-${opensmt.version}.so" />
160
162
<arg value =" opensmt-wrap.o" />
161
- <arg value =" -L${path.install}/lib" />
162
- <arg value =" -l:libopensmt.a" />
163
+ <arg value =" -lstdc++" />
164
+ <arg value =" -Wl,--whole-archive" />
165
+ <arg value =" /dependencies/gmp-6.2.1/.libs/libgmp.a" />
166
+ <arg value =" /dependencies/gmp-6.2.1/.libs/libgmpxx.a" />
167
+ <arg value =" ${path.install}/lib/libopensmt.a" />
168
+ <arg value =" -Wl,--no-whole-archive" />
169
+ <arg value =" -lm" />
170
+ <arg value =" -Wl,-z,defs" />
163
171
</exec >
164
172
<delete file =" ${path.source}/opensmt-wrap.o" />
165
173
0 commit comments