You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by ve...@apache.org on 2013/03/25 10:47:07 UTC
svn commit: r1460569 - in /etch/trunk: binding-cpp/runtime/CMakeLists.txt
binding-cpp/runtime/FindCapu.cmake binding-cpp/runtime/build.xml
binding-cpp/runtime/src/main/CMakeLists.txt
binding-cpp/runtime/src/test/CMakeLists.txt scripts/antsetup.bat
Author: veithm
Date: Mon Mar 25 09:47:07 2013
New Revision: 1460569
URL: http://svn.apache.org/r1460569
Log:
ETCH-264 Improving cpp build process
Doing copy to dist folder with CMake now
Change-Id: Ifcbd69d4b7f86453bc722d1bec7d389f41683800
Modified:
etch/trunk/binding-cpp/runtime/CMakeLists.txt
etch/trunk/binding-cpp/runtime/FindCapu.cmake
etch/trunk/binding-cpp/runtime/build.xml
etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt
etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt
etch/trunk/scripts/antsetup.bat
Modified: etch/trunk/binding-cpp/runtime/CMakeLists.txt
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/CMakeLists.txt?rev=1460569&r1=1460568&r2=1460569&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/CMakeLists.txt (original)
+++ etch/trunk/binding-cpp/runtime/CMakeLists.txt Mon Mar 25 09:47:07 2013
@@ -57,7 +57,20 @@ IF (TARGET_OS STREQUAL "Linux")
ENDIF ()
add_definitions (-D_UNICODE -DUNICODE)
+#set cmake output variables
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+
# etch libary
add_subdirectory (src/main)
# etch libary tests
add_subdirectory (src/test)
+
+#install capu headers and library
+INSTALL(DIRECTORY ${LIBCAPU_INCLUDE_DIR}/capu DESTINATION "${ETCH_INSTALL_DIR}/include")
+INSTALL(DIRECTORY ${LIBCAPU_LIBRARY_DIR} DESTINATION "${ETCH_INSTALL_DIR}/lib/${ETCH_TARGET_PLATFORM}")
+IF (NOT ${LIBCAPU_BINARY_DIR} STREQUAL "")
+ INSTALL(DIRECTORY ${LIBCAPU_BINARY_DIR} DESTINATION "${ETCH_INSTALL_DIR}/bin/${ETCH_TARGET_PLATFORM}" FILES_MATCHING PATTERN "capuTest*" PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ)
+ENDIF()
+
Modified: etch/trunk/binding-cpp/runtime/FindCapu.cmake
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/FindCapu.cmake?rev=1460569&r1=1460568&r2=1460569&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/FindCapu.cmake (original)
+++ etch/trunk/binding-cpp/runtime/FindCapu.cmake Mon Mar 25 09:47:07 2013
@@ -35,12 +35,14 @@ IF (NOT DEFINED CAPU_INCLUDE_DIR OR NOT
ExternalProject_Add(
Capu
- GIT_REPOSITORY git://github.com/bmwcarit/capu.git
+ URL https://github.com/bmwcarit/capu/archive/v0.8.1.zip
SOURCE_DIR "${CAPU_PROJECT_DIR}"
BINARY_DIR "${CAPU_CMAKE_BUILD_DIR}"
INSTALL_DIR "${CAPU_PROJECT_DIR}/deliverable"
+ UPDATE_COMMAND ""
CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE}
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
+ INSTALL 1
)
ELSE()
SET(CAPU_PROJECT_DIR "${LOCAL_CAPU_SOURCE_DIR}")
@@ -62,9 +64,11 @@ IF (NOT DEFINED CAPU_INCLUDE_DIR OR NOT
SET(LIBCAPU_INCLUDE_DIR ${CAPU_DELIVERABLE_DIR}/include/Capu)
SET(LIBCAPU_LIBRARY_DIR ${CAPU_DELIVERABLE_DIR}/lib/${TARGET_OS}_${TARGET_ARCH}/${CMAKE_BUILD_TYPE})
+ SET(LIBCAPU_BINARY_DIR ${CAPU_DELIVERABLE_DIR}/bin/${TARGET_OS}_${TARGET_ARCH}/${CMAKE_BUILD_TYPE})
ELSE()
SET(LIBCAPU_INCLUDE_DIR ${CAPU_INCLUDE_DIR})
SET(LIBCAPU_LIBRARY_DIR ${CAPU_LIBRARY_DIR})
+ SET(LIBCAPU_BINARY_DIR ${CAPU_BINARY_DIR})
ENDIF()
Modified: etch/trunk/binding-cpp/runtime/build.xml
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/build.xml?rev=1460569&r1=1460568&r2=1460569&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/build.xml (original)
+++ etch/trunk/binding-cpp/runtime/build.xml Mon Mar 25 09:47:07 2013
@@ -33,15 +33,17 @@
<property name="proj" location="${Etch.basedir}/binding-cpp/runtime" />
<property name="target" location="${proj}/target" />
<property name="testResultsDirectory" location="${target}/test-results" />
-
+
+ <property name="binaryDir" location="${Etch.dist}/binding-cpp/bin"/>
+ <property name="libaryDir" location="${Etch.dist}/binding-cpp/lib"/>
+ <property name="headerDir" location="${Etch.dist}/binding-cpp/include"/>
+
<!-- INIT TARGET -->
<!-- Modify this target to define project specific properties that can only be set at runtime -->
<target name="do-init" >
<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}" />
+ <mkdir dir="${testResultsDirectory}" />
</target>
<!-- CLEAN TARGET -->
@@ -131,98 +133,54 @@
<echo>Configuring CMake build</echo>
<echo>Using generator: ${cmake.generator}</echo>
<echo>Using toolchain file: ${cmake.toolchainfile}</echo>
- <cmake srcdir="${basedir}" bindir="${target}/${platform}/${Etch.build.target}" cmakeonly="false" 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="${cmake.toolchainfile}" />
- </cmake>
+ <mkdir dir="${target}/${platform}/${Etch.build.target}"/>
+
+ <!-- CMake configuration -->
+ <exec dir="${target}/${platform}/${Etch.build.target}" executable="cmake" failonerror="true">
+ <arg value="-G${cmake.generator}"/>
+ <arg value="-DETCH_EXTERNAL_DEPENDS:PATH=${env.ETCH_EXTERNAL_DEPENDS}" />
+ <arg value="-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${cmake.toolchainfile}" />
+ <arg value="-DETCH_INSTALL_DIR:PATH=${Etch.dist}/binding-cpp"/>
+ <arg value="-DETCH_TARGET_PLATFORM:STRING=${platform}"/>
+ <arg value="-DCMAKE_BUILD_TYPE:STRING=${Etch.build.target}"/>
+ <arg value="${basedir}"/>
+ </exec>
+
+ <!-- run the build -->
+ <exec dir="${target}/${platform}/${Etch.build.target}" executable="cmake" failonerror="true">
+ <arg line="--build . --target install --config ${Etch.build.target}"/>
+ </exec>
+
</then>
<else>
<!-- try default generator -->
<echo>Configuring CMake build</echo>
<echo>Using default generator</echo>
<echo>Using toolchain file: ${cmake.toolchainfile}</echo>
- <cmake srcdir="${basedir}" bindir="${target}/${platform}/${Etch.build.target}" cmakeonly="false" buildtype="${Etch.build.target}" >
- <variable name="ETCH_EXTERNAL_DEPENDS" type="PATH" value="${env.ETCH_EXTERNAL_DEPENDS}" />
- <variable name="CMAKE_TOOLCHAIN_FILE" type="FILEPATH" value="${cmake.toolchainfile}" />
- </cmake>
+
+ <mkdir dir="${target}/${platform}/${Etch.build.target}"/>
+
+ <!-- CMake configuration -->
+ <exec dir="${target}/${platform}/${Etch.build.target}" executable="cmake" failonerror="true">
+ <arg value="-DETCH_EXTERNAL_DEPENDS:PATH=${env.ETCH_EXTERNAL_DEPENDS}" />
+ <arg value="-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${cmake.toolchainfile}" />
+ <arg value="-DETCH_INSTALL_DIR:PATH=${Etch.dist}/binding-cpp"/>
+ <arg value="-DETCH_TARGET_PLATFORM:STRING=${platform}"/>
+ <arg value="-DCMAKE_BUILD_TYPE:STRING=${Etch.build.target}"/>
+ <arg value="${basedir}"/>
+ </exec>
+
+ <!-- run the build -->
+ <exec dir="${target}/${platform}/${Etch.build.target}" executable="cmake" failonerror="true">
+ <arg line="--build . --target install --config ${Etch.build.target}"/>
+ </exec>
+
</else>
</if>
</target>
<target name="do-build" depends="do-build-info,do-build-generate-sources,do-build-main" if="USE.cmake">
- <mkdir dir="${Etch.dist}/binding-cpp/bin" />
- <mkdir dir="${Etch.dist}/binding-cpp/include" />
- <mkdir dir="${Etch.dist}/binding-cpp/lib" />
-
- <!-- copy etch includes to dist folder -->
- <copy todir="${Etch.dist}/binding-cpp/include">
- <fileset dir="${proj}/include">
- <exclude name="**/.svn" />
- </fileset>
- </copy>
-
- <property name="capu.library.output.path.prefix" value="${proj}/3rd/capu/deliverable/Capu/lib/${platform}"/>
- <property name="capu.binary.output.path.prefix" value="${proj}/3rd/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}/${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}" />
- <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/${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">
- <fileset dir="${proj}/lib/capu/deliverable/Capu/include/Capu">
- <exclude name="**/.svn" />
- </fileset>
- </copy>
-
- <!-- copy capu lib to dist folder -->
- <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 -->
@@ -241,25 +199,13 @@
<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="3rd/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="3rd/capu/deliverable/Capu/bin/Linux_X86_32/${Etch.build.target}/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">
+ <exec executable="${binaryDir}/${platform}/${Etch.build.target}/etch-cpp-test.exe" 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">
+ <exec executable="${binaryDir}/${platform}/${Etch.build.target}/etch-cpp-test" osfamily="unix" failonerror="true">
<arg value="--gtest_output=xml:${testResultsDirectory}/"/>
</exec>
</else>
@@ -272,3 +218,4 @@
</target>
</project>
+
Modified: etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt?rev=1460569&r1=1460568&r2=1460569&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt (original)
+++ etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt Mon Mar 25 09:47:07 2013
@@ -247,3 +247,14 @@ ENDIF ()
set_target_properties (etch-cpp PROPERTIES OUTPUT_NAME "etch")
add_dependencies (etch-cpp Capu)
+
+#install etch headers and library
+INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/include DESTINATION "${ETCH_INSTALL_DIR}")
+INSTALL(TARGETS etch-cpp DESTINATION "${ETCH_INSTALL_DIR}/lib/${ETCH_TARGET_PLATFORM}/${CMAKE_BUILD_TYPE}")
+
+#copy more files on windows (*.pdb)
+IF(IS_DIRECTORY ${CMAKE_BINARY_DIR}/lib/${CMAKE_BUILD_TYPE})
+ INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/lib/${CMAKE_BUILD_TYPE} DESTINATION "${ETCH_INSTALL_DIR}/lib/${ETCH_TARGET_PLATFORM}")
+ELSE()
+ENDIF()
+
Modified: etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt?rev=1460569&r1=1460568&r2=1460569&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt (original)
+++ etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt Mon Mar 25 09:47:07 2013
@@ -21,7 +21,7 @@ include_directories (${GTEST})
include_directories (${GTEST}/include)
include_directories (${GMOCK})
include_directories (${GMOCK}/include)
-include_directories (${CAPU}/include/capu)
+include_directories (${LIBCAPU_INCLUDE_DIR})
IF (TARGET_OS STREQUAL "Windows")
@@ -31,14 +31,7 @@ IF (TARGET_OS STREQUAL "Windows")
ENDIF()
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()
-
+link_directories(${LIBCAPU_LIBRARY_DIR})
add_executable (etch-cpp-test
common/EtchNumberTest.cpp
@@ -127,8 +120,13 @@ IF (TARGET_OS STREQUAL "Windows" AND BUI
target_link_libraries (etch-cpp-test ${VLD}/lib/vld.lib)
ENDIF ()
-IF (TARGET_OS STREQUAL "Linux")
+IF (TARGET_OS STREQUAL "Linux" AND TARGET_ARCH STREQUAL "X86_64")
set_target_properties (etch-cpp-test PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
ENDIF ()
add_dependencies (etch-cpp-test etch-cpp Capu)
+
+#install test executables
+INSTALL(TARGETS etch-cpp-test DESTINATION "${ETCH_INSTALL_DIR}/bin/${ETCH_TARGET_PLATFORM}/Release" CONFIGURATIONS Release)
+INSTALL(TARGETS etch-cpp-test DESTINATION "${ETCH_INSTALL_DIR}/bin/${ETCH_TARGET_PLATFORM}/Debug" CONFIGURATIONS Debug)
+
Modified: etch/trunk/scripts/antsetup.bat
URL: http://svn.apache.org/viewvc/etch/trunk/scripts/antsetup.bat?rev=1460569&r1=1460568&r2=1460569&view=diff
==============================================================================
--- etch/trunk/scripts/antsetup.bat (original)
+++ etch/trunk/scripts/antsetup.bat Mon Mar 25 09:47:07 2013
@@ -38,7 +38,7 @@ set NUNIT_HOME=%ETCH_EXTERNAL_DEPENDS%\N
@rem CMAKE_HOME settings
IF "%CMAKE_HOME%" == "" (
-set CMAKE_HOME=%ETCH_EXTERNAL_DEPENDS%\cmake\2.8.6
+set CMAKE_HOME=%ETCH_EXTERNAL_DEPENDS%\cmake\2.8.10
)
@rem uncomment this line / unset this variable if you don't want to build csharp