
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@880627 13f79535-47bb-0310-9956-ffa450edef68
310 lines
11 KiB
XML
310 lines
11 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!--
|
|
Licensed to the Apache Software Foundation (ASF) under one
|
|
or more contributor license agreements. See the NOTICE file
|
|
distributed with this work for additional information
|
|
regarding copyright ownership. The ASF licenses this file
|
|
to you under the Apache License, Version 2.0 (the
|
|
"License"); you may not use this file except in compliance
|
|
with the License. You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing,
|
|
software distributed under the License is distributed on an
|
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
KIND, either express or implied. See the License for the
|
|
specific language governing permissions and limitations
|
|
under the License.
|
|
-->
|
|
<project name='compiler-targets'>
|
|
|
|
<import file="./system.xml"/>
|
|
|
|
<!--
|
|
Do a cpp compilation.
|
|
Inherits from "Tuscany-BaseCompiler", which has an include path of:
|
|
${tuscanySDO.root.src.dir}/core/src
|
|
@param objdir - directory where the object files will be written
|
|
@param srcdir - directory where the source files are located.
|
|
@param infiles - a space seperated list of the files to compile
|
|
@param custom-cc-elements - any extra cpp elements, may also be extra <includepath> elements
|
|
-->
|
|
<macrodef name="cpp-compile">
|
|
<attribute name="objdir" default="."/>
|
|
<attribute name="srcdir" default="."/>
|
|
<attribute name="infiles" default="*.cpp"/>
|
|
<element name="custom-cc-elements" optional="true"/>
|
|
<sequential>
|
|
<mkdir dir='@{objdir}'/>
|
|
<cc subsystem='console'
|
|
objdir='@{objdir}'
|
|
debug='${debug.compile}'>
|
|
<compiler refid='${compiler.name}-Compiler'/>
|
|
<fileset dir='@{srcdir}' includes='@{infiles}'/>
|
|
<custom-cc-elements/>
|
|
</cc>
|
|
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<!--
|
|
Do a cpp link which results in either a library (linktype of plugin, shared, or static)
|
|
or an executable (linktype of executable).
|
|
Inherits from "Tuscany-BaseLinker"
|
|
@param outfile - name of the library to create, OS prefixes and suffixes will be added
|
|
@param destdir - directory where the library will be written
|
|
@param infiles - a space seperated list of the object files to link
|
|
@param linktype - executable, plugin, shared, static
|
|
@param custom-ld-elements - any extra cpp elements, may also be extra <libset> elements
|
|
-->
|
|
<macrodef name="cpp-link">
|
|
<attribute name="outfile" default="out"/>
|
|
<attribute name="outdir" default="."/>
|
|
<attribute name="indir" default="."/>
|
|
<attribute name="infiles" default="*${object.ext}"/>
|
|
<attribute name="linktype" default="shared"/>
|
|
<element name="custom-ld-elements" optional="true"/>
|
|
<sequential>
|
|
<mkdir dir='@{outdir}'/>
|
|
<cc link='@{linktype}'
|
|
subsystem='console'
|
|
outfile='@{outdir}/@{outfile}'
|
|
debug='${debug.compile}'>
|
|
<linker refid='${compiler.name}-Linker'/>
|
|
<fileset dir='@{indir}' includes='@{infiles}'/>
|
|
<custom-ld-elements/>
|
|
</cc>
|
|
<cpp-embed-manifest dir="@{outdir}" file="@{outfile}" outtype="@{outtype}"/>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<!--
|
|
Do a cpp build which compiles and links, resulting in either a library (linktype
|
|
of plugin, shared, or static) or an executable (linktype of executable).
|
|
Inherits from both "Tuscany-BaseCompiler" and "Tuscany-BaseLinker"
|
|
@param srcdir - directory where the source files are located.
|
|
@param infiles - a space seperated list of the source files to compile and link
|
|
@param outdir - directory where the output file will be written
|
|
@param outfile - name of the library or binary to create, OS prefixes and suffixes may be added
|
|
@param outtype - executable, plugin, shared, static
|
|
@param custom-build-elements - any extra elements needed for compiling or linking
|
|
may also be extra <includepath> or <libset> elements
|
|
-->
|
|
<macrodef name="cpp-build">
|
|
<attribute name="srcdir" default="."/>
|
|
<attribute name="infiles" default="*.cpp"/>
|
|
<attribute name="outdir" default="."/>
|
|
<attribute name="outfile" default="out"/>
|
|
<attribute name="outtype" default="shared"/>
|
|
<element name="custom-build-elements" optional="true"/>
|
|
<sequential>
|
|
<mkdir dir='@{outdir}'/>
|
|
<cc outtype='@{outtype}'
|
|
subsystem='console'
|
|
objdir='@{outdir}'
|
|
outfile='@{outdir}/@{outfile}'
|
|
debug='${debug.compile}'>
|
|
<compiler refid='${compiler.name}-Compiler'/>
|
|
<linker refid='${compiler.name}-Linker'/>
|
|
<fileset dir='@{srcdir}' includes='@{infiles}'/>
|
|
<custom-build-elements/>
|
|
</cc>
|
|
<cpp-embed-manifest dir="@{outdir}" file="@{outfile}" outtype="@{outtype}"/>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<!--
|
|
Install a single file
|
|
@param file - file to install
|
|
@param srcdir - directory of file to install
|
|
@param destdir - Where to install the file
|
|
@param executable - set permissions to executable, defaults true
|
|
-->
|
|
<macrodef name="cpp-install-file">
|
|
<attribute name="srcfile"/>
|
|
<attribute name="srcdir" default="."/>
|
|
<attribute name="destfile" default="@{srcfile}"/>
|
|
<attribute name="destdir"/>
|
|
<attribute name="executable" default="true"/>
|
|
<sequential>
|
|
<mkdir dir="@{destdir}"/>
|
|
<copy file="@{srcdir}/@{srcfile}" tofile="@{destdir}/@{destfile}" overwrite='true'/>
|
|
<if>
|
|
<equals arg1="@{executable}" arg2="true"/>
|
|
<then>
|
|
<chmod file="@{destdir}/@{destfile}" perm="755"/>
|
|
</then>
|
|
</if>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<!--
|
|
Install multiple files
|
|
@param files - space seperated list of files to install
|
|
@param srcdir - location of files to install
|
|
@param destdir - Where to install files
|
|
@param executable - set permissions to executable, defaults false
|
|
-->
|
|
<macrodef name="cpp-install-files">
|
|
<attribute name="files" default="*.*"/>
|
|
<attribute name="srcdir" default="."/>
|
|
<attribute name="destdir"/>
|
|
<attribute name="executable" default="false"/>
|
|
<sequential>
|
|
<mkdir dir="@{destdir}"/>
|
|
<copy todir="@{destdir}" overwrite='true'>
|
|
<fileset dir="@{srcdir}" includes="@{files}"/>
|
|
</copy>
|
|
<if>
|
|
<equals arg1="@{executable}" arg2="true"/>
|
|
<then>
|
|
<chmod file="@{destdir}/@{files}" perm="755"/>
|
|
</then>
|
|
</if>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<!--
|
|
Install a library
|
|
@param lib - library to install
|
|
@param srcdir - directory of file to install
|
|
@param destdir - Where to install the file
|
|
@param executable - set permissions to executable, defaults true
|
|
-->
|
|
<macrodef name="cpp-install-lib">
|
|
<attribute name="lib"/>
|
|
<attribute name="srcdir" default="."/>
|
|
<attribute name="destrootdir"/>
|
|
<attribute name="version" default="${tuscanySDO.library.version}"/>
|
|
<sequential>
|
|
<cpp-install-file
|
|
srcfile="${lib.prefix}@{lib}${lib.ext}"
|
|
srcdir="@{srcdir}"
|
|
destfile="${lib.prefix}@{lib}${lib.ext}@{version}"
|
|
destdir="@{destrootdir}/lib"/>
|
|
<if>
|
|
<os family="windows"/>
|
|
<then>
|
|
<cpp-install-file
|
|
srcfile="${lib.prefix}@{lib}${dll.ext}"
|
|
srcdir="@{srcdir}"
|
|
destfile="${lib.prefix}@{lib}${dll.ext}@{version}"
|
|
destdir="@{destrootdir}/bin"/>
|
|
</then>
|
|
</if>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<!--
|
|
Create a symlink on unix and mac only
|
|
@param lib - library file to install
|
|
@param srclibdir - location of library files to install
|
|
@param destlibdir - Where to install library files
|
|
-->
|
|
<macrodef name="cpp-symlink">
|
|
<attribute name="linkdir" default=""/>
|
|
<attribute name="resourcedir" default="."/>
|
|
<attribute name="link"/>
|
|
<attribute name="resource"/>
|
|
<sequential>
|
|
<if>
|
|
<or>
|
|
<os family="unix"/>
|
|
<os family="mac"/>
|
|
</or>
|
|
<then>
|
|
<mkdir dir="@{linkdir}"/>
|
|
<symlink
|
|
link="@{linkdir}/@{link}"
|
|
resource="@{resourcedir}/@{resource}"
|
|
overwrite="true"/>
|
|
</then>
|
|
</if>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<!--
|
|
Embed the manifest in the library or executable on Windows only
|
|
Uses the Microsoft manifest tool "mt"
|
|
@param dir - the directory where the lib/exe resides
|
|
@param file - the filename with no suffixes or prefixes
|
|
@param outtype - the outtype that's passed to the cc task, used to create the filename
|
|
-->
|
|
<macrodef name="cpp-embed-manifest">
|
|
<attribute name="dir"/>
|
|
<attribute name="file"/>
|
|
<attribute name="outtype"/>
|
|
<sequential>
|
|
<if>
|
|
<os family="windows"/>
|
|
<then>
|
|
<if>
|
|
<equals arg1="@{outtype}" arg2="executable"/>
|
|
<then>
|
|
<property name="file.name" value="@{file}${exe.ext}"/>
|
|
</then>
|
|
</if>
|
|
<property name="file.name" value="${lib.prefix}@{file}${dll.ext}"/>
|
|
|
|
<exec executable="mt">
|
|
<arg line="-manifest @{dir}/${file.name}.manifest -outputresource:@{dir}/${file.name};2"/>
|
|
</exec>
|
|
</then>
|
|
</if>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<!--
|
|
Delete files from a directory, and possible delete the directory
|
|
@param files - space seperated list of files to delete
|
|
@param headerdir - directory where files to delete are
|
|
@param quiet - verbosity, "true" or "false"
|
|
@param rmdir - delete the directory after deleting files, "true" or "false"
|
|
@param custom-delete-elements - anything else you need done additionally
|
|
-->
|
|
<macrodef name="cpp-clean-files">
|
|
<attribute name="files" default="*.*"/>
|
|
<attribute name="dir" default="."/>
|
|
<attribute name="quiet" default="true"/>
|
|
<attribute name="rmdir" default="false"/>
|
|
<element name="custom-delete-elements" optional="true"/>
|
|
<sequential>
|
|
<delete quiet="@{quiet}">
|
|
<fileset dir="@{dir}" includes="@{files}"/>
|
|
</delete>
|
|
<if>
|
|
<equals arg1="@{rmdir}" arg2="true"/>
|
|
<then>
|
|
<delete dir="@{dir}"/>
|
|
</then>
|
|
</if>
|
|
<custom-delete-elements/>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<!--
|
|
Delete a library from a root library directory, and possible delete the directory
|
|
On windows, it will delete both bin/<library>.dll and lib/<library>.lib
|
|
On Unix, it will delete lib/<library>
|
|
@param lib - library to delete
|
|
@param librootdir - directory where the library to delete is located
|
|
@param quiet - verbosity, "true" or "false"
|
|
-->
|
|
<macrodef name="cpp-clean-lib">
|
|
<attribute name="lib"/>
|
|
<attribute name="librootdir"/>
|
|
<attribute name="quiet" default="true"/>
|
|
<attribute name="version" default="${tuscanySDO.library.version}"/>
|
|
<sequential>
|
|
<delete quiet="@{quiet}" file="@{librootdir}/lib/${lib.prefix}@{lib}${lib.ext}@{version}"/>
|
|
<if>
|
|
<os family="windows"/>
|
|
<then>
|
|
<delete quiet="@{quiet}" file="@{librootdir}/bin/${lib.prefix}@{lib}${dll.ext}@{version}"/>
|
|
</then>
|
|
</if>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
</project>
|