You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ro...@apache.org on 2007/07/19 00:11:12 UTC

svn commit: r557413 - in /incubator/tuscany/cpp/sca: antscripts/compile-targets.xml antscripts/compilers.xml antscripts/platform.properties antscripts/system.xml build.xml platform-properties.xml runtime/core/src/build.xml

Author: robbinspg
Date: Wed Jul 18 15:11:11 2007
New Revision: 557413

URL: http://svn.apache.org/viewvc?view=rev&rev=557413
Log:
TUSCANY-1438 Apply Brady's latest patch

tools/TuscanyDriver/build.xml has not been included as it does not work for me

Added:
    incubator/tuscany/cpp/sca/antscripts/system.xml   (with props)
Removed:
    incubator/tuscany/cpp/sca/antscripts/compilers.xml
    incubator/tuscany/cpp/sca/platform-properties.xml
Modified:
    incubator/tuscany/cpp/sca/antscripts/compile-targets.xml
    incubator/tuscany/cpp/sca/antscripts/platform.properties
    incubator/tuscany/cpp/sca/build.xml
    incubator/tuscany/cpp/sca/runtime/core/src/build.xml

Modified: incubator/tuscany/cpp/sca/antscripts/compile-targets.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/antscripts/compile-targets.xml?view=diff&rev=557413&r1=557412&r2=557413
==============================================================================
--- incubator/tuscany/cpp/sca/antscripts/compile-targets.xml (original)
+++ incubator/tuscany/cpp/sca/antscripts/compile-targets.xml Wed Jul 18 15:11:11 2007
@@ -19,8 +19,7 @@
 -->
 <project name='compiler-targets'>
 
-  <property file="./platform.properties"/>
-  <import file="./compilers.xml"/>
+  <import file="./system.xml"/>
 
   <!--
     Do a cpp compilation.
@@ -65,7 +64,7 @@
     <attribute name="outfile" default="out"/>
     <attribute name="outdir" default="."/>
     <attribute name="indir" default="."/>
-    <attribute name="infiles" default="*${object_ext}"/>
+    <attribute name="infiles" default="*${object.ext}"/>
     <attribute name="linktype" default="shared"/>
     <element name="custom-ld-elements" optional="true"/>
     <sequential>
@@ -76,6 +75,40 @@
             <linker refid='${compiler.name}-Linker'/>
             <fileset dir='@{indir}' includes='@{infiles}'/>
             <custom-ld-elements/>
+      </cc>
+
+    </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}'>
+            <compiler refid='${compiler.name}-Compiler'/>
+            <linker refid='${compiler.name}-Linker'/>
+            <fileset dir='@{srcdir}' includes='@{infiles}'/>
+            <custom-build-elements/>
       </cc>
 
     </sequential>

Modified: incubator/tuscany/cpp/sca/antscripts/platform.properties
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/antscripts/platform.properties?view=diff&rev=557413&r1=557412&r2=557413
==============================================================================
--- incubator/tuscany/cpp/sca/antscripts/platform.properties (original)
+++ incubator/tuscany/cpp/sca/antscripts/platform.properties Wed Jul 18 15:11:11 2007
@@ -15,9 +15,9 @@
 #  specific language governing permissions and limitations
 #  under the License.
 
-#platform.compiler-definition=g++-m32
-#platform=rhas4u4_gcc346
-script.ext=
-#lib.ext=.so
-exe.ext=
-#object.ext=.o
+platform.lib.ext=
+platform.exe.ext=
+platform.object.ext=
+platform.tuscanySCA.root.dir=
+platform.tuscanySCA.install.dir=
+platform.tuscanySDO.install.dir=

