Skip to content

Commit

Permalink
Added AGL CMake toolchain file and modified 3rd party cmake files for…
Browse files Browse the repository at this point in the history
… cross compiling
  • Loading branch information
jacobkeeler committed Jan 26, 2017
1 parent a02ec78 commit ccd14f0
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 44 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ if (HMI STREQUAL "qt")
if (CMAKE_SYSTEM_NAME STREQUAL "QNX")
find_package(Qt4 ${qt_version} REQUIRED QtCore QtGui QtDBus QtDeclarative)
else ()
if (CROSS_HOST)
set(OE_QMAKE_PATH_EXTERNAL_HOST_BINS ${qt_bin_dir}) # Added By JC
endif ()
find_package(Qt5Core REQUIRED)
find_package(Qt5DBus REQUIRED)
find_package(Qt5Qml REQUIRED)
Expand Down
30 changes: 30 additions & 0 deletions rcar_m2_agl_linux.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Setup Crosscompiling for AGL(Poky toolchain) on Renesas Rcar M2
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE SYSTEM_VERSION 1)

# Setup the cross compiler
SET(CMAKE_C_COMPILER ${CC})
SET(CMAKE_CXX_COMPILER ${CXX})

ADD_DEFINITIONS(-DBLUEZ5)

SET(CROSS_HOST "arm-agl-linux-gnueabi")
SET(CROSS_APR_VARS
"ac_cv_file__dev_zero=yes"
"ac_cv_func_setpgrp_void=yes"
"apr_cv_tcp_nodelay_with_cork=yes"
"apr_cv_process_shared_works=yes"
"apr_cv_mutex_robust_shared=no"
"ac_cv_sizeof_struct_iovec=8"
"ac_cv_sizeof_long=4"
"apr_cv_mutex_recursive=yes")

# Setup SysRoot
SET(CMAKE_SYSROOT $ENV{SDKTARGETSYSROOT})
SET(CMAKE_FIND_ROOT_PATH $ENV{SDKTARGETSYSROOT})

#Set searching directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
70 changes: 47 additions & 23 deletions src/3rd_party/apache-log4cxx-cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ set(COMMON_CONFIGURE_FLAGS
"LDFLAGS=-L${EXPAT_LIBS_DIRECTORY}"
)

if(CROSS_HOST)
set(EXTRA_CONFIGURE_FLAGS
"--host=${CROSS_HOST}"
)
else()
set(EXTRA_CONFIGURE_FLAGS "")
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "QNX")
if (CMAKE_SYSTEM_PROCESSOR MATCHES arm*)
set (ARCHITECTURE arm) # log4cxx doesn't recognize armv7
Expand All @@ -54,32 +62,48 @@ if(CMAKE_SYSTEM_NAME STREQUAL "QNX")
endif ()
set(CONFIGURE_FLAGS "--host=${ARCHITECTURE}-nto-qnx" ${COMMON_CONFIGURE_FLAGS})
else()
set(CONFIGURE_FLAGS ${COMMON_CONFIGURE_FLAGS})
set(CONFIGURE_FLAGS ${COMMON_CONFIGURE_FLAGS} ${EXTRA_CONFIGURE_FLAGS})
endif()

add_custom_command(OUTPUT ${LOG4CXX_BUILD_DIRECTORY}/Makefile
COMMAND CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} ${LOG4CXX_SOURCE_DIRECTORY}/configure ${CONFIGURE_FLAGS}
DEPENDS libapr-1
DEPENDS apr-util
WORKING_DIRECTORY ${LOG4CXX_BUILD_DIRECTORY}
)
if(CROSS_HOST)
add_custom_command(OUTPUT ${LOG4CXX_BUILD_DIRECTORY}/Makefile
COMMAND ${LOG4CXX_SOURCE_DIRECTORY}/configure ${CONFIGURE_FLAGS}
DEPENDS libapr-1
DEPENDS apr-util
WORKING_DIRECTORY ${LOG4CXX_BUILD_DIRECTORY}
)
else()
add_custom_command(OUTPUT ${LOG4CXX_BUILD_DIRECTORY}/Makefile
COMMAND CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} ${LOG4CXX_SOURCE_DIRECTORY}/configure ${CONFIGURE_FLAGS}
DEPENDS libapr-1
DEPENDS apr-util
WORKING_DIRECTORY ${LOG4CXX_BUILD_DIRECTORY}
)
endif()

add_custom_target(liblog4cxx ALL make
COMMAND /bin/bash -c \"
cd ${CMAKE_CURRENT_SOURCE_DIR}\;
git log . 1>/dev/null 2>&1\;
if [ \\$$? == 0 ]; then
grep \\".commit_hash\\" ${LOG4CXX_LIBS_DIRECTORY}/liblog4cxx.so 1>/dev/null 2>&1\;
if [ ! \\\$$? == 0 ]\; then
cd ${CMAKE_CURRENT_SOURCE_DIR} &&
git log --pretty=\\"format:%H\\" -1 ${LOG4CXX_SOURCE_DIRECTORY} > /tmp/commit_hash 2>/dev/null &&
echo \\"Adding .commit_hash section\\" &&
${objcopy} --add-section .commit_hash=/tmp/commit_hash ${LOG4CXX_LIBS_DIRECTORY}/liblog4cxx.so ${LOG4CXX_LIBS_DIRECTORY}/liblog4cxx.so 1>/dev/null 2>&1\;
fi;
fi\"
DEPENDS ${LOG4CXX_BUILD_DIRECTORY}/Makefile
WORKING_DIRECTORY ${LOG4CXX_BUILD_DIRECTORY}
)
if(CROSS_HOST)
add_custom_target(liblog4cxx ALL make
DEPENDS ${LOG4CXX_BUILD_DIRECTORY}/Makefile
WORKING_DIRECTORY ${LOG4CXX_BUILD_DIRECTORY}
)
else()
add_custom_target(liblog4cxx ALL make
COMMAND /bin/bash -c \"
cd ${CMAKE_CURRENT_SOURCE_DIR}\;
git log . 1>/dev/null 2>&1\;
if [ \\$$? == 0 ]; then
grep \\".commit_hash\\" ${LOG4CXX_LIBS_DIRECTORY}/liblog4cxx.so 1>/dev/null 2>&1\;
if [ ! \\\$$? == 0 ]\; then
cd ${CMAKE_CURRENT_SOURCE_DIR} &&
git log --pretty=\\"format:%H\\" -1 ${LOG4CXX_SOURCE_DIRECTORY} > /tmp/commit_hash 2>/dev/null &&
echo \\"Adding .commit_hash section\\" &&
${objcopy} --add-section .commit_hash=/tmp/commit_hash ${LOG4CXX_LIBS_DIRECTORY}/liblog4cxx.so ${LOG4CXX_LIBS_DIRECTORY}/liblog4cxx.so 1>/dev/null 2>&1\;
fi;
fi\"
DEPENDS ${LOG4CXX_BUILD_DIRECTORY}/Makefile
WORKING_DIRECTORY ${LOG4CXX_BUILD_DIRECTORY}
)
endif()

install(
DIRECTORY ${LOG4CXX_LIBS_DIRECTORY}/
Expand Down
23 changes: 18 additions & 5 deletions src/3rd_party/apr-cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,28 @@ if(CMAKE_SYSTEM_NAME STREQUAL "QNX")
"apr_cv_tcp_nodelay_with_cork=no"
"ac_cv_sizeof_struct_iovec=8"
)
elseif(CROSS_HOST)
set(CONFIGURE_FLAGS
"--host=${CROSS_HOST}"
${CROSS_APR_VARS}
)
else()
set(CONFIGURE_FLAGS "")
endif()

add_custom_command(OUTPUT ${APR_BUILD_DIRECTORY}/Makefile
COMMAND CC=${CMAKE_C_COMPILER} ${APR_SOURCE_DIRECTORY}/configure ${CONFIGURE_FLAGS}
COMMAND ${CMAKE_COMMAND} -E copy include/apr.h ${APR_SOURCE_DIRECTORY}/include
WORKING_DIRECTORY ${APR_BUILD_DIRECTORY}
)
if(CROSS_HOST)
add_custom_command(OUTPUT ${APR_BUILD_DIRECTORY}/Makefile
COMMAND ${APR_SOURCE_DIRECTORY}/configure ${CONFIGURE_FLAGS}
COMMAND ${CMAKE_COMMAND} -E copy include/apr.h ${APR_SOURCE_DIRECTORY}/include
WORKING_DIRECTORY ${APR_BUILD_DIRECTORY}
)
else()
add_custom_command(OUTPUT ${APR_BUILD_DIRECTORY}/Makefile
COMMAND CC=${CMAKE_C_COMPILER} ${APR_SOURCE_DIRECTORY}/configure ${CONFIGURE_FLAGS}
COMMAND ${CMAKE_COMMAND} -E copy include/apr.h ${APR_SOURCE_DIRECTORY}/include
WORKING_DIRECTORY ${APR_BUILD_DIRECTORY}
)
endif()

add_custom_command(OUTPUT ${APR_BUILD_DIRECTORY}/include/private/apr_escape_test_char.h
DEPENDS ${APR_BUILD_DIRECTORY}/Makefile
Expand Down
32 changes: 24 additions & 8 deletions src/3rd_party/apr-util-cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,35 @@ set(COMMON_CONFIGURE_FLAGS
"--with-expat-build=${EXPAT_BUILD_DIRECTORY}"
)

if(CROSS_HOST)
set(EXTRA_CONFIGURE_FLAGS
"--host=${CROSS_HOST}"
)
else()
set(EXTRA_CONFIGURE_FLAGS "")
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "QNX")
set(CONFIGURE_FLAGS "--host=${CMAKE_SYSTEM_PROCESSOR}-nto-qnx" ${COMMON_CONFIGURE_FLAGS})
else()
set(CONFIGURE_FLAGS ${COMMON_CONFIGURE_FLAGS})
set(CONFIGURE_FLAGS ${COMMON_CONFIGURE_FLAGS} ${EXTRA_CONFIGURE_FLAGS})
endif()


