diff --git a/easy_profiler_core/cmake/qnx-aarch64.cmake b/easy_profiler_core/cmake/qnx-aarch64.cmake new file mode 100644 index 0000000..ef509a8 --- /dev/null +++ b/easy_profiler_core/cmake/qnx-aarch64.cmake @@ -0,0 +1,8 @@ +# Processor specification, possible values: x86_64, armv7le, aarach64, ... +set(CMAKE_SYSTEM_PROCESSOR aarch64) +# Specify arch to be aarch64le +set(arch gcc_ntoaarch64le) +set(ARCH_NAME aarch64le) + +# Command settings for QNX +include(${CMAKE_CURRENT_LIST_DIR}/qnx.cmake) diff --git a/easy_profiler_core/cmake/qnx-armv7.cmake b/easy_profiler_core/cmake/qnx-armv7.cmake new file mode 100644 index 0000000..6202c01 --- /dev/null +++ b/easy_profiler_core/cmake/qnx-armv7.cmake @@ -0,0 +1,8 @@ +# Processor specification, possible values: x86_64, armv7le, aarach64, ... +set(CMAKE_SYSTEM_PROCESSOR armv7) +# Specify arch to be armv7le +set(arch gcc_ntoarmv7le) +set(ARCH_NAME armle-v7) + +# Command settings for QNX +include(${CMAKE_CURRENT_LIST_DIR}/qnx.cmake) diff --git a/easy_profiler_core/cmake/qnx-x86_64.cmake b/easy_profiler_core/cmake/qnx-x86_64.cmake new file mode 100644 index 0000000..3fbef36 --- /dev/null +++ b/easy_profiler_core/cmake/qnx-x86_64.cmake @@ -0,0 +1,8 @@ +# Processor specification, possible values: x86_64, armv7le, aarach64, ... +set(CMAKE_SYSTEM_PROCESSOR x86_64) +# Specify arch to be x86_64 +set(arch gcc_ntox86_64) +set(ARCH_NAME x86_64) + +# Command settings for QNX +include(${CMAKE_CURRENT_LIST_DIR}/qnx.cmake) diff --git a/easy_profiler_core/cmake/qnx.cmake b/easy_profiler_core/cmake/qnx.cmake new file mode 100644 index 0000000..1ca1c77 --- /dev/null +++ b/easy_profiler_core/cmake/qnx.cmake @@ -0,0 +1,33 @@ +# Cross compilation for QNX +set(CMAKE_SYSTEM_NAME QNX) +set(QNX YES) + +# Suppose you have already set QNX_HOST and QNX_TARGET Add compiler and linker +# flags -std=gnu++14 is needed because QNX header files only cover GNU and POSIX +set(CMAKE_CXX_FLAGS + "${CMAKE_EXE_LINKER_FLAGS} -lang-c++ -V${arch} -std=gnu++14") + +# Add definitions command for diffent platforms So we can use macro definition +# "#ifdef PLATFORM_QNX" in source code +set(PLATFORM_QNX ON) +add_definitions(-DPLATFORM_QNX) +# Build crossguid library for qnx +set(GUID_LIBUUID ON) +add_definitions(-DGUID_LIBUUID) + +# Upstream settings +set(CMAKE_C_COMPILER qcc) +set(CMAKE_C_COMPILER_TARGET ${arch}) +set(CMAKE_CXX_COMPILER q++) +set(CMAKE_CXX_COMPILER_TARGET ${arch}) + +# Set the path to the qnx host include and lib +include_directories($ENV{QNX_HOST}/usr/include) +link_directories($ENV{QNX_HOST}/usr/lib) + +# Set the path to the qnx target include and lib +include_directories($ENV{QNX_TARGET}/usr/include) +link_directories($ENV{QNX_TARGET}/usr/lib) +include_directories($ENV{QNX_TARGET}/${ARCH_NAME}/usr/include) +link_directories($ENV{QNX_TARGET}/${ARCH_NAME}/lib) +link_directories($ENV{QNX_TARGET}/${ARCH_NAME}/usr/lib)