Skip to content
This repository has been archived by the owner on Sep 4, 2019. It is now read-only.

Add cmake build files for ToneGenerator #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.DS_Store
ToneGenerator/CMakeCache.txt
ToneGenerator/CMakeFiles
ToneGenerator/Makefile
ToneGenerator/cmake_install.cmake
ToneGenerator/install_manifest.txt
ToneGenerator/Device-Debug
Binary file removed ToneGenerator/.DS_Store
Binary file not shown.
51 changes: 51 additions & 0 deletions ToneGenerator/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
cmake_minimum_required(VERSION 2.8.9)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)

# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)

set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSING_GL11")

#find_package(BBCascades REQUIRED)

include_directories(
/Applications/Momentics.app/target_10_2_0_1155/qnx6/usr/include/freetype2
${QT_INCLUDES}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)

set(ToneGenerator_SRCS
src/main.c
src/bbutil.c
src/audiopcm.c
)

add_executable(Device-Debug/ToneGenerator ${ToneGenerator_SRCS} ${WikiReader_RCC_SRCS})

# -lbps -lm -laudio_manager -lasound -lEGL -lGLESv2 -lGLESv1_CL -lscreen -lfreetype -lpng
target_link_libraries(
Device-Debug/ToneGenerator

EGL
GLESv2
GLESv1_CL
m
png
audio_manager
asound
screen
bps
freetype
${QT_QTCORE_LIBRARY}
${QT_QTNETWORK_LIBRARY}
${QT_QTXML_LIBRARY}
${QT_QTGUI_LIBRARY}
${QT_QTDECLARATIVE_LIBRARY}

${BBCASCADES_LIBRARY}
)
14 changes: 14 additions & 0 deletions ToneGenerator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,17 @@ Samples Catalog (http://blackberry.github.com/samples)
For more information about Native development, visit:
The Native microsite (http://developer.blackberry.com/native)


### Build with cmake

Load environment variables

export tmp_pwd=`pwd`
cd /Applications/Momentics.app && source bbndk-* && cd $tmp_pwd
unset tmp_pwd

Run `cmake` command

mkdir Device-Debug
cmake -DCMAKE_TOOLCHAIN_FILE="./cmake/Toolchain-QNX-8.0.0.cmake" .
make`
53 changes: 53 additions & 0 deletions ToneGenerator/cmake/FindBBSystem.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# - Try to find BBSystem
# Once done this will define
#
# BBSYSTEM_FOUND - system has BBSystem
# BBSYSTEM_INCLUDE_DIRS - the BBSystem include directory
# BBSYSTEM_LIBRARIES - Link these to use BBSystem
#
# Copyright (c) 2013 Laszlo Papp <[email protected]>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#

if (BBSystem_FIND_REQUIRED)
set(_bbSystemReq "REQUIRED")
endif (BBSystem_FIND_REQUIRED)

find_package(Qt 4.8 ${_bbSystemReq})

find_path(BBSYSTEM_INCLUDE_DIR Global.hpp
HINTS
ENV BBSYSTEMDIR
PATH_SUFFIXES include include/bb include/bb/system
PATHS
~/Library/Frameworks
/Library/Frameworks
/opt/local
/opt
${QNX_TARGET}/usr
)

find_library(BBSYSTEM_LIBRARY
NAMES BBSystem bbsystem
HINTS
ENV BBSYSTEMDIR
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
PATHS
~/Library/Frameworks
/Library/Frameworks
/opt/local
/opt
${QNX_TARGET}/armv7/usr
${QNX_TARGET}/armle-v7/usr
)


# handle the QUIETLY and REQUIRED arguments and set BBSYSTEM_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(BBSystem DEFAULT_MSG BBSYSTEM_LIBRARY BBSYSTEM_INCLUDE_DIR)

mark_as_advanced(BBSYSTEM_LIBRARY BBSYSTEM_INCLUDE_DIR)
88 changes: 88 additions & 0 deletions ToneGenerator/cmake/Toolchain-QNX-8.0.0.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#
# (C) Copyright 2009 Johns Hopkins University (JHU), All Rights
# Reserved.
# (C) Copyright 2013 Laszlo Papp <[email protected]>
#
# --- begin cisst license - do not edit ---
#
# This software is provided "as is" under an open source license, with
# no warranty. The complete license can be found in license.txt and
# http://www.cisst.org/cisst/license.txt.
#
# --- end cisst license ---

SET(CMAKE_SYSTEM_NAME QNX)
SET(CMAKE_SYSTEM_VERSION 8.0.0)
SET(CMAKE_SYSTEM_PROCESSOR armv7)
SET(TOOLCHAIN QNX)

#SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".a")

SET(CMAKE_SHARED_LIBRARY_PREFIX "lib")
SET(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
SET(CMAKE_STATIC_LIBRARY_PREFIX "lib")
SET(CMAKE_STATIC_LIBRARY_SUFFIX ".a")

IF(CMAKE_HOST_WIN32)
SET(HOST_EXECUTABLE_SUFFIX ".exe")
ENDIF(CMAKE_HOST_WIN32)

FIND_PATH(QNX_HOST
NAME usr/bin/qcc${HOST_EXECUTABLE_SUFFIX}
PATHS $ENV{QNX_HOST} C:/QNX641/host/win32/x86
NO_CMAKE_PATH
NO_CMAKE_ENVIRONMENT_PATH
)

FIND_PATH(QNX_TARGET
NAME usr/include/qnx_errno.h
PATHS $ENV{QNX_TARGET} C:/QNX641/target/qnx6
NO_CMAKE_PATH
NO_CMAKE_ENVIRONMENT_PATH
)

IF(CMAKE_HOST_WIN32)
FIND_PATH(QNX_CONFIGURATION
NAME bin/qnxactivate.exe
PATHS $ENV{QNX_CONFIGURATION}
"C:/Program Files/QNX Software Systems/qconfig"
NO_CMAKE_PATH
NO_CMAKE_ENVIRONMENT_PATH
)
ENDIF(CMAKE_HOST_WIN32)

SET(ENV{QNX_HOST} ${QNX_HOST})
SET(ENV{QNX_TARGET} ${QNX_TARGET})
IF(CMAKE_HOST_WIN32)
SET(ENV{QNX_CONFIGURATION} ${QNX_CONFIGURATION})
SET(ENV{PATH} "$ENV{PATH};${QNX_HOST}/usr/bin")
ENDIF(CMAKE_HOST_WIN32)

SET(CMAKE_MAKE_PROGRAM "${QNX_HOST}/usr/bin/make${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX Make Program")
SET(CMAKE_SH "${QNX_HOST}/usr/bin/sh${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX shell Program")
SET(CMAKE_AR "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-ar${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX ar Program")
SET(CMAKE_RANLIB "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-ranlib${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX ranlib Program")
SET(CMAKE_NM "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-nm${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX nm Program")
SET(CMAKE_OBJCOPY "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-objcopy${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX objcopy Program")
SET(CMAKE_OBJDUMP "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-objdump${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX objdump Program")
SET(CMAKE_LINKER "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-ld" CACHE PATH "QNX Linker Program")
SET(CMAKE_STRIP "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-strip${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX Strip Program")

SET(CMAKE_C_COMPILER ${QNX_HOST}/usr/bin/qcc)
SET(CMAKE_C_COMPILER_ARG1 " -Vgcc_ntoarmv7le -lang-c")
SET(CMAKE_C_FLAGS_DEBUG "-g")
SET(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG")
SET(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")

SET(CMAKE_CXX_COMPILER ${QNX_HOST}/usr/bin/qcc)
SET(CMAKE_CXX_COMPILER_ARG1 "-Vgcc_ntoarmv7le -lang-c++")
SET(CMAKE_CXX_FLAGS_DEBUG "-g")
SET(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")

SET(CMAKE_FIND_ROOT_PATH ${QNX_TARGET})
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)