-
Notifications
You must be signed in to change notification settings - Fork 5
/
build-okra-sim.xml
120 lines (100 loc) · 6.42 KB
/
build-okra-sim.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?xml version="1.0"?>
<project name="okra" default="build" basedir=".">
<import file="./common-targets.xml"/>
<!--
For each okra implementation, the following properites should get updated
1) the name of the repo to pull hsa from
2) the name of the cpp file with the okra implementation
-->
<property name="hsa.version" value="hsatools-old" />
<property name="okra.cpp.filename" value="okraContextSimulator.cpp" />
<property name="junit.jar.version" value="4.10"/>
<property name="junit.jar.name" value="junit-${junit.jar.version}.jar"/>
<property name="junit.home" value="${basedir}/.libs"/>
<property name="junit.base.url" value="http://repo1.maven.org/maven2/junit/junit"/>
<!-- Change the following to specify debug or release build -->
<property name="sim.build.type" value="DEBUG"/>
<property name="simbuild" value="sim/hsail2brig/build_linux"/>
<echo>OS Name: ${os.name}</echo>
<echo>OS Version: ${os.version}</echo>
<echo>OS Arch: ${os.arch}</echo>
<!--<property name="build.compiler" value="javac1.6"/>-->
<!-- <property name="ant.build.javac.source" value="1.6"/>-->
<!-- <property name="ant.build.javac.target" value="1.6"/> -->
<property environment="env" />
<!-- we need env.PATH for msvc only -->
<!-- uncomment this if you want to use mingw! -->
<!--<property name="mingw.dir" value="c:\\MinGW"/>-->
<available file="${simbuild}" type="dir" property="sim.exists" />
<available property="cmake.installed" file="cmake" filepath="${env.PATH}"/>
<available property="flex.installed" file="flex" filepath="${env.PATH}"/>
<available property="svn.installed" file="svn" filepath="${env.PATH}"/>
<available property="git.installed" file="git" filepath="${env.PATH}"/>
<available property="libelf-dev.installed" file="libelf.h" filepath="/usr/include"/>
<available property="libdwarf-dev.installed" file="libdwarf.h" filepath="/usr/include"/>
<target name="getsim" depends="init" unless="sim.exists" >
<property name="youneed.msg" value="To build the simulator and associated assembler, you need to install cmake, flex, subversion (for llvm pull), git (for libhsail pull), libelf-dev and libdwarf-dev"/>
<fail message="${youneed.msg}" unless="cmake.installed" />
<fail message="${youneed.msg}" unless="flex.installed" />
<fail message="${youneed.msg}" unless="svn.installed" />
<fail message="${youneed.msg}" unless="git.installed" />
<fail message="${youneed.msg}" unless="libelf-dev.installed" />
<fail message="${youneed.msg}" unless="libdwarf-dev.installed" />
<echo message="... downloading simulator hsa runtime sources, this may take a while but should only happen once..."/>
<mkdir dir="sim" />
<exec dir="sim" executable="git">
<arg line="clone https://github.com/HSAFoundation/HSAIL-Instruction-Set-Simulator-.git hsail2brig" />
</exec>
<!-- explicitly get the libhsail to avoid git problems -->
<echo message="... using git to pull libhsail..."/>
<exec dir="sim/hsail2brig/src/brig2llvm" executable="git">
<arg line="clone https://github.com/HSAFoundation/HSAIL-Tools.git" />
</exec>
<mkdir dir="${simbuild}" />
</target>
<available file="${simbuild}/src/hsa_runtime/libhsa.a" type="file" property="sim.built" />
<target name="buildsim" depends="getsim" >
<exec dir="${simbuild}" executable="cmake">
<arg line="-DCMAKE_BUILD_TYPE=${sim.build.type} ../" />
</exec>
<exec dir="${simbuild}" executable="make">
<arg line="--jobs=4" />
</exec>
</target>
<target name="gcc" if="use.gcc">
<mkdir dir="${basedir}/dist"/>
<mkdir dir="${basedir}/dist/lib"/>
<mkdir dir="${basedir}/dist/include"/>
<mkdir dir="${basedir}/dist/bin"/>
<echo message="linuxcc ${os.arch}" />
<exec executable="g++">
<!--
<arg value="-O3" />
-->
<arg value="-g" />
<arg value="-fPIC" />
<arg value="-I${java.home}/../include" />
<arg value="-I${java.home}/../include/linux" />
<arg value="-Isim/hsail2brig/include" />
<arg value="-Iinclude" />
<arg value="-shared" />
<arg value="-o" />
<arg value="${basedir}/dist/bin/libokra_${x86_or_x86_64}.so" />
<arg value="src/cpp/${okra.cpp.filename}" />
<arg value="src/cpp/OkraJNI.cpp" />
<arg line=" -rdynamic ${simbuild}/src/hsa_runtime/libhsa.a ${simbuild}/src/brig2llvm/libbrig2llvm.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMJIT.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMMCJIT.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMX86CodeGen.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMExecutionEngine.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMRuntimeDyld.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMAsmPrinter.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMSelectionDAG.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMX86Desc.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMMCParser.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMCodeGen.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMX86AsmPrinter.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMX86Info.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMScalarOpts.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMX86Utils.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMInstCombine.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMTransformUtils.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMipa.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMAnalysis.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMTarget.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMCore.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMMC.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMObject.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMDebugInfo.a ${simbuild}/src/brig2llvm/compiler/lib/libLLVMSupport.a -ldl -lpthread -lz" />
</exec>
<copy todir="dist/include">
<fileset dir="src/cpp">
<include name="**/okra*.h"/>
<include name="**/common.h"/>
</fileset>
</copy>
<!-- copy executables preserving x bit (too bad there is no ant task that preserves x bits) -->
<!-- hsailasm is built by the sim build rule. We need to use it when assembling for the simulator -->
<exec executable="cp" failonerror="true">
<arg line="${simbuild}/test/hsailasm dist/bin" />
</exec>
</target>
<target name="build" depends="clean, getsim, buildsim, javah, gcc" />
</project>