Commit 8a14875e authored by ikus060's avatar ikus060

Initial version compiling on linux x86_64, windows i686 & x86_64

parents
/target
*~
/bin
.project
.classpath
.settings
\ No newline at end of file
= cbc4j =
== Compile ==
This section describe how to configure a linux debian computer to compile the
cbc4j project. A special configuration is required to cross-compile for
windows.
{{{
sudo apt-get install default-jdk maven swig build-essential gcc-mingw-w64 mingw-w64 g++-multilib
}}}
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.patrikdufresne.cbc4j</groupId>
<artifactId>cbc4j-root</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>cbc4j-linux-x86_64</artifactId>
<properties>
<compile.target>x86_64-linux-gnu</compile.target>
<compile.ldflags></compile.ldflags>
<compile.cxxflags></compile.cxxflags>
<javacbc.lib.name>libjavacbc${javacbc.version}.so</javacbc.lib.name>
<javacbc.platform.dir>linux/x86_64</javacbc.platform.dir>
</properties>
<build>
<plugins>
<!-- Compile cbc and javacbc -->
<!-- The configuration is defined in the parent pom -->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>build-coin-cbc</id>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<!-- Get the coin-cbc source -->
<get src="${cbc.url}" dest="${cbc.dir}.tgz" skipexisting="true" />
<untar src="${cbc.dir}.tgz"
dest="${project.build.directory}"
compression="gzip" />
<!-- Configure coin-cbc -->
<echo message="------------------------------------------------------------------------" />
<echo message="COMPILING COIN_CBC" />
<echo message="------------------------------------------------------------------------" />
<chmod dir="${cbc.dir}" perm="+x" includes="configure,**/install-sh"/>
<exec executable="./configure" dir="${cbc.dir}"
failonerror="true">
<env key="LDFLAGS" value="${compile.ldflags}"/>
<env key="CXXFLAGS" value="${compile.cxxflags}"/>
<arg value="--disable-shared" />
<arg value="--with-pic" />
<arg value="--target=${compile.target}" />
<arg value="--host=${compile.target}" />
</exec>
<!-- Compile coin-cbc -->
<exec executable="make" dir="${cbc.dir}"
failonerror="true" />
<exec executable="make" dir="${cbc.dir}"
failonerror="true">
<arg value="install" />
</exec>
<!-- Compile javacbc -->
<echo message="------------------------------------------------------------------------" />
<echo message="COMPILING JAVACBC" />
<echo message="------------------------------------------------------------------------" />
<copy todir="${project.build.directory}/javacbc">
<fileset dir="../src/main/native" />
</copy>
<mkdir dir="${swig.generated.sources}/${swig.package.dir}" />
<exec executable="make" dir="${project.build.directory}/javacbc"
failonerror="true">
<env key="SWIG_OUTDIR" path="${swig.generated.sources}/${swig.package.dir}" />
<env key="SWIG_PACKAGE" value="${swig.package.name}" />
<env key="CBCDIR" path="${cbc.dir}"/>
<env key="JAVADIR" path="/usr/lib/jvm/default-java"/>
<env key="TARGET" value="${compile.target}"/>
<env key="LDFLAGS" value="${compile.ldflags}"/>
<env key="LIBJAVACBC" value ="${javacbc.lib.name}" />
</exec>
<mkdir dir="${javacbc.generated.resources}/${javacbc.platform.dir}" />
<copy file="${project.build.directory}/javacbc/${javacbc.lib.name}" tofile="${javacbc.generated.resources}/${javacbc.platform.dir}/${javacbc.lib.name}" />
</target>
</configuration>
</execution>
</executions>
</plugin>
<!-- To support this plugin in eclipse install the plugin from http://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-buildhelper/0.15.0/N/0.15.0.201207090124/ -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>add-source-swig</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${swig.generated.sources}</source>
<source>../src/main/java</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-generate-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>${javacbc.generated.resources}</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.patrikdufresne.cbc4j</groupId>
<artifactId>cbc4j-root</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>cbc4j-win-i686</artifactId>
<properties>
<compile.target>i686-w64-mingw32</compile.target>
<compile.ldflags>-static-libgcc -static-libstdc++</compile.ldflags>
<compile.cxxflags>-D__MINGW64__</compile.cxxflags>
<javacbc.lib.name>javacbc${javacbc.version}.dll</javacbc.lib.name>
<javacbc.platform.dir>win/x86</javacbc.platform.dir>
</properties>
<build>
<plugins>
<!-- Compile cbc and javacbc -->
<!-- The configuration is defined in the parent pom -->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>build-coin-cbc</id>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<!-- Get the coin-cbc source -->
<get src="${cbc.url}" dest="${cbc.dir}.tgz" skipexisting="true" />
<untar src="${cbc.dir}.tgz"
dest="${project.build.directory}"
compression="gzip" />
<!-- Configure coin-cbc -->
<echo message="------------------------------------------------------------------------" />
<echo message="COMPILING COIN_CBC" />
<echo message="------------------------------------------------------------------------" />
<chmod dir="${cbc.dir}" perm="+x" includes="configure,**/install-sh"/>
<exec executable="./configure" dir="${cbc.dir}"
failonerror="true">
<env key="LDFLAGS" value="${compile.ldflags}"/>
<env key="CXXFLAGS" value="${compile.cxxflags}"/>
<arg value="--disable-shared" />
<arg value="--with-pic" />
<arg value="--target=${compile.target}" />
<arg value="--host=${compile.target}" />
</exec>
<!-- Compile coin-cbc -->
<exec executable="make" dir="${cbc.dir}"
failonerror="true" />
<exec executable="make" dir="${cbc.dir}"
failonerror="true">
<arg value="install" />
</exec>
<!-- Compile javacbc -->
<echo message="------------------------------------------------------------------------" />
<echo message="COMPILING JAVACBC" />
<echo message="------------------------------------------------------------------------" />
<copy todir="${project.build.directory}/javacbc">
<fileset dir="../src/main/native" />
</copy>
<mkdir dir="${swig.generated.sources}/${swig.package.dir}" />
<exec executable="make" dir="${project.build.directory}/javacbc"
failonerror="true">
<env key="SWIG_OUTDIR" path="${swig.generated.sources}/${swig.package.dir}" />
<env key="SWIG_PACKAGE" value="${swig.package.name}" />
<env key="CBCDIR" path="${cbc.dir}"/>
<env key="JAVADIR" path="/usr/lib/jvm/default-java"/>
<env key="TARGET" value="${compile.target}"/>
<env key="LDFLAGS" value="${compile.ldflags}"/>
<env key="LIBJAVACBC" value ="${javacbc.lib.name}" />
</exec>
<mkdir dir="${javacbc.generated.resources}/${javacbc.platform.dir}" />
<copy file="${project.build.directory}/javacbc/${javacbc.lib.name}" tofile="${javacbc.generated.resources}/${javacbc.platform.dir}/${javacbc.lib.name}" />
</target>
</configuration>
</execution>
</executions>
</plugin>
<!-- To support this plugin in eclipse install the plugin from http://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-buildhelper/0.15.0/N/0.15.0.201207090124/ -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>add-source-swig</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${swig.generated.sources}</source>
<source>../src/main/java</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-generate-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>${javacbc.generated.resources}</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.patrikdufresne.cbc4j</groupId>
<artifactId>cbc4j-root</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>cbc4j-win-x86_64</artifactId>
<properties>
<compile.target>x86_64-w64-mingw32</compile.target>
<compile.ldflags>-static-libgcc -static-libstdc++</compile.ldflags>
<compile.cxxflags></compile.cxxflags>
<javacbc.lib.name>javacbc${javacbc.version}.dll</javacbc.lib.name>
<javacbc.platform.dir>win/x86_64</javacbc.platform.dir>
</properties>
<build>
<plugins>
<!-- Compile cbc and javacbc -->
<!-- The configuration is defined in the parent pom -->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>build-coin-cbc</id>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<!-- Get the coin-cbc source -->
<get src="${cbc.url}" dest="${cbc.dir}.tgz" skipexisting="true" />
<untar src="${cbc.dir}.tgz"
dest="${project.build.directory}"
compression="gzip" />
<!-- Configure coin-cbc -->
<echo message="------------------------------------------------------------------------" />
<echo message="COMPILING COIN_CBC" />
<echo message="------------------------------------------------------------------------" />
<chmod dir="${cbc.dir}" perm="+x" includes="configure,**/install-sh"/>
<exec executable="./configure" dir="${cbc.dir}"
failonerror="true">
<env key="LDFLAGS" value="${compile.ldflags}"/>
<env key="CXXFLAGS" value="${compile.cxxflags}"/>
<arg value="--disable-shared" />
<arg value="--with-pic" />
<arg value="--target=${compile.target}" />
<arg value="--host=${compile.target}" />
</exec>
<!-- Compile coin-cbc -->
<exec executable="make" dir="${cbc.dir}"
failonerror="true" />
<exec executable="make" dir="${cbc.dir}"
failonerror="true">
<arg value="install" />
</exec>
<!-- Compile javacbc -->
<echo message="------------------------------------------------------------------------" />
<echo message="COMPILING JAVACBC" />
<echo message="------------------------------------------------------------------------" />
<copy todir="${project.build.directory}/javacbc">
<fileset dir="../src/main/native" />
</copy>
<mkdir dir="${swig.generated.sources}/${swig.package.dir}" />
<exec executable="make" dir="${project.build.directory}/javacbc"
failonerror="true">
<env key="SWIG_OUTDIR" path="${swig.generated.sources}/${swig.package.dir}" />
<env key="SWIG_PACKAGE" value="${swig.package.name}" />
<env key="CBCDIR" path="${cbc.dir}"/>
<env key="JAVADIR" path="/usr/lib/jvm/default-java"/>
<env key="TARGET" value="${compile.target}"/>
<env key="LDFLAGS" value="${compile.ldflags}"/>
<env key="LIBJAVACBC" value ="${javacbc.lib.name}" />
</exec>
<mkdir dir="${javacbc.generated.resources}/${javacbc.platform.dir}" />
<copy file="${project.build.directory}/javacbc/${javacbc.lib.name}" tofile="${javacbc.generated.resources}/${javacbc.platform.dir}/${javacbc.lib.name}" />
</target>
</configuration>
</execution>
</executions>
</plugin>
<!-- To support this plugin in eclipse install the plugin from http://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-buildhelper/0.15.0/N/0.15.0.201207090124/ -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>add-source-swig</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${swig.generated.sources}</source>
<source>../src/main/java</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-generate-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>${javacbc.generated.resources}</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.patrikdufresne.cbc4j</groupId>
<artifactId>cbc4j-root</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>cbc4j-root</name>
<!-- Define the SCM used for developpement. This information is used by
release:prepare -->
<scm>
<developerConnection>scm:git:http://git.patrikdufresne.com/cbc4j.git</developerConnection>
<tag>HEAD</tag>
</scm>
<!-- Define the repository for deployment -->
<distributionManagement>
<repository>
<id>patrikdufresne</id>
<name>Internal Releases</name>
<url>http://nexus.patrikdufresne.com/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>patrikdufresne</id>
<name>Internal Releases</name>
<url>http://nexus.patrikdufresne.com/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<javacbc.version>10</javacbc.version>
<!-- Define the version of cbc dependency -->
<cbc.version>2.8.3</cbc.version>
<!-- Define location of the source -->
<cbc.url>http://www.coin-or.org/download/source/Cbc/Cbc-${cbc.version}.tgz</cbc.url>
<cbc.dir>${project.build.directory}/Cbc-${cbc.version}</cbc.dir>
<!-- Define the package for generated source -->
<swig.package.name>com.patrikdufresne.cbc4j</swig.package.name>
<swig.package.dir>com/patrikdufresne/cbc4j</swig.package.dir>
<!-- Define destination of generated source -->
<swig.generated.sources>${project.build.directory}/generated-sources/swig</swig.generated.sources>
<!-- Define destination of generated javacbc lib -->
<javacbc.generated.resources>${project.build.directory}/generated-resources/javacbc</javacbc.generated.resources>
</properties>
<build>
<plugins>
<!-- javac version to 1.6 for all sub-project -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<!-- generate source package for all sub-project -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<modules>
<module>cbc4j-linux-x86_64</module>
<module>cbc4j-win-i686</module>
<module>cbc4j-win-x86_64</module>
</modules>
</project>
This diff is collapsed.
#Makefile for javaCbc
$(LIBJAVACBC): javacbc.o javacbc_wrap.o
$(TARGET)-g++ -shared -DNDEBUG javacbc.o javacbc_wrap.o -L$(CBCDIR)/lib -lCbcSolver -lCbc -lCgl -lOsiClp -lOsiCbc -lOsi -lClp -lCoinUtils -lm $(LDFLAGS) -o $(LIBJAVACBC)
javacbc.o: javacbc.cpp javacbc.hpp
$(TARGET)-g++ -fPIC -c javacbc.cpp -I$(CBCDIR)/include/coin -I$(JAVADIR)/include/ -I$(JAVADIR)/include/linux -I.
javacbc_wrap.o: javacbc_wrap.cxx
$(TARGET)-g++ -fPIC -c javacbc_wrap.cxx -I$(CBCDIR)/include/coin -I$(JAVADIR)/include/ -I$(JAVADIR)/include/linux -I.
javacbc_wrap.cxx: javacbc.i javacbc.hpp
swig -outdir "$(SWIG_OUTDIR)" -package "$(SWIG_PACKAGE)" -c++ -java javacbc.i
all: $(LIBJAVACBC)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment