android support
git-svn-id: svn://db.shs.com.ru/libs@257 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -6,6 +6,12 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}
|
||||
if(MINGW)
|
||||
find_package(MinGW REQUIRED)
|
||||
endif()
|
||||
if (DEFINED ANDROID_PLATFORM)
|
||||
include_directories(${ANDROID_SYSTEM_LIBRARY_PATH}/usr/include)
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${ANDROID_NDK}/sysroot/usr/include")
|
||||
#message("${ANDROID_SYSTEM_LIBRARY_PATH}/usr/include")
|
||||
#message("${ANDROID_NDK}/sysroot/usr/include")
|
||||
endif()
|
||||
option(LIB "System install" 1)
|
||||
option(DEBUG "Build with -g3" 0)
|
||||
option(QGLVIEW "Build QGLview library and utils" 0)
|
||||
@@ -41,7 +47,11 @@ foreach(F ${PIP_FOLDERS})
|
||||
list(APPEND PIP_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/pip/src_main/${F}")
|
||||
endforeach(F)
|
||||
#message(${PIP_INCLUDES})
|
||||
set(PIP_CMG "${CMAKE_CURRENT_BINARY_DIR}/pip/utils/code_model_generator/pip_cmg")
|
||||
if(DEFINED ANDROID_PLATFORM)
|
||||
set(PIP_CMG "pip_cmg")
|
||||
else()
|
||||
set(PIP_CMG "${CMAKE_CURRENT_BINARY_DIR}/pip/utils/code_model_generator/pip_cmg")
|
||||
endif()
|
||||
if(WIN32)
|
||||
set(PIP_DLL_DIR "${CMAKE_CURRENT_BINARY_DIR}/pip")
|
||||
endif()
|
||||
|
||||
11
make_android.sh
Executable file
11
make_android.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
export Qt5_ROOT=/mnt/data/Qt_5.9.1_linux/5.9.1/android_armv7/lib/cmake
|
||||
export Qt5_DIR=${Qt5_ROOT}/Qt5
|
||||
export Qt5LinguistTools_DIR=${Qt5_ROOT}/Qt5LinguistTools
|
||||
export Qt5UiPlugin_DIR=${Qt5_ROOT}/Qt5UiPlugin
|
||||
export Qt5Widgets_DIR=${Qt5_ROOT}/Qt5Widgets
|
||||
export Qt5Core_DIR=${Qt5_ROOT}/Qt5Core
|
||||
export Qt5Gui_DIR=${Qt5_ROOT}/Qt5Gui
|
||||
export Qt5Sql_DIR=${Qt5_ROOT}/Qt5Sql
|
||||
export Qt5OpenGL_DIR=${Qt5_ROOT}/Qt5OpenGL
|
||||
export Qt5Designer_DIR=${Qt5_ROOT}/Qt5Designer
|
||||
rm -rf * && cmake -Wno-dev -DCMAKE_TOOLCHAIN_FILE=/mnt/data/Distrib/Android/android-sdk-linux/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-24 -DICU=0 -DQt4=0 -DQt5=1 -DQt5_DIR=${Qt5_ROOT}/Qt5 -DQt5LinguistTools_DIR=${Qt5_ROOT}/Qt5LinguistTools -DQt5UiPlugin_DIR=${Qt5_ROOT}/Qt5UiPlugin -DQt5Widgets_DIR=${Qt5_ROOT}/Qt5Widgets -DQt5Core_DIR=${Qt5_ROOT}/Qt5Core -DQt5Gui_DIR=${Qt5_ROOT}/Qt5Gui -DQt5Sql_DIR=${Qt5_ROOT}/Qt5Sql -DQt5OpenGL_DIR=${Qt5_ROOT}/Qt5OpenGL ../libs
|
||||
@@ -13,7 +13,9 @@ else()
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
if (NOT DEFINED ANDROID_PLATFORM)
|
||||
find_package(OpenGL REQUIRED)
|
||||
endif()
|
||||
if (MINGW)
|
||||
find_package(MinGW REQUIRED)
|
||||
endif()
|
||||
@@ -87,9 +89,11 @@ macro(qad_project NAME _MODULES _LIBS)
|
||||
qt_target_link_libraries(${PROJ_NAME} ${_LIBS})
|
||||
qad_install(${PROJ_NAME} "${out_HDR}")
|
||||
message(STATUS "Building ${PROJ_NAME}")
|
||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/plugin")
|
||||
set(_${NAME}_PLUGIN_LIBS "${_LIBS}")
|
||||
add_subdirectory(plugin)
|
||||
if (NOT DEFINED ANDROID_PLATFORM)
|
||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/plugin")
|
||||
set(_${NAME}_PLUGIN_LIBS "${_LIBS}")
|
||||
add_subdirectory(plugin)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
@@ -227,7 +227,11 @@ void Graphic::canvasPaintEvent(QPaintEvent * ) {
|
||||
//phei = hei;
|
||||
QPainter p;
|
||||
if (isOGL) {
|
||||
#ifdef ANDROID
|
||||
p.fillRect(canvas->rect(), Qt::black);
|
||||
#else
|
||||
glClearColor(0.f, 0.f, 0.f, 0.f);
|
||||
#endif
|
||||
p.begin(canvas);
|
||||
} else p.begin(buffer);
|
||||
p.fillRect(canvas->rect(), back_color);
|
||||
@@ -242,8 +246,10 @@ void Graphic::canvasPaintEvent(QPaintEvent * ) {
|
||||
}
|
||||
p.setRenderHint(QPainter::Antialiasing, aalias);
|
||||
if (isOGL) {
|
||||
#ifndef ANDROID
|
||||
if (aalias) glEnable(GL_MULTISAMPLE);
|
||||
else glDisable(GL_MULTISAMPLE);
|
||||
#endif
|
||||
}
|
||||
//p.setRenderHint(QPainter::HighQualityAntialiasing, aalias);
|
||||
if (!aalias) p.translate(-0.5, -0.5);
|
||||
|
||||
Reference in New Issue
Block a user