Added: incubator/tuscany/cpp/sca/antscripts/system.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/antscripts/system.xml?view=auto&rev=557413
==============================================================================
--- incubator/tuscany/cpp/sca/antscripts/system.xml (added)
+++ incubator/tuscany/cpp/sca/antscripts/system.xml Wed Jul 18 15:11:11 2007
@@ -0,0 +1,262 @@
+<?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="system-import">
+
+  <property file="./platform.properties"/>
+  <property environment="env"/>
+
+  <!-- These 3 lines pull in antcontrib and cctasks -->
+  <taskdef resource="net/sf/antcontrib/antlib.xml"/>
+  <taskdef resource="cpptasks.tasks"/>
+  <typedef resource="cpptasks.types"/>
+
+  <!--
+     Configure the tuscanySDO.install.dir, sdo.include.dir, and sdo.lib.dir
+     Take the override value from platform.properties if set
+     Else take it from the env var TUSCANY_SDOCPP
+     Else fail since we cant compile without it
+  -->
+  <if>
+    <isset property="platform.tuscanySDO.install.dir"/>
+    <then>
+      <property name="tuscanySDO.install.dir" location="${platform.tuscanySDO.install.dir}"/>
+    </then>
+    <elseif>
+      <isset property="env.TUSCANY_SDOCPP"/>
+      <then>
+        <property name="tuscanySDO.install.dir" location="${env.TUSCANY_SDOCPP}"/>
+      </then>
+    </elseif>
+    <else>
+      <fail message="Unable to find SDO installation, must be set by TUSCANY_SDOCPP or in platform.properties file"/>
+    </else>
+  </if>
+  <property name="sdo.include.dir" location="${tuscanySDO.install.dir}/include"/>
+  <property name="sdo.lib.dir"     location="${tuscanySDO.install.dir}/lib"/>
+
+  <!--
+     Configure the tuscanySCA.root.dir
+     Take the override value from platform.properties if set
+  -->
+  <if>
+    <isset property="platform.tuscanySCA.root.dir"/>
+    <then>
+      <property name="tuscanySCA.root.dir" location="${platform.tuscanySCA.root.dir}"/>
+    </then>
+    <else>
+      <property name="tuscanySCA.root.dir" location="."/>
+    </else>
+  </if>
+
+  <property name="tuscanySCA.root.src.dir" location="${tuscanySCA.root.dir}/runtime"/>
+
+  <!--
+     Configure the tuscanySCA.install.dir
+     Take the override value from platform.properties if set
+     Else take it from the env var TUSCANY_SCACPP
+     Else use a default of ${tuscanySCA.root.dir}/deploy
+  -->
+  <if>
+    <isset property="platform.tuscanySCA.install.dir"/>
+    <then>
+      <property name="tuscanySCA.install.dir" location="${platform.tuscanySCA.install.dir}"/>
+    </then>
+    <elseif>
+      <isset property="${env.TUSCANY_SCACPP}"/>
+      <then>
+        <property name="tuscanySCA.install.dir" location="${env.TUSCANY_SCACPP}"/>
+      </then>
+    </elseif>
+    <else>
+      <property name="tuscanySCA.install.dir" location="${tuscanySCA.root.dir}/deploy"/>
+    </else>
+  </if>
+
+  <!--
+     Configure the compiler.name
+     Take the override value from platform.properties if set
+     Else set it based on the OS
+  -->
+  <if>
+    <isset property="platform.compiler.name"/>
+    <then>
+      <property name="compiler.name" value="${platform.compiler.name}"/>
+    </then>
+    <else>
+      <condition property="compiler.name" value="msvc">
+        <os family="windows"/>
+      </condition>
+
+      <condition property="compiler.name" value="g++">
+        <or>
+          <os family="unix"/>
+          <os family="mac"/>
+        </or>
+      </condition>
+    </else>
+  </if>
+
+  <!--
+     Configure the lib.ext
+     Take the override value from platform.properties if set
+     Else set it based on the OS
+  -->
+  <if>
+    <isset property="platform.lib.ext"/>
+    <then>
+      <property name="lib.ext" value="${platform.lib.ext}"/>
+    </then>
+    <else>
+      <condition property="lib.ext" value=".dll">
+        <os family="windows"/>
+      </condition>
+
+      <condition property="lib.ext" value=".dylib">
+        <os family="mac"/>
+      </condition>
+
+      <condition property="lib.ext" value=".so">
+        <os family="unix"/>
+      </condition>
+    </else>
+  </if>
+
+  <!--
+     Configure the lib.prefix
+     Take the override value from platform.properties if set
+     Else set it based on the OS
+  -->
+  <if>
+    <isset property="platform.lib.prefix"/>
+    <then>
+      <property name="lib.prefix" value="${platform.lib.prefix}"/>
+    </then>
+    <else>
+      <condition property="lib.prefix" value="">
+        <os family="windows"/>
+      </condition>
+
+      <condition property="lib.prefix" value="lib">
+        <or>
+          <os family="unix"/>
+          <os family="mac"/>
+        </or>
+      </condition>
+    </else>
+  </if>
+
+
+  <!--
+     Configure the object.ext
+     Take the override value from platform.properties if set
+     Else set it based on the OS
+  -->
+  <if>
+    <isset property="platform.object.ext"/>
+    <then>
+      <property name="object.ext" value="${platform.object.ext}"/>
+    </then>
+    <else>
+      <condition property="object.ext" value=".obj">
+        <os family="windows"/>
+      </condition>
+
+      <condition property="object.ext" value=".o">
+        <or>
+          <os family="unix"/>
+          <os family="mac"/>
+        </or>
+      </condition>
+    </else>
+  </if>
+
+
+  <!--
+     Configure the exe.ext
+     Take the override value from platform.properties if set
+     Else set it based on the OS
+  -->
+  <if>
+    <isset property="platform.exe.ext"/>
+    <then>
+      <property name="exe.ext" value="${platform.exe.ext}"/>
+    </then>
+    <else>
+      <condition property="exe.ext" value=".exe">
+        <os family="windows"/>
+      </condition>
+
+      <condition property="exe.ext" value="">
+        <or>
+          <os family="unix"/>
+          <os family="mac"/>
+        </or>
+      </condition>
+    </else>
+  </if>
+
+  <condition property="windows" value="true">
+    <os family="windows"/>
+  </condition>
+
+  <!--
+     Base compiler definition
+    -->
+  <compiler id="Tuscany-BaseCompiler" multithreaded="true" exceptions="true" rtti="true">
+    <defineset if="windows" define="WIN32,_CRT_SECURE_NO_DEPRECATE,SCA_EXPORTS"/>
+    <includepath path="${sdo.include.dir}"/>
+    <includepath path="${tuscanySCA.root.dir}"/> <!-- tuscany_sca_config.h -->
+    <includepath path="${tuscanySCA.root.src.dir}"/>
+    <includepath path="${tuscanySCA.root.src.dir}/core/src"/>
+  </compiler>
+
+  <!--
+     Specific compiler definitions
+    -->
+  <compiler id="msvc-Compiler" extends="Tuscany-BaseCompiler" name="msvc"/>
+  <compiler id="msvc8-Compiler" extends="Tuscany-BaseCompiler" name="msvc" exceptions="false">
+    <compilerarg value="/EHsc"/>
+  </compiler>
+  <compiler id="g++-Compiler" extends="Tuscany-BaseCompiler" name="g++"/>
+ 
+  <!-- Used for cross compilation with the -m32 flag -->
+  <compiler id="g++m32-Compiler" extends="Tuscany-BaseCompiler" name="g++">
+    <compilerarg value="-m32"/>
+  </compiler>
+
+  <!--
+     Base linker definition
+    -->
+  <linker id="Tuscany-BaseLinker">
+    <syslibset if="windows" libs="kernel32,user32,ws2_32"/>
+    <libset dir="${sdo.lib.dir}" libs="tuscany_sdo"/>
+  </linker>
+
+  <!--
+     Specific linker definitions
+    -->
+  <linker id="msvc-Linker" extends="Tuscany-BaseLinker" name="msvc"/>
+  <linker id="msvc8-Linker" extends="Tuscany-BaseLinker" name="msvc"/>
+  <linker id="g++-Linker" extends="Tuscany-BaseLinker" name="g++"/>
+  <linker id="g++m32-Linker" extends="Tuscany-BaseLinker" name="g++">
+    <linkerarg value="-m32"/>
+  </linker>
+
+</project>

