toolchain-bb10-i486.cmake 3.11 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
############################################################################
# bb10-i486.cmake
# Copyright (C) 2014  Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
############################################################################

# Building for BlackBerry is only available under UNIX systems
if (NOT UNIX)
	message(FATAL_ERROR "You need to build using a Linux or a Mac OS X system")
endif(NOT UNIX)

if ("$ENV{QNX_HOST}" STREQUAL "")
	message(FATAL_ERROR "Some environment variables need to be defined by using the bbndk-env*.sh delivered with the bbndk.")
endif()

32 33 34 35 36 37 38 39
file(GLOB COMPILER_PATH $ENV{QNX_HOST}/usr/bin/i486-pc-nto-qnx*-gcc)
if("${COMPILER_PATH}" STREQUAL "")
	message(FATAL_ERROR "Could not find compiler")
endif()

get_filename_component(COMPILER_NAME ${COMPILER_PATH} NAME)
string(REGEX REPLACE "-gcc$" "" LINPHONE_BUILDER_TOOLCHAIN_PATH ${COMPILER_PATH})
string(REGEX REPLACE "-gcc$" "" LINPHONE_BUILDER_TOOLCHAIN_HOST ${COMPILER_NAME})
40

41 42 43 44 45 46 47
set(LINPHONE_BUILDER_TOOLCHAIN_CC "${LINPHONE_BUILDER_TOOLCHAIN_PATH}-gcc")
set(LINPHONE_BUILDER_TOOLCHAIN_CXX "${LINPHONE_BUILDER_TOOLCHAIN_PATH}-g++")
set(LINPHONE_BUILDER_TOOLCHAIN_LD "${LINPHONE_BUILDER_TOOLCHAIN_PATH}-ld")
set(LINPHONE_BUILDER_TOOLCHAIN_AR "${LINPHONE_BUILDER_TOOLCHAIN_PATH}-ar")
set(LINPHONE_BUILDER_TOOLCHAIN_RANLIB "${LINPHONE_BUILDER_TOOLCHAIN_PATH}-ranlib")
set(LINPHONE_BUILDER_TOOLCHAIN_STRIP "${LINPHONE_BUILDER_TOOLCHAIN_PATH}-strip")
set(LINPHONE_BUILDER_TOOLCHAIN_NM "${LINPHONE_BUILDER_TOOLCHAIN_PATH}-nm")
48 49 50 51 52 53 54

set(LINPHONE_BUILDER_TOOLCHAIN_CPPFLAGS "-D_REENTRANT -D__QNXNTO__ -Dasm=__asm")
#-D__PLAYBOOK__
set(LINPHONE_BUILDER_TOOLCHAIN_CFLAGS "-g -fPIC -fstack-protector-strong")
set(LINPHONE_BUILDER_TOOLCHAIN_LDFLAGS "-L$ENV{QNX_TARGET}/x86/lib -Wl,-z,relro -Wl,-z,now -pie -lbps -lsocket")


55 56 57 58 59 60 61 62 63
include(CMakeForceCompiler)

set(CMAKE_CROSSCOMPILING TRUE)

# Define name of the target system
set(CMAKE_SYSTEM_NAME QNX)
set(CMAKE_SYSTEM_PROCESSOR i486)

# Define the compiler
64 65
CMAKE_FORCE_C_COMPILER(${LINPHONE_BUILDER_TOOLCHAIN_CC} GNU)
CMAKE_FORCE_CXX_COMPILER(${LINPHONE_BUILDER_TOOLCHAIN_CXX} GNU)
66

67
set(CMAKE_FIND_ROOT_PATH $ENV{QNX_TARGET} ${CMAKE_INSTALL_PREFIX})
68 69 70 71 72 73

# search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)