ETCH-245 Refactoring of ant/CMake build system of cpp-binding

Introduction of toolchain files

Change-Id: Ieaa654df10a20ce6cc69a3438b37c690b9e140a9

git-svn-id: https://svn.apache.org/repos/asf/incubator/etch/trunk@1400861 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/binding-cpp/runtime/CMakeLists.txt b/binding-cpp/runtime/CMakeLists.txt
index 844b9f7..460f877 100644
--- a/binding-cpp/runtime/CMakeLists.txt
+++ b/binding-cpp/runtime/CMakeLists.txt
@@ -33,6 +33,11 @@
   MESSAGE (FATAL_ERROR "ETCH_EXTERNAL_DEPENDS not set")

 ENDIF (NOT ETCH_EXTERNAL_DEPENDS)

 

+# Check Toolchain file
+IF (NOT CMAKE_TOOLCHAIN_FILE)
+  MESSAGE (FATAL_ERROR "CMAKE_TOOLCHAIN_FILE not set")
+ENDIF (NOT CMAKE_TOOLCHAIN_FILE)
+
 #VLD

 SET(VLD ${ETCH_EXTERNAL_DEPENDS}/vld/1.9h)

 

@@ -47,15 +52,7 @@
 SET(CAPU_CMAKE_BUILD_DIR "${CAPU_PROJECT_DIR}/build")
 SET(CAPU_CMAKE_TOOLCHAIN_DIR "${CAPU_PROJECT_DIR}/cmake/acme/toolchain")
 SET(CAPU_DELIVERABLE_DIR "${CAPU_PROJECT_DIR}/deliverable")
-IF(UNIX)
-  SET(CAPU_CMAKE_TOOLCHAIN_FILE "Linux_X86_32.toolchain")
-  add_definitions("-DOS_LINUX")
-  add_definitions("-DARCH_X86_32")
-ELSEIF(WIN32)
-  SET(CAPU_CMAKE_TOOLCHAIN_FILE "Windows_X86_32.toolchain")
-  add_definitions("-DOS_WINDOWS")
-  add_definitions("-DARCH_X86_32")
-ENDIF()
+
 
 include(ExternalProject)
 ExternalProject_Add(
@@ -64,7 +61,7 @@
   BINARY_DIR "${CAPU_CMAKE_BUILD_DIR}"
   DOWNLOAD_COMMAND ""
   UPDATE_COMMAND ""
-  CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE:PATH=${CAPU_CMAKE_TOOLCHAIN_DIR}/${CAPU_CMAKE_TOOLCHAIN_FILE}
+  CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE}
              -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
 )
 
@@ -73,9 +70,9 @@
 
 
 # Set definitions

-IF (UNIX)

+IF (TARGET_OS STREQUAL "Linux")
   add_definitions (-D_GNU_SOURCE -D_REENTRANT -DLINUX=2 -D__LINUX__)

-ENDIF (UNIX)

+ENDIF ()
 add_definitions (-D_UNICODE -DUNICODE)

 

 # etch libary

diff --git a/binding-cpp/runtime/build.properties b/binding-cpp/runtime/build.properties
new file mode 100644
index 0000000..9e7fb66
--- /dev/null
+++ b/binding-cpp/runtime/build.properties
@@ -0,0 +1,15 @@
+#Set the platforms which should be build by running ant
+
+
+#target.platforms=Windows_X86_32, QNX_X86_32
+#target.platforms.Windows_X86_32.generator=Visual Studio 8 2005
+#target.platforms.QNX_X86_32.generator=Unix Makefiles
+
+#preventing execution of tests
+#target.platforms.QNX_X86_32.crosscompile=1
+
+
+#target.platforms=Linux_X86_32, Linux_ARMv7l
+#target.platforms.Linux_X86_32.generator=Unix Makefiles
+#target.platforms.Linux_ARMv7l.generator=Unix Makefiles
+#target.platforms.Linux_ARMv7l.crosscompile=1
diff --git a/binding-cpp/runtime/build.xml b/binding-cpp/runtime/build.xml
index 766e12f..faf1098 100644
--- a/binding-cpp/runtime/build.xml
+++ b/binding-cpp/runtime/build.xml
@@ -20,6 +20,13 @@
 <project name="etch-cpp-runtime" basedir="." default="help">

     <description>Etch-to-CPP runtime binding implementation</description>

     <property name="Etch.basedir" location="${basedir}/../.." />