Propchange: incubator/tuscany/cpp/sca/antscripts/system.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/antscripts/system.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/cpp/sca/build.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/build.xml?view=diff&rev=557413&r1=557412&r2=557413
==============================================================================
--- incubator/tuscany/cpp/sca/build.xml (original)
+++ incubator/tuscany/cpp/sca/build.xml Wed Jul 18 15:11:11 2007
@@ -27,8 +27,6 @@
     found in the ant subdirectory.
   -->
 
-  <import file="platform-properties.xml"/>
-
   <property name="src.dir" value="runtime/core/src"/>
   <property name="extensions.dir" value="runtime/extensions"/>
  	
@@ -65,10 +63,11 @@
   <!--
     Internal targets
     They can still be called, they're just not described, so wont show up in "ant -p"
+    Using antfile and inheritAll="false" to maintain the subdir build.xml basedir settings
   -->
 
   <target name="compile.core">
-    <ant target="compile" dir="${src.dir}"/>
+    <ant target="compile" antfile="${src.dir}/build.xml" inheritAll="false"/>
   </target>
 
   <target name="compile.extensions">
@@ -76,7 +75,7 @@
   </target>
 
   <target name="link.core">
-    <ant target="link" dir="${src.dir}"/>
+    <ant target="link" antfile="${src.dir}/build.xml" inheritAll="false"/>
   </target>
 
   <target name="link.extensions">
