Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOS Toolchain for static probe #261

Open
wants to merge 5 commits 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
2 changes: 1 addition & 1 deletion 3rdparty/kde/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set(gammaray_kitemmodels_srcs
krecursivefilterproxymodel.cpp
)

add_library(gammaray_kitemmodels SHARED ${gammaray_kitemmodels_srcs})
add_library(gammaray_kitemmodels ${GAMMARAY_LIBRARY_TYPE} ${gammaray_kitemmodels_srcs})

if(Qt5Core_FOUND)
target_link_libraries(gammaray_kitemmodels LINK_PUBLIC Qt5::Core)
Expand Down
19 changes: 19 additions & 0 deletions Install.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,25 @@ or
$ adb forward --remove-all
to remove all forwards

Building Gammaray probe for IOS (OSX "El Capitan" / Qt 5.7 / Xcode 8 / iphone SDK 10.0):
Make sure you have gdb and qmake in your path
% export QT_DIR=<QT HOME> <--- set to QT's home
% mkdir build
% cd build
% cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-IOS.cmake -DCMAKE_PREFIX_PATH=${QT_DIR}/5.7/ios -DGAMMARAY_STATIC_PROBE=TRUE -DCMAKE_INSTALL_PREFIX=$SYSROOT/usr/ -G Xcode ..
% /usr/bin/xcodebuild -project GammaRay.xcodeproj build -target gammaray_probe -configuration Release
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If requested changes are done, then a simple: make is needed.


Using Gammaray on IOS:
-modify your main.cpp and include the following call from probe/hooks.h
GammaRay::Hooks::installHooks();
- link your QT IOS app with the following libraries:
libgammaray_kitemmodels-qt5_7-arm.a
libgammaray_core-qt5_7-arm.a
libgammaray_common-qt5_7-arm.a
libgammaray_common_internal.a
gammaray_probe.a
- deploy and run your app

== Cross-compiling GammaRay ==
You'll find more information on this in the wiki:
https://github.com/KDAB/GammaRay/wiki/Cross-compiling-GammaRay
Expand Down
66 changes: 66 additions & 0 deletions cmake/Toolchain-IOS.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Basic cmake toolchain file for IOS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have simply duplicate the OSX one and change i686 to arm (or armv7).
If any errors, report them to us.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that + unix makefiles as the backend but I'm afraid I could not get it to generate arm code, only x86. On my machine at least it's not as simple as just duplicating the OSX toolchain and changing the architecture. It could be my setup is broken for gcc. Feel free to decline this PR as it doesn't really fit your requirements.

# Assumptions: toolchain is in path, $SYSROOT points to the sysroot
#

# Copyright (c) 2013-2016 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
# All rights reserved.
#
# Author: Paul Nader <paul.nader at gmail.com>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Set the Base SDK (only change the SDKVER value, if for instance, you are building for iOS 10.0):
set(SDKVER "10.0")
set(DEVROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer")
set(SDKROOT "${DEVROOT}/SDKs/iPhoneOS${SDKVER}.sdk")
if(EXISTS ${SDKROOT})
set(CMAKE_OSX_SYSROOT "${SDKROOT}")
else()
message("Warning, iOS Base SDK path not found: " ${SDKROOT})
endif()

set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD_32_BIT)")

set(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos")
set(CMAKE_MACOSX_BUNDLE YES)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING "NO")
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO")
set(CMAKE_XCODE_ATTRIBUTE_PRESERVE_DEAD_CODE_INITS_AND_TERMS "YES")
set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS "armv7")

set(CMAKE_SYSTEM_NAME "Linux")
set(CMAKE_SYSTEM_PROCESSOR "armv7")
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --sysroot=$ENV{SYSROOT}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --sysroot=$ENV{SYSROOT}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --sysroot=$ENV{SYSROOT}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} --sysroot=$ENV{SYSROOT}")

set(CMAKE_FIND_ROOT_PATH "$ENV{SYSROOT}")

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
2 changes: 1 addition & 1 deletion probe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ endif()

# probe lib
if(APPLE) # DYLD_INSERT_LIBRARIES only works with real shared libraries, not modules
add_library(gammaray_probe SHARED ${gammaray_probe_srcs})
add_library(gammaray_probe ${GAMMARAY_LIBRARY_TYPE} ${gammaray_probe_srcs})
if(NOT GAMMARAY_INSTALL_QT_LAYOUT)
set_target_properties(gammaray_probe PROPERTIES INSTALL_RPATH "@loader_path/../../../Frameworks")
endif()
Expand Down