+
+    <property file="build.properties"/>
+
+    <!-- import custom rules which can be used by depending projects to override ant targets -->
+    <import file="custom_rules.xml" optional="true" />
+
+    <!-- import etch generics -->
     <import file="${Etch.basedir}/build-support/etch.includes.xml" />

 

     <!-- Static properties of the sub-project -->

@@ -30,19 +37,73 @@
     <!-- INIT TARGET -->

     <!-- Modify this target to define project specific properties that can only be set at runtime -->

     <target name="do-init" >

-        <mkdir dir="${target}" />

-        <mkdir dir="${testResultsDirectory}" />

+        <property name="target_platform"                location="${target}/${platform}"/>
+        <property name="testResultsDirectory_platform"  location="${testResultsDirectory}/${platform}"/>
+        <echo>${target_platform} created</echo>
+        <mkdir dir="${target_platform}" />
+        <mkdir dir="${testResultsDirectory_platform}" />
     </target>

 

     <!-- CLEAN TARGET -->

     <target name="do-clean">

         <delete dir="${target}" />

-    <delete dir="${proj}/lib/capu/3psw/libs" />
-    <delete dir="${proj}/lib/capu/build" />
-    <delete dir="${proj}/lib/capu/deliverable" />
+        <delete dir="${proj}/lib/capu/3psw/libs" />
+        <delete dir="${proj}/lib/capu/build" />
+        <delete dir="${proj}/lib/capu/deliverable" />
+    </target>
+
+    <target name="do-clean-capu">
+        <delete dir="${proj}/lib/capu/build" />
+        <delete dir="${proj}/lib/capu/deliverable" />
     </target>

 

     <!-- BUILD TARGET -->

+
+    <!-- overriding build target from etch.include.xml -->
+    <target name="build" depends="">
+        <!-- Build platform targets -->
+        <if>
+            <not><isset property="${target.platforms}"/></not>
+            <then>
+                <echo level="warn">No target.platforms set. Trying to build for detected host platform...</echo>
+                    <if>
+                        <os family="windows" />
+                        <then>
+                            <property name="target.platforms" value="Windows_X86_32"/>
+                        </then>
+                    </if>
+                    <if>
+                        <os family="unix" />
+                        <then>
+                            <property name="target.platforms" value="Linux_X86_32"/>
+                        </then>
+                    </if>
+            </then>
+        </if>
+        
+        <if>
+            <equals arg1="${target.platforms}" arg2=""/>
+            <then>
+                <echo>${target.platforms}</echo>
+                <fail message="Not able to detect platform. target.platforms is not set. Aborting."/>
+            </then>
+        </if>
+        <for list="${target.platforms}" param="platform" delimiter="," trim="true">
+            <sequential>
+                <var  name="platform" value="@{platform}"/>
+                <echo>Init platform: ${platform}</echo>
+                <antcall target="init"/>
+                <echo>Building platform: ${platform}</echo>
+                <antcall target="do-build"/>
+                <echo>Testing platform: ${platform}</echo>
+                <antcall target="do-test"/>
+                <!-- TODO remove this as soon as ACME in capu is able to build multiple targets -->
+                <antcall target="do-clean-capu"/>
+            </sequential>
+        </for>
+
+    </target>
+
     <target name="do-build-info" unless="USE.cmake">

         <echo message="**********************************" />

         <echo message="binding-cpp build will not be done." />

@@ -61,17 +122,32 @@
         </zip>

     </target>

 

-    <!-- Uncomment the generator you would like to use on your platform. If no generator is set explicitly the default generator will be used. -->

     <target name="do-build-main" if="USE.cmake">

-        <echo>"${basedir}/target"</echo>
-        <cmake srcdir="${basedir}" bindir="${basedir}/target" buildtype="Debug" >

-            <!--<generator name="Visual Studio 8 2005" platform="windows" />-->

-            <!--<generator name="Visual Studio 9 2008" platform="windows" />-->

-            <!--<generator name="Visual Studio 10 2010" platform="windows" />-->

-            <!--<generator name="Unix Makefiles"/>-->

-            <!--<generator name="Eclipse CDT4 - Unix Makefiles" platform="Linux" />-->

-            <variable name="ETCH_EXTERNAL_DEPENDS" type="PATH" value="${env.ETCH_EXTERNAL_DEPENDS}" />

-        </cmake>

+        <if>
+            <isset property="target.platforms.${platform}.generator"/>
+            <then>
+                <!-- use specified generator -->
+                <propertycopy name="cmake.generator" from="target.platforms.${platform}.generator" />
+                <echo>Configuring CMake build</echo>
+                <echo>Using generator: ${cmake.generator}</echo>
+                <echo>Using toolchain file: ${basedir}/toolchains/${platform}.toolchain</echo>
+                <cmake srcdir="${basedir}" bindir="${target}/${platform}/${Etch.build.target}" buildtype="${Etch.build.target}" >
+                    <generator name="${cmake.generator}" />
+                    <variable name="ETCH_EXTERNAL_DEPENDS" type="PATH" value="${env.ETCH_EXTERNAL_DEPENDS}" />
+                    <variable name="CMAKE_TOOLCHAIN_FILE" type="FILEPATH" value="${basedir}/toolchains/${platform}.toolchain" />
+                </cmake>
+            </then>
+            <else>
+                <!-- try default generator -->
+                <echo>Configuring CMake build</echo>
+                <echo>Using default generator</echo>
+                <echo>Using toolchain file: ${basedir}/toolchains/${platform}.toolchain</echo>
+                <cmake srcdir="${basedir}" bindir="${target}/${platform}/${Etch.build.target}" buildtype="${Etch.build.target}" >
+                    <variable name="ETCH_EXTERNAL_DEPENDS" type="PATH" value="${env.ETCH_EXTERNAL_DEPENDS}" />
+                    <variable name="CMAKE_TOOLCHAIN_FILE" type="FILEPATH" value="${basedir}/toolchains/${platform}.toolchain" />
+                </cmake>
+            </else>
+        </if>
     </target>

 

     <target name="do-build" depends="do-build-info,do-build-generate-sources,do-build-main" if="USE.cmake">

@@ -87,11 +163,43 @@
             </fileset>

         </copy>

 

+        <property name="capu.library.output.path.prefix" value="${proj}/lib/capu/deliverable/capu/lib/${platform}"/>
+        <property name="capu.binary.output.path.prefix" value="${proj}/lib/capu/deliverable/capu/bin/${platform}"/>
+        <property name="etch.library.output.path.prefix" value="${target}/${platform}/${Etch.build.target}/src/main"/>
+        <property name="etch.binary.output.path.prefix" value="${target}/${platform}/${Etch.build.target}/src/test"/>
+
+        <if>
+            <!-- Visual Studio adds the Debug/Release folder, other generators do not -->
+            <equals arg1="${platform}" arg2="Windows_X86_32" />
+            <then>
+                <property name="capu.library.output.path" value="${capu.library.output.path.prefix}/${Etch.build.target}" />
+                <property name="capu.binary.output.path" value="${capu.binary.output.path.prefix}/${Etch.build.target}" />
+                <property name="etch.library.output.path" value="${etch.library.output.path.prefix}/${Etch.build.target}" />
+                <property name="etch.binary.output.path" value="${etch.binary.output.path.prefix}/${Etch.build.target}" />
+            </then>
+            <else>
+                <property name="capu.library.output.path" value="${capu.library.output.path.prefix}" />
+                <property name="capu.binary.output.path" value="${capu.binary.output.path.prefix}" />
+                <property name="etch.library.output.path" value="${etch.library.output.path.prefix}" />
+                <property name="etch.binary.output.path" value="${etch.binary.output.path.prefix}" />
+            </else>
+        </if>
+        
         <!-- copy etch library to dist folder -->
-        <copy todir="${Etch.dist}/binding-cpp/lib" flatten="true">

-            <fileset dir="${target}/src/main">

-            </fileset>

-        </copy>

+        <copy todir="${Etch.dist}/binding-cpp/lib/${platform}/${Etch.build.target}" flatten="true">
+            <fileset dir="${etch.library.output.path}">
+                <include name="*.lib" />
+                <include name="*.a" />
+            </fileset>
+        </copy>
+        
+        <!-- copy etch tests to dist folder -->
+        <copy todir="${Etch.dist}/binding-cpp/bin/${platform}/${Etch.build.target}" flatten="true">
+            <fileset dir="${etch.binary.output.path}">
+                <include name="etch-cpp-test.exe" />
+                <include name="etch-cpp-test" />
+            </fileset>
+        </copy>
         
         <!-- copy capu includes to dist folder -->
         <copy todir="${Etch.dist}/binding-cpp/include">
@@ -101,43 +209,61 @@
         </copy>
     
         <!-- copy capu lib to dist folder -->
-        <copy todir="${Etch.dist}/binding-cpp/lib">
-            <fileset dir="${proj}/lib/capu/deliverable/capu/lib">
-                <include name="**/*.lib" />
-		<include name="**/*.a" />
+        <copy todir="${Etch.dist}/binding-cpp/lib/${platform}/${Etch.build.target}">
+            <fileset dir="${capu.library.output.path}">
+                <include name="*.lib" />
+                <include name="*.a" />
             </fileset>
         </copy>
-

+        
+        <!-- copy capu tests to dist folder -->
+        <copy todir="${Etch.dist}/binding-cpp/bin/${platform}/${Etch.build.target}">
+            <fileset dir="${capu.binary.output.path}">
+            <include name="capuTest.exe" />
+                <include name="capuTest" />
+            </fileset>

+        </copy>

     </target>

 

     <!-- TEST TARGET -->

-    <target name="do-test" unless="build.skip.tests">

-

-        <!-- Run CAPU Unit Tests -->

-        <!-- Run CAPU Unit Tests on Windows-->

-        <property name="executable-full-path"

-            location="lib/capu/deliverable/capu/bin/Windows_X86_32/Debug/capuTest.exe"/>
-        <exec executable="${executable-full-path}" osfamily="windows" failonerror="true">
-            <arg value="--gtest_output=xml:${testResultsDirectory}/"/>

-        </exec>

-        <!-- Run CAPU Unit Tests on Unix -->

-        <exec executable="lib/capu/deliverable/capu/bin/Linux_X86_32/capuTest" osfamily="unix"  failonerror="true">
-            <arg value="--gtest_output=xml:${testResultsDirectory}/"/>

-        </exec>

-    

-        <!-- Run Etch Unit Tests -->

-        <!-- Run Etch Unit Tests on Windows-->

-        <exec executable="${target}/src/test/debug/etch-cpp-test" osfamily="windows"  failonerror="true">
-            <arg value="--gtest_output=xml:${testResultsDirectory}/"/>

-        </exec>

-        <!-- Run Etch Unit Tests on Unix -->

-        <exec executable="${target}/src/test/etch-cpp-test" osfamily="unix"  failonerror="true">
-            <arg value="--gtest_output=xml:${testResultsDirectory}/"/>

-        </exec>

+    <target name="test" depends="postbuild">
+        
     </target>

 

-    <!-- POSTBUILD TARGET -->

-    <target name="do-postbuild">

+    <target name="postbuild" depends="build,do-postbuild">
+        
+    </target>
+  
+    <target name="do-test" unless="build.skip.tests">
+        <if>
+            <isset property="target.platforms.${platform}.crosscompile"/>
+            <then>
+                <echo>Not executing tests for cross compiled platform</echo>
+            </then>
+            <else>
+                <!-- Run CAPU Unit Tests -->
+                <!-- Run CAPU Unit Tests on Windows-->
+                <property name="executable-full-path"
+                    location="lib/capu/deliverable/capu/bin/Windows_X86_32/${Etch.build.target}/capuTest.exe"/>
+                <exec executable="${executable-full-path}" osfamily="windows" failonerror="true">
+                    <arg value="--gtest_output=xml:${testResultsDirectory}/"/>
+                </exec>
+                <!-- Run CAPU Unit Tests on Unix -->
+                <exec executable="lib/capu/deliverable/capu/bin/Linux_X86_32/capuTest" osfamily="unix"  failonerror="true">
+                    <arg value="--gtest_output=xml:${testResultsDirectory}/"/>
+                </exec>
+            
+                <!-- Run Etch Unit Tests -->
+                <!-- Run Etch Unit Tests on Windows-->
+                <exec executable="${target}/${platform}/${Etch.build.target}/src/test/${Etch.build.target}/etch-cpp-test" osfamily="windows"  failonerror="true">
+                    <arg value="--gtest_output=xml:${testResultsDirectory}/"/>
+                </exec>
+                <!-- Run Etch Unit Tests on Unix -->
+                <exec executable="${target}/${platform}/${Etch.build.target}/src/test/etch-cpp-test" osfamily="unix"  failonerror="true">
+                    <arg value="--gtest_output=xml:${testResultsDirectory}/"/>
+                </exec>
+            </else>
+        </if>
     </target>

 

     <target name="do-publish" if="build.tests.fail">

diff --git a/binding-cpp/runtime/lib/capu/cmake/acme/toolchain/QNX_X86.toolchain b/binding-cpp/runtime/lib/capu/cmake/acme/toolchain/QNX_X86_32.toolchain
similarity index 100%
rename from binding-cpp/runtime/lib/capu/cmake/acme/toolchain/QNX_X86.toolchain
rename to binding-cpp/runtime/lib/capu/cmake/acme/toolchain/QNX_X86_32.toolchain
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/StringUtils.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/StringUtils.inc
index 3973609..c1847b5 100644
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/StringUtils.inc
+++ b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/StringUtils.inc
@@ -23,5 +23,5 @@
 #elif defined(OS_INTEGRITY)
     #include "Linux/StringUtils.inc"

 #elif defined(OS_QNX)
-    #include "Qnx/StringUtils.inc"
+    #include "Linux/StringUtils.inc"
 #endif
\ No newline at end of file
diff --git a/binding-cpp/runtime/src/main/CMakeLists.txt b/binding-cpp/runtime/src/main/CMakeLists.txt
index 766929c..badcb09 100644
--- a/binding-cpp/runtime/src/main/CMakeLists.txt
+++ b/binding-cpp/runtime/src/main/CMakeLists.txt
@@ -239,17 +239,10 @@
     ${MAIN_INCLUDES}
 )
 
-IF (UNIX)
-  #TODO: add correct lib here debug / release
-  target_link_libraries (etch-cpp ${CAPU}/lib/Linux_X86_32/libcapu.a)
-ELSEIF(WIN32)
-  #TODO: add correct lib here debug / release
-  target_link_libraries (etch-cpp ${CAPU}/lib/windows_x86_32/debug/capu.lib)
-ENDIF()
 
-IF (UNIX)
+IF (TARGET_OS STREQUAL "Linux")
   set_target_properties (etch-cpp PROPERTIES COMPILE_FLAGS "-m32 -g" LINK_FLAGS "-m32")
-ENDIF (UNIX)
+ENDIF ()
 
 set_target_properties (etch-cpp PROPERTIES OUTPUT_NAME "etch")
 
diff --git a/binding-cpp/runtime/src/test/CMakeLists.txt b/binding-cpp/runtime/src/test/CMakeLists.txt
index a8a77aa..af9160d 100644
--- a/binding-cpp/runtime/src/test/CMakeLists.txt
+++ b/binding-cpp/runtime/src/test/CMakeLists.txt
@@ -24,10 +24,19 @@
 include_directories (${CAPU}/include/capu)
 
 
-IF (WIN32 AND BUILD_CHECK_MEMORY)
+IF (TARGET_OS STREQUAL "Windows" AND BUILD_CHECK_MEMORY)
   include_directories (${VLD}/include)
   add_definitions (-DBUILD_CHECK_MEMORY)
-ENDIF (WIN32 AND BUILD_CHECK_MEMORY)
+ENDIF ()
+
+IF (TARGET_OS STREQUAL "Linux")
+  link_directories(${CAPU}/lib/Linux_X86_32)
+ELSEIF(TARGET_OS STREQUAL "Windows")
+  link_directories(${CAPU}/lib/Windows_X86_32)
+ELSEIF(TARGET_OS STREQUAL "QNX")
+  link_directories(${CAPU}/lib/QNX_X86_32)
+ENDIF()
+
 
 add_executable (etch-cpp-test
     common/EtchNumberTest.cpp
@@ -100,22 +109,24 @@
     main.cpp
 )
 
-IF (UNIX)
-  target_link_libraries (etch-cpp-test etch-cpp pthread rt)
-ELSEIF(WIN32)
-  target_link_libraries (etch-cpp-test etch-cpp)
+IF (TARGET_OS STREQUAL "Linux")
+  target_link_libraries (etch-cpp-test etch-cpp capu pthread rt)
+ELSEIF(TARGET_OS STREQUAL "Windows")
+  target_link_libraries (etch-cpp-test etch-cpp capu)
+ELSEIF(TARGET_OS STREQUAL "QNX")
+  target_link_libraries (etch-cpp-test etch-cpp capu c socket)
 ENDIF()
 
-IF (WIN32 AND BUILD_CHECK_MEMORY)
+IF (TARGET_OS STREQUAL "Windows" AND BUILD_CHECK_MEMORY)
   file (COPY ${VLD}/vld.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE})
   file (COPY ${VLD}/bin/dbghelp.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE})
   file (COPY ${VLD}/bin/vld.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE})
 
   target_link_libraries (etch-cpp-test ${VLD}/lib/vld.lib)
-ENDIF (WIN32 AND BUILD_CHECK_MEMORY)
+ENDIF ()
 