add_custom_command(OUTPUT ${APR_UTIL_BUILD_DIRECTORY}/Makefile
COMMAND CC=${CMAKE_C_COMPILER} ${APR_UTIL_SOURCE_DIRECTORY}/configure ${CONFIGURE_FLAGS}
DEPENDS libapr-1
DEPENDS expat
WORKING_DIRECTORY ${APR_UTIL_BUILD_DIRECTORY}
)
if(CROSS_HOST)
add_custom_command(OUTPUT ${APR_UTIL_BUILD_DIRECTORY}/Makefile
COMMAND ${APR_UTIL_SOURCE_DIRECTORY}/configure ${CONFIGURE_FLAGS}
DEPENDS libapr-1
DEPENDS expat
WORKING_DIRECTORY ${APR_UTIL_BUILD_DIRECTORY}
)
else()
add_custom_command(OUTPUT ${APR_UTIL_BUILD_DIRECTORY}/Makefile
COMMAND CC=${CMAKE_C_COMPILER} ${APR_UTIL_SOURCE_DIRECTORY}/configure ${CONFIGURE_FLAGS}
DEPENDS libapr-1
DEPENDS expat
WORKING_DIRECTORY ${APR_UTIL_BUILD_DIRECTORY}
)
endif()

add_custom_target(apr-util ALL make
DEPENDS ${APR_UTIL_BUILD_DIRECTORY}/Makefile
Expand Down
28 changes: 22 additions & 6 deletions src/3rd_party/dbus-cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,33 @@ set(COMMON_CONFIGURE_FLAGS
"LDFLAGS=-L${EXPAT_LIBS_DIRECTORY}"
)

if(CROSS_HOST)
set(EXTRA_CONFIGURE_FLAGS
"--host=${CROSS_HOST}"
)
else()
set(EXTRA_CONFIGURE_FLAGS "")
endif()

if (CMAKE_SYSTEM_NAME STREQUAL "QNX")
set(CONFIGURE_FLAGS "--host=${CMAKE_SYSTEM_PROCESSOR}-nto-qnx" ${COMMON_CONFIGURE_FLAGS})
else ()
set(CONFIGURE_FLAGS ${COMMON_CONFIGURE_FLAGS})
set(CONFIGURE_FLAGS ${COMMON_CONFIGURE_FLAGS} ${EXTRA_CONFIGURE_FLAGS})
endif ()

add_custom_command(OUTPUT ${DBUS_BUILD_DIRECTORY}/Makefile
COMMAND CC=${CMAKE_C_COMPILER} ${DBUS_SOURCE_DIRECTORY}/configure ${CONFIGURE_FLAGS}
DEPENDS expat
WORKING_DIRECTORY ${DBUS_BUILD_DIRECTORY}
)
if(CROSS_HOST)
add_custom_command(OUTPUT ${DBUS_BUILD_DIRECTORY}/Makefile
COMMAND ${DBUS_SOURCE_DIRECTORY}/configure ${CONFIGURE_FLAGS}
DEPENDS expat
WORKING_DIRECTORY ${DBUS_BUILD_DIRECTORY}
)
else()
add_custom_command(OUTPUT ${DBUS_BUILD_DIRECTORY}/Makefile
COMMAND CC=${CMAKE_C_COMPILER} ${DBUS_SOURCE_DIRECTORY}/configure ${CONFIGURE_FLAGS}
DEPENDS expat
WORKING_DIRECTORY ${DBUS_BUILD_DIRECTORY}
)
endif()

add_custom_target(dbus ALL make
COMMAND /bin/bash -c \"
Expand Down
2 changes: 1 addition & 1 deletion src/3rd_party/set_3rd_party_paths.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ else()
endif()
set(3RD_PARTY_INSTALL_PREFIX_ARCH "$ENV{QNX_TARGET}/${QNX_ARCH}/usr")
else()
set(3RD_PARTY_INSTALL_PREFIX "/usr/local")
set(3RD_PARTY_INSTALL_PREFIX "${CMAKE_SYSROOT}/usr/local")
set(3RD_PARTY_INSTALL_PREFIX_ARCH ${3RD_PARTY_INSTALL_PREFIX})
endif()
endif()
Expand Down
6 changes: 5 additions & 1 deletion tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ include(ExternalProject)
set(intergen_SOURCES "${CMAKE_CURRENT_LIST_DIR}/intergen")
set(intergen_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/intergen")
set(intergen_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/intergen")
set(intergen_CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_INSTALL_PREFIX=${intergen_INSTALL_DIR})
if(CROSS_HOST)
set(intergen_CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${intergen_INSTALL_DIR})
else()
set(intergen_CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_INSTALL_PREFIX=${intergen_INSTALL_DIR})
endif()

ExternalProject_Add(intergen
SOURCE_DIR ${intergen_SOURCES}
Expand Down

0 comments on commit ccd14f0

Please sign in to comment.