Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
integrate scala-package compiling into ROOT/Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
yzhliu committed Feb 21, 2016
1 parent 3e15f62 commit 2452d87
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 153 deletions.
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
ROOTDIR = $(CURDIR)

ifndef config
ifdef CXXNET_CONFIG
config = $(CXXNET_CONFIG)
Expand Down Expand Up @@ -32,14 +34,13 @@ ifeq ($(DEBUG), 1)
else
CFLAGS += -O3
endif
CFLAGS += -I./mshadow/ -I./dmlc-core/include -fPIC -Iinclude $(MSHADOW_CFLAGS)
CFLAGS += -I$(ROOTDIR)/mshadow/ -I$(ROOTDIR)/dmlc-core/include -fPIC -Iinclude $(MSHADOW_CFLAGS)
LDFLAGS = -pthread $(MSHADOW_LDFLAGS) $(DMLC_LDFLAGS)
ifeq ($(DEBUG), 1)
NVCCFLAGS = -g -G -O0 -ccbin $(CXX) $(MSHADOW_NVCCFLAGS)
else
NVCCFLAGS = --use_fast_math -g -O3 -ccbin $(CXX) $(MSHADOW_NVCCFLAGS)
endif
ROOTDIR = $(CURDIR)

ifndef LINT_LANG
LINT_LANG="all"
Expand Down Expand Up @@ -218,6 +219,12 @@ rpkg: roxygen
cp -rf dmlc-core/include/* R-package/inst/include/
R CMD build --no-build-vignettes R-package

scalapkg:
(cd scala-package; mvn clean package -Dcxx="$(CXX)" -Dcflags="$(CFLAGS)" -Dldflags="$(LDFLAGS)"; cd $(ROOTDIR))

scalatest:
(cd scala-package; mvn integration-test -Dcxx="$(CXX)" -Dcflags="$(CFLAGS)" -Dldflags="$(LDFLAGS)" $(SCALA_TEST_ARGS); cd $(ROOTDIR))

ifneq ($(EXTRA_OPERATORS),)
clean:
$(RM) -r build lib bin *~ */*~ */*/*~ */*/*/*~
Expand Down
11 changes: 11 additions & 0 deletions scala-package/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,23 @@
<profiles>
<profile>
<id>osx-x86_64</id>
<activation>
<os>
<family>mac</family>
<arch>x86_64</arch>
</os>
</activation>
<properties>
<platform>osx-x86_64</platform>
</properties>
</profile>
<profile>
<id>linux-x86_64</id>
<activation>
<os>
<family>linux</family>
</os>
</activation>
<properties>
<platform>linux-x86_64</platform>
</properties>
Expand Down
82 changes: 9 additions & 73 deletions scala-package/native/linux-x86_64/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,60 +36,6 @@
<artifactId>maven-compiler-plugin</artifactId>
</plugin>

<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<exportAntProperties>true</exportAntProperties>
<tasks>
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.plugin.classpath" />
<if>
<isset property="intel" />
<then>
<property name="use.cblas" value="0" />
<property name="use.mkl" value="1" />
<property name="cflags.blas" value="-I${intel}/mkl/include" />
<property name="ldflags.blas" value="-L${intel}/mkl/lib -L${intel}/lib" />
</then>
<else>
<property name="use.cblas" value="1" />
<property name="use.mkl" value="0" />
<property name="cflags.blas" value="" />
<if>
<not>
<isset property="ldflags.blas" />
</not>
<then>
<property name="ldflags.blas" value="-lcblas" />
</then>
</if>
</else>
</if>
<if>
<not>
<isset property="cxx" />
</not>
<then>
<property name="cxx" value="g++" />
</then>
</if>
<!-- echo opencv libs to a temp file and then load it into a property -->
<exec executable="pkg-config" output="${opencv.pkg.tmpfile}" failonerror="true">
<arg line="--libs opencv" />
</exec>
<loadfile srcfile="${opencv.pkg.tmpfile}" property="ldflags.opencv" />
<delete file="${opencv.pkg.tmpfile}" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>native-maven-plugin</artifactId>
Expand All @@ -111,33 +57,23 @@
<compilerStartOptions>
<compilerStartOption>-std=c++0x</compilerStartOption>
</compilerStartOptions>
<compilerMiddleOptions>
<compilerMiddleOption>
-msse3 -funroll-loops -Wno-unused-parameter -Wno-unknown-pragmas -fopenmp
</compilerMiddleOption>
</compilerMiddleOptions>
<compilerEndOptions>
<compilerEndOption>-I../../../include</compilerEndOption>
<compilerEndOption>-I../../../dmlc-core/include</compilerEndOption>
<compilerEndOption>-I../../../mshadow ${cflags.blas}</compilerEndOption>
<compilerEndOption>-DMSHADOW_USE_CUDA=0</compilerEndOption>
<compilerEndOption>-DMSHADOW_USE_CBLAS=${use.cblas}</compilerEndOption>
<compilerEndOption>-DMSHADOW_USE_MKL=${use.mkl}</compilerEndOption>
<compilerEndOption>-fPIC</compilerEndOption>

<compilerEndOption>${cflags}</compilerEndOption>
</compilerEndOptions>
<linkerStartOptions>
<linkerStartOption>-shared</linkerStartOption>
</linkerStartOptions>
<linkerMiddleOptions>
<linkerMiddleOption>-Wl,--whole-archive</linkerMiddleOption>
<linkerMiddleOption>../../../lib/libmxnet.a</linkerMiddleOption>
<linkerMiddleOption>../../../dmlc-core/libdmlc.a</linkerMiddleOption>
<linkerMiddleOption>-Wl,--no-whole-archive</linkerMiddleOption>
<linkerMiddleOption>-lm -lrt -fopenmp</linkerMiddleOption>
<linkerMiddleOption>${ldflags.opencv}</linkerMiddleOption>
<linkerMiddleOption>${ldflags.blas}</linkerMiddleOption>
<linkerMiddleOption>${ldflags}</linkerMiddleOption>
<linkerMiddleOption>-fopenmp</linkerMiddleOption>
</linkerMiddleOptions>
<linkerEndOptions>
<linkerEndOption>-Wl,--whole-archive</linkerEndOption>
<linkerEndOption>../../../lib/libmxnet.a</linkerEndOption>
<linkerEndOption>../../../dmlc-core/libdmlc.a</linkerEndOption>
<linkerEndOption>-Wl,--no-whole-archive</linkerEndOption>
</linkerEndOptions>
</configuration>

<executions>
Expand Down
77 changes: 9 additions & 68 deletions scala-package/native/osx-x86_64/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,55 +36,6 @@
<artifactId>maven-compiler-plugin</artifactId>
</plugin>

<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<exportAntProperties>true</exportAntProperties>
<tasks>
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.plugin.classpath" />
<property environment="env"/>
<if>
<isset property="intel" />
<then>
<property name="use.cblas" value="0" />
<property name="use.mkl" value="1" />
<property name="cflags.blas" value="-I${intel}/mkl/include" />
<property name="ldflags.blas" value="-L${intel}/mkl/lib -L${intel}/lib" />
</then>
<else>
<property name="use.cblas" value="1" />
<property name="use.mkl" value="0" />
<property name="cflags.blas"
value="-I/System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Versions/Current/Headers" />
<property name="ldflags.blas" value="-framework Accelerate" />
</else>
</if>
<if>
<not>
<isset property="cxx" />
</not>
<then>
<property name="cxx" value="g++" />
</then>
</if>
<!-- echo opencv libs to a temp file and then load it into a property -->
<exec executable="pkg-config" output="${opencv.pkg.tmpfile}" failonerror="true">
<arg line="--libs opencv" />
</exec>
<loadfile srcfile="${opencv.pkg.tmpfile}" property="ldflags.opencv" />
<delete file="${opencv.pkg.tmpfile}" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>native-maven-plugin</artifactId>
Expand All @@ -106,33 +57,23 @@
<compilerStartOptions>
<compilerStartOption>-std=c++0x</compilerStartOption>
</compilerStartOptions>
<compilerMiddleOptions>
<compilerMiddleOption>
-msse3 -funroll-loops -Wno-unused-parameter -Wno-unknown-pragmas
</compilerMiddleOption>
</compilerMiddleOptions>
<compilerEndOptions>
<compilerEndOption>-I../../../include</compilerEndOption>
<compilerEndOption>-I../../../dmlc-core/include</compilerEndOption>
<compilerEndOption>-I../../../mshadow ${cflags.blas}</compilerEndOption>
<compilerEndOption>-DMSHADOW_USE_CUDA=0</compilerEndOption>
<compilerEndOption>-DMSHADOW_USE_CBLAS=${use.cblas}</compilerEndOption>
<compilerEndOption>-DMSHADOW_USE_MKL=${use.mkl}</compilerEndOption>
<compilerEndOption>-fPIC</compilerEndOption>
<compilerEndOption>${cflags}</compilerEndOption>
</compilerEndOptions>
<linkerStartOptions>
<linkerStartOption>-shared</linkerStartOption>
</linkerStartOptions>
<linkerMiddleOptions>
<linkerMiddleOption>-fopenmp</linkerMiddleOption>
<linkerMiddleOption>-lm</linkerMiddleOption>
<linkerMiddleOption>-framework Accelerate ${ldflags.opencv}</linkerMiddleOption>
<linkerMiddleOption>-framework JavaVM ${ldflags.blas}</linkerMiddleOption>
<linkerMiddleOption>-Wl,-exported_symbol,_Java_*</linkerMiddleOption>
<linkerMiddleOption>-Wl,-x</linkerMiddleOption>
<linkerMiddleOption>../../../dmlc-core/libdmlc.a</linkerMiddleOption>
<linkerMiddleOption>-force_load ../../../lib/libmxnet.a</linkerMiddleOption>
<linkerMiddleOption>${ldflags}</linkerMiddleOption>
</linkerMiddleOptions>
<linkerEndOptions>
<linkerEndOption>-framework JavaVM</linkerEndOption>
<linkerEndOption>-Wl,-exported_symbol,_Java_*</linkerEndOption>
<linkerEndOption>-Wl,-x</linkerEndOption>
<linkerEndOption>../../../dmlc-core/libdmlc.a</linkerEndOption>
<linkerEndOption>-force_load ../../../lib/libmxnet.a</linkerEndOption>
</linkerEndOptions>
</configuration>

<executions>
Expand Down
11 changes: 11 additions & 0 deletions scala-package/native/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
<profiles>
<profile>
<id>osx-x86_64</id>
<activation>
<os>
<family>mac</family>
<arch>x86_64</arch>
</os>
</activation>
<properties>
<platform>osx-x86_64</platform>
</properties>
Expand All @@ -23,6 +29,11 @@
</profile>
<profile>
<id>linux-x86_64</id>
<activation>
<os>
<family>linux</family>
</os>
</activation>
<properties>
<platform>linux-x86_64</platform>
</properties>
Expand Down
12 changes: 2 additions & 10 deletions tests/travis/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,10 @@ if [ ${TASK} == "scala_test" ]; then
mkdir -p ${CACHE_PREFIX}/data
ln -s ${CACHE_PREFIX}/data ${PWD}/data

cd scala-package
export JAVA_HOME=$(/usr/libexec/java_home)

if [ ${TRAVIS_OS_NAME} == "osx" ]; then
mvn clean package -P osx-x86_64
mvn integration-test -P osx-x86_64 || exit -1
fi
if [ ${TRAVIS_OS_NAME} == "linux" ]; then
# use g++-4.8 for linux
mvn clean package -P linux-x86_64 -D cxx=g++-4.8 -D ldflags.blas=-lblas
mvn integration-test -P linux-x86_64 -D cxx=g++-4.8 -D ldflags.blas=-lblas || exit -1
fi
make scalapkg || exit -1
make scalatest || exit -1

exit 0
fi
Expand Down

0 comments on commit 2452d87

Please sign in to comment.