I'm writing an SWT application which can be used on Windows (32/64 bit) and Mac OSX (32/64 bit).
Apart from the JRE I rely on the SWT library found here. I can find four versions of the SWT library depending upon my target platforms (as mentioned above).
When building my application, how can I compile using the correct SWT Jar? If possible, I'd like to try and avoid hard-coding the Jar version, platform and architecture. The SWT Jars are named like this:
- swt-win32-x86_64.jar
- swt-win32-x86_32.jar
- swt-macosx-x86_32.jar
- swt-macosx-x86_64.jar
(My project will be an open source project. I'd like people to be able to download the source and build it and therefore I've thought of including all the four versions of the SWT Jars in the source distribution. I hope this is the correct approach of publishing code relying on third-part libraries.)
Thanks everyone.
I've tried to accomplish it like this: I've installed the Ant Contrib tasks because it supports
if
statements. I've modified my build file to use to detect the OS platform and architecture.When compiling, it uses all the 4 SWT Jars from my
lib.dir
but after compilation, it copies over only the necessary SWT Jar to my build directory. I guess this would keep my size of my final ZIP much smaller than keeping all four JARs.This seems to work so far. I'll test it some more and add a comment.