-IF (UNIX)
+IF (TARGET_OS STREQUAL "Linux")
   set_target_properties (etch-cpp-test PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
-ENDIF (UNIX)
+ENDIF ()
 
-add_dependencies (etch-cpp Capu)
+add_dependencies (etch-cpp-test etch-cpp Capu)
diff --git a/binding-cpp/runtime/toolchains/Linux_ARMv7l.toolchain b/binding-cpp/runtime/toolchains/Linux_ARMv7l.toolchain
new file mode 100644
index 0000000..e064624
--- /dev/null
+++ b/binding-cpp/runtime/toolchains/Linux_ARMv7l.toolchain
@@ -0,0 +1,41 @@
+#
+# 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. 
+#
+
+SET(CMAKE_SYSTEM_NAME Linux)
+SET(CMAKE_SYSTEM_VERSION 1)
+
+SET(TARGET_OS Linux)
+SET(TARGET_ARCH ARMV7L)
+SET(TARGET_COMPILER GCC)
+
+SET(CMAKE_C_COMPILER /opt/pb-a8/cross/armv7a/bin/arm-angstrom-linux-gnueabi-gcc)
+SET(CMAKE_CXX_COMPILER /opt/pb-a8/cross/armv7a/bin/arm-angstrom-linux-gnueabi-g++)
+SET(CMAKE_LINKER /opt/pb-a8/cross/armv7a/bin/arm-angstrom-linux-gnueabi-ld)
+
+SET(CMAKE_C_FLAGS_DEBUG "-ggdb -march=armv7-a -mfpu=neon -mfloat-abi=softfp -D_DEBUG")
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
+
+SET(CMAKE_C_FLAGS_RELEASE "-O3 -march=armv7-a -mfpu=neon -mfloat-abi=softfp -DNDEBUG")
+SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
+
+SET(CMAKE_FIND_ROOT_PATH /opt/pb-a8/staging/armv7a-angstrom-linux-gnueabi)
+
+SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+
+add_definitions("-DOS_LINUX")
+add_definitions("-DARCH_ARMV7L")
diff --git a/binding-cpp/runtime/toolchains/Linux_X86_32.toolchain b/binding-cpp/runtime/toolchains/Linux_X86_32.toolchain
new file mode 100644
index 0000000..5bd29a7
--- /dev/null
+++ b/binding-cpp/runtime/toolchains/Linux_X86_32.toolchain
@@ -0,0 +1,32 @@
+#
+# 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. 
+#
+
+SET(CMAKE_SYSTEM_NAME Linux)
+SET(CMAKE_SYSTEM_VERSION 1)
+
+SET(TARGET_OS Linux)
+SET(TARGET_ARCH X86_32)
+SET(TARGET_COMPILER GCC)
+
+SET(CMAKE_C_FLAGS_DEBUG "-m32 -ggdb -Wall -D_DEBUG")
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
+
+SET(CMAKE_C_FLAGS_RELEASE "-m32 -Wall -O3 -DNDEBUG")
+SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
+
+add_definitions("-DOS_LINUX")
+add_definitions("-DARCH_X86_32")
diff --git a/binding-cpp/runtime/toolchains/Linux_X86_64.toolchain b/binding-cpp/runtime/toolchains/Linux_X86_64.toolchain
new file mode 100644
index 0000000..d544f05
--- /dev/null
+++ b/binding-cpp/runtime/toolchains/Linux_X86_64.toolchain
@@ -0,0 +1,32 @@
+#
+# 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. 
+#
+
+SET(CMAKE_SYSTEM_NAME Linux)
+SET(CMAKE_SYSTEM_VERSION 1)
+
+SET(TARGET_OS Linux)
+SET(TARGET_ARCH X86_64)
+SET(TARGET_COMPILER GCC)
+
+SET(CMAKE_C_FLAGS_DEBUG "-m64 -ggdb -Wall -D_DEBUG")
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
+
+SET(CMAKE_C_FLAGS_RELEASE "-m64 -Wall -O3 -DNDEBUG")
+SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
+
+add_definitions("-DOS_LINUX")
+add_definitions("-DARCH_X86_64")
diff --git a/binding-cpp/runtime/lib/capu/cmake/acme/toolchain/QNX_X86.toolchain b/binding-cpp/runtime/toolchains/QNX_X86_32.toolchain
similarity index 100%
copy from binding-cpp/runtime/lib/capu/cmake/acme/toolchain/QNX_X86.toolchain
copy to binding-cpp/runtime/toolchains/QNX_X86_32.toolchain
diff --git a/binding-cpp/runtime/toolchains/Windows_X86_32.toolchain b/binding-cpp/runtime/toolchains/Windows_X86_32.toolchain
new file mode 100644
index 0000000..ee9f567
--- /dev/null
+++ b/binding-cpp/runtime/toolchains/Windows_X86_32.toolchain
@@ -0,0 +1,36 @@
+#
+# 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. 
+#
+
+SET(CMAKE_SYSTEM_NAME Windows)
+SET(CMAKE_SYSTEM_VERSION 1)
+
+SET(TARGET_OS Windows)
+SET(TARGET_ARCH X86_32)
+SET(TARGET_COMPILER MSVC)
+
+SET(CMAKE_C_FLAGS_RELEASE "/MD /O2 /Ob2 /DNDEBUG /MP8 /GR-")
+SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /W3")
+
+SET(CMAKE_C_FLAGS_DEBUG "/MDd /Zi /Od /RTC1 /D_DEBUG /MP8" )
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /W3")
+
+
+add_definitions("-DOS_WINDOWS")
+add_definitions("-DARCH_X86_32")
+
+# enable the BUILD_CHECK_MEMORY flag if you would like to check for memory leaks with visual leak detector
+#add_definitions("-DBUILD_CHECK_MEMORY")
diff --git a/binding-cpp/runtime/toolchains/Windows_X86_64.toolchain b/binding-cpp/runtime/toolchains/Windows_X86_64.toolchain
new file mode 100644
index 0000000..ad07010
--- /dev/null
+++ b/binding-cpp/runtime/toolchains/Windows_X86_64.toolchain
@@ -0,0 +1,36 @@
+#
+# 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. 
+#
+
+SET(CMAKE_SYSTEM_NAME Windows)
+SET(CMAKE_SYSTEM_VERSION 1)
+
+SET(TARGET_OS Windows)
+SET(TARGET_ARCH X86_64)
+SET(TARGET_COMPILER MSVC)
+
+SET(CMAKE_C_FLAGS_RELEASE "/MD /O2 /Ob2 /DNDEBUG /MP8 /GR-")
+SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /W3")
+
+SET(CMAKE_C_FLAGS_DEBUG "/MDd /Zi /Od /RTC1 /D_DEBUG /MP8" )
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /W3")
+
+
+add_definitions("-DOS_WINDOWS")
+add_definitions("-DARCH_X86_64")
+
+# enable the BUILD_CHECK_MEMORY flag if you would like to check for memory leaks with visual leak detector
+#add_definitions("-DBUILD_CHECK_MEMORY")
diff --git a/build-support/dependencies.xml b/build-support/dependencies.xml
index 723c49c..d205b76 100644
--- a/build-support/dependencies.xml
+++ b/build-support/dependencies.xml
@@ -126,12 +126,33 @@
     </target>
 
     <target name="check-cmake-check">
-    <echo message="check: ${build.ant-cmake.lib}" />
+        <echo message="check: ${build.ant-cmake.lib}" />
         <condition property="cmake-missing-components" value="true">
             <not><available file="${build.ant-cmake.lib}/cmakeant.jar" /></not>
         </condition>
     </target>
+    
+    <target name="check-ant-contrib" depends="check-ant-contrib-check" if="ant-contrib-missing-components">
+         <echo>
+              *
+              *
+              *
+              ************************************************************************
+              WARNING: ant-contrib.lib is missing, some ant scripts will not work
+              ************************************************************************
+              *
+              *
+              *
+         </echo>
+    </target>
 
-    <target name="check-all" depends="check-javacc,check-junit,check-velocity,check-dotnet,check-cmake" />
+    <target name="check-ant-contrib-check">
+        <echo message="check: ${build.ant-contrib.lib}" />
+        <condition property="ant-contrib-missing-components" value="true">
+            <not><available file="${build.ant-contrib.lib}/ant-contrib-1.0b3.jar" /></not>
+        </condition>
+    </target>
+
+    <target name="check-all" depends="check-javacc,check-junit,check-velocity,check-dotnet,check-cmake,check-ant-contrib" />
 
 </project>
diff --git a/build-support/etch.common.xml b/build-support/etch.common.xml
index 9412238..3f1b746 100644
--- a/build-support/etch.common.xml
+++ b/build-support/etch.common.xml
@@ -238,6 +238,7 @@
     <property   name="Etch.dependency.velocity-dep.jar" value="${build.velocity.lib}/velocity-1.7-dep.jar" />
     <property   name="Etch.dependency.ant-dotnet-1.1.jar" value="${build.ant-dotnet.lib}/ant-dotnet-1.1.jar" />
     <property   name="Etch.dependency.ant-cmake.jar" value="${build.ant-cmake.lib}/cmakeant.jar" />
+    <property   name="Etch.dependency.ant-contrib.jar" value="${build.ant-contrib.lib}/ant-contrib-1.0b3.jar" />
 
     <!-- Csharp Support -->
     <condition property="USE.dotnet">
@@ -312,6 +313,9 @@
     <!-- CMake ANT support -->
     <taskdef onerror="report" name="cmake" classname="org.iainhull.ant.CmakeBuilder" classpath="${Etch.dependency.ant-cmake.jar}"/>
 
+    <!-- Ant contrib support -->
+    <taskdef resource="net/sf/antcontrib/antlib.xml" classpath="${Etch.dependency.ant-contrib.jar}"/>
+
     <!-- dependencies -->
     <!-- TODO: remove clover reference if clover-disabled -->
     <path id="Etch.dependencies.jar.paths">
diff --git a/build.dependencies b/build.dependencies
index 6dcfc49..95cc622 100644
--- a/build.dependencies
+++ b/build.dependencies
@@ -39,6 +39,9 @@
 ## CMake ANT support
 ant-cmake.lib=${env.ETCH_EXTERNAL_DEPENDS}/apache-ant-cmake/1.0
 
+## Ant-contrib support
+ant-contrib.lib=${env.ETCH_EXTERNAL_DEPENDS}/ant-contrib/1.0b3
+
 ##
 ## Settings
 ##
diff --git a/compiler/src/main/java/org/apache/etch/compiler/Version.java b/compiler/src/main/java/org/apache/etch/compiler/Version.java
old mode 100644
new mode 100755