@@ -84,7 +83,7 @@
   </target>
 
   <target name="install.core">
-    <ant target="install" dir="${src.dir}"/>
+    <ant target="install" antfile="${src.dir}/build.xml" inheritAll="false"/>
   </target>
 
   <target name="install.extensions">
@@ -92,7 +91,7 @@
   </target>
 
   <target name="clean.core">
-    <ant target="clean" dir="${src.dir}"/>
+    <ant target="clean" antfile="${src.dir}/build.xml" inheritAll="false"/>
   </target>
 
   <target name="clean.extensions">

Modified: incubator/tuscany/cpp/sca/runtime/core/src/build.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/build.xml?view=diff&rev=557413&r1=557412&r2=557413
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/build.xml (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/build.xml Wed Jul 18 15:11:11 2007
@@ -17,16 +17,28 @@
    specific language governing permissions and limitations
    under the License.
 -->
-<project name="TuscanyScaNative_core" default="all" basedir=".">
-  <import file="../../../platform-properties.xml"/>
-  <import file="${tuscanySCA.antscripts.dir}/compile-targets.xml"/>
-
-  <property name="core.dir"          value="tuscany/sca/core"/>
-  <property name="extension.dir"     value="tuscany/sca/extension"/>
-  <property name="model.dir"         value="tuscany/sca/model"/>
-  <property name="util.dir"          value="tuscany/sca/util"/>
-  <property name="lib.dir"           value="./.libs"/>
-  <property name="tuscany.core.lib"  value="tuscany_sca"/>
+<project name="TuscanyScaNative_core" default="all" basedir="../../..">
+
+  <import file="${basedir}/antscripts/system.xml"/>
+  <import file="${basedir}/antscripts/compile-targets.xml"/>
+
+  <!--
+    Notice that the basedir for this project is set to the TuscanySCA root dir
+    This makes path setting in system.xml much simpler, but we'll just have to
+    set a property here to this directory.
+  -->
+  <property name="this.dir"           location="${basedir}/runtime/core/src"/>
+  <property name="core.dir"           value="tuscany/sca/core"/>
+  <property name="extension.dir"      value="tuscany/sca/extension"/>
+  <property name="model.dir"          value="tuscany/sca/model"/>
+  <property name="util.dir"           value="tuscany/sca/util"/>
+
+  <property name="core.abs.dir"       location="${this.dir}/${core.dir}"/>
+  <property name="extension.abs.dir"  location="${this.dir}/${extension.dir}"/>
+  <property name="model.abs.dir"      location="${this.dir}/${model.dir}"/>
+  <property name="util.abs.dir"       location="${this.dir}/${util.dir}"/>
+  <property name="lib.dir"            location="${this.dir}/.libs"/>
+  <property name="tuscany.core.lib"   value="tuscany_sca"/>
 
   <!--
     All the cpp and header files per subdirectory
@@ -91,7 +103,7 @@
     <antcall target="install.model"/>
     <antcall target="install.util"/>
     <cpp-install-headers
-        srcdir="tuscany/sca"
+        srcdir="${this.dir}/tuscany/sca"
         files="export.h"
         destdir="${tuscanySCA.install.dir}/include/tuscany/sca"/>
     <cpp-install-lib
@@ -101,12 +113,19 @@
   </target>
 
   <target name="clean" description="Clean all TuscanyScaNative core compiled source code">
-    <delete dir="${lib.dir}"/>
-    <!-- delete installed lib and dir -->
     <antcall target="clean.core"/>
     <antcall target="clean.extension"/>
     <antcall target="clean.model"/>
     <antcall target="clean.util"/>
+    <delete dir="${lib.dir}" quiet="true"/>
+    <delete
+        quiet="true"
+        dir="${tuscanySCA.install.dir}/include/tuscany/sca"
+        file="export.h"/>
+    <delete
+        quiet="true"
+        dir="${tuscanySCA.install.dir}/lib"
+        file="${lib.prefix}${tuscany.core.lib}${lib.ext}"/>
   </target>
 
   <!--
@@ -118,28 +137,28 @@
 
   <target name="compile.core">
     <cpp-compile
-        srcdir="${core.dir}"
+        srcdir="${core.abs.dir}"
         objdir="${lib.dir}"
         infiles="${core.cpp.files}"/>
   </target>
 
   <target name="compile.extension">
     <cpp-compile
-        srcdir="${extension.dir}"
+        srcdir="${extension.abs.dir}"
         objdir="${lib.dir}"
         infiles="${extension.cpp.files}"/>
   </target>
 
   <target name="compile.model">
     <cpp-compile
-        srcdir="${model.dir}"
+        srcdir="${model.abs.dir}"
         objdir="${lib.dir}"
         infiles="${model.cpp.files}"/>
   </target>
 
   <target name="compile.util">
     <cpp-compile
-        srcdir="${util.dir}"
+        srcdir="${util.abs.dir}"
         objdir="${lib.dir}"
         infiles="${util.cpp.files}"/>
   </target>
@@ -148,28 +167,28 @@
 
   <target name="install.core">
     <cpp-install-headers
-        srcdir="${core.dir}"
+        srcdir="${core.abs.dir}"
         files="${core.h.files}"
         destdir="${tuscanySCA.install.dir}/include/${core.dir}"/>
   </target>
 
   <target name="install.extension">
     <cpp-install-headers
-        srcdir="${extension.dir}"
+        srcdir="${extension.abs.dir}"
         files="${extension.h.files}"
         destdir="${tuscanySCA.install.dir}/include/${extension.dir}"/>
   </target>
 
   <target name="install.model">
     <cpp-install-headers
-        srcdir="${model.dir}"
+        srcdir="${model.abs.dir}"
         files="${model.h.files}"
         destdir="${tuscanySCA.install.dir}/include/${model.dir}"/>
   </target>
 
   <target name="install.util">
     <cpp-install-headers
-        srcdir="${util.dir}"
+        srcdir="${util.abs.dir}"
         files="${util.h.files}"
         destdir="${tuscanySCA.install.dir}/include/${util.dir}"/>
   </target>
@@ -177,19 +196,35 @@
     <!-- clean -->
 
   <target name="clean.core">
-    <!-- delete installed headers -->
+    <delete quiet="true">
+      <fileset
+          dir="${tuscanySCA.install.dir}/include/${core.dir}"
+          includes="${core.h.files}"/>
+    </delete>
   </target>
 
   <target name="clean.extension">
-    <!-- delete installed headers -->
+    <delete quiet="true">
+      <fileset
+          dir="${tuscanySCA.install.dir}/include/${extension.dir}"
+          includes="${extension.h.files}"/>
+    </delete>
   </target>
 
   <target name="clean.model">
-    <!-- delete installed headers -->
+    <delete quiet="true">
+      <fileset
+          dir="${tuscanySCA.install.dir}/include/${model.dir}"
+          includes="${model.h.files}"/>
+    </delete>
   </target>
 
   <target name="clean.util">
-    <!-- delete installed headers -->
+    <delete quiet="true">
+      <fileset
+          dir="${tuscanySCA.install.dir}/include/${util.dir}"
+          includes="${util.h.files}"/>
+    </delete>
   </target>
 
 </project>



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org