Skip to content

Commit

Permalink
Merge pull request #68 from mbernasocchi/android
Browse files Browse the repository at this point in the history
[BP18] Android adaptations
  • Loading branch information
timlinux committed Dec 5, 2011
2 parents d38a0bc + 5151b2a commit a5b7d6c
Show file tree
Hide file tree
Showing 24 changed files with 641 additions and 244 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ doc/CODING.tex
doc/INSTALL.tex
scripts/Debug
scripts/RelWithDebInfo
/CMakeLists.txt.user
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ ENDIF (NOT BISON_EXECUTABLE)
#############################################################
# search for dependencies

IF(NOT WIN32)
IF(NOT WIN32 AND NOT ANDROID)
INCLUDE(CheckFunctionExists)
CHECK_FUNCTION_EXISTS(openpty OPENPTY_IN_LIBC)
IF(NOT OPENPTY_IN_LIBC)
Expand All @@ -130,7 +130,7 @@ IF(NOT WIN32)
MESSAGE (SEND_ERROR "openpty not found!")
ENDIF(NEED_LIBUTIL)
ENDIF(NOT OPENPTY_IN_LIBC)
ENDIF(NOT WIN32)
ENDIF(NOT WIN32 AND NOT ANDROID)

# required
FIND_PACKAGE(Proj)
Expand Down Expand Up @@ -339,6 +339,10 @@ ELSE (WIN32)

ENDIF (WIN32)

IF (ANDROID)
SET (DEFAULT_PLUGIN_SUBDIR lib)
SET (DEFAULT_DATA_SUBDIR files/share)
ENDIF (ANDROID)

#assume we have escaped compiler directives
#eventually we want to change this to new
Expand Down
10 changes: 8 additions & 2 deletions cmake/FindPostgres.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
# POSTGRES_INCLUDE_DIR
# POSTGRES_LIBRARY

IF(WIN32)
IF(ANDROID)
SET(POSTGRES_INCLUDE_DIR ${POSTGRES_INCLUDE_DIR} CACHE STRING INTERNAL)
SET(POSTGRES_LIBRARY ${PG_TMP}/libpq.so CACHE STRING INTERNAL)
ENDIF(ANDROID)

IF(WIN32 AND NOT ANDROID)
IF (NOT POSTGRES_INCLUDE_DIR)
FIND_PATH(POSTGRES_INCLUDE_DIR libpq-fe.h
/usr/local/include
Expand Down Expand Up @@ -65,7 +70,8 @@ ELSE(WIN32)
ENDIF(POSTGRES_CONFIG)

ENDIF(UNIX)
ENDIF(WIN32)
ENDIF(WIN32 AND NOT ANDROID)


IF (POSTGRES_INCLUDE_DIR AND POSTGRES_LIBRARY)
SET(POSTGRES_FOUND TRUE)
Expand Down
10 changes: 8 additions & 2 deletions src/analysis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ ENDIF (WIN32)
ADD_LIBRARY(qgis_analysis SHARED ${QGIS_ANALYSIS_SRCS} ${QGIS_ANALYSIS_MOC_SRCS} ${QGIS_ANALYSIS_HDRS})

SET_TARGET_PROPERTIES(qgis_analysis PROPERTIES
VERSION ${COMPLETE_VERSION}
SOVERSION ${COMPLETE_VERSION}
# no moc headers, messes up PROPERTIES syntax
PUBLIC_HEADER "${QGIS_ANALYSIS_HDRS}"
CLEAN_DIRECT_OUTPUT 1
Expand All @@ -104,6 +102,14 @@ SET_TARGET_PROPERTIES(qgis_analysis PROPERTIES
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${COMPLETE_VERSION}
MACOSX_FRAMEWORK_IDENTIFIER org.qgis.qgis_analysis)

#generate unversioned libs for android
IF (NOT ANDROID)
SET_TARGET_PROPERTIES(qgis_analysis PROPERTIES
VERSION ${COMPLETE_VERSION}
SOVERSION ${COMPLETE_VERSION}
)
ENDIF (NOT ANDROID)

ADD_DEPENDENCIES(qgis_analysis qgis_core)

TARGET_LINK_LIBRARIES(qgis_analysis
Expand Down
10 changes: 8 additions & 2 deletions src/analysis/network/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ INCLUDE_DIRECTORIES(
ADD_LIBRARY(qgis_networkanalysis SHARED ${QGIS_NETWORK_ANALYSIS_SRCS} ${QGIS_NETWORK_ANALYSIS_MOC_SRCS} ${QGIS_NETWORK_ANALYSIS_HDRS})

SET_TARGET_PROPERTIES(qgis_networkanalysis PROPERTIES
VERSION ${COMPLETE_VERSION}
SOVERSION ${COMPLETE_VERSION}
PUBLIC_HEADER "${QGIS_NETWORK_ANALYSIS_HDRS};${QGIS_NETWORK_ANALYSIS_MOC_HDRS}"
CLEAN_DIRECT_OUTPUT 1
FRAMEWORK 1
Expand All @@ -55,6 +53,14 @@ SET_TARGET_PROPERTIES(qgis_networkanalysis PROPERTIES
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${COMPLETE_VERSION}
MACOSX_FRAMEWORK_IDENTIFIER org.qgis.qgis_networkanalysis)

#generate unversioned libs for android
IF (NOT ANDROID)
SET_TARGET_PROPERTIES(qgis_networkanalysis PROPERTIES
VERSION ${COMPLETE_VERSION}
SOVERSION ${COMPLETE_VERSION}
)
ENDIF (NOT ANDROID)

ADD_DEPENDENCIES(qgis_networkanalysis qgis_core)

TARGET_LINK_LIBRARIES(qgis_networkanalysis
Expand Down
28 changes: 25 additions & 3 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ SET(QGIS_APP_SRCS
gps/qgsgpsmarker.cpp
)

IF (ANDROID)
SET(QGIS_APP_SRCS
${QGIS_APP_SRCS}
qtmain_android.cpp
)
ENDIF (ANDROID)


SET (QGIS_APP_MOC_HDRS
qgisapp.h
Expand Down Expand Up @@ -387,6 +394,10 @@ INCLUDE_DIRECTORIES(
gps
)

IF (ANDROID)
INCLUDE_DIRECTORIES(${ANDROID_NDK_TOOLCHAIN_ROOT}/sysroot/usr/include)
ENDIF (ANDROID)

IF (HAVE_SPATIALITE)
IF (WITH_INTERNAL_SPATIALITE)
INCLUDE_DIRECTORIES(../core/spatialite/headers)
Expand All @@ -410,8 +421,11 @@ IF (POSTGRES_FOUND)
ENDIF (POSTGRES_FOUND)

#############

ADD_EXECUTABLE(${QGIS_APP_NAME} MACOSX_BUNDLE WIN32 ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} ${IMAGE_RCC_SRCS})
IF (ANDROID)
ADD_LIBRARY(${QGIS_APP_NAME} SHARED ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} ${INDEX_SRC} ${QGIS_APP_HDRS} ${QGIS_APP_MOC_HDRS} ${IMAGE_RCC_SRCS})
ELSE (ANDROID)
ADD_EXECUTABLE(${QGIS_APP_NAME} MACOSX_BUNDLE WIN32 ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} ${IMAGE_RCC_SRCS})
ENDIF (ANDROID)

TARGET_LINK_LIBRARIES(${QGIS_APP_NAME}
${QWT_LIBRARY}
Expand All @@ -426,6 +440,10 @@ TARGET_LINK_LIBRARIES(${QGIS_APP_NAME}
qgis_analysis
)

IF (ANDROID)
TARGET_LINK_LIBRARIES(${QGIS_APP_NAME} log)
ENDIF (ANDROID)

IF( WIN32 )
ADD_DEFINITIONS(-DQWT_DLL)
ENDIF( WIN32 )
Expand Down Expand Up @@ -457,7 +475,11 @@ ENDIF(MSVC)

INSTALL(TARGETS ${QGIS_APP_NAME}
BUNDLE DESTINATION ${QGIS_INSTALL_PREFIX}
RUNTIME DESTINATION ${QGIS_BIN_DIR})
RUNTIME DESTINATION ${QGIS_BIN_DIR}
LIBRARY DESTINATION ${QGIS_LIB_DIR}
ARCHIVE DESTINATION ${QGIS_LIB_DIR}
FRAMEWORK DESTINATION ${QGIS_FW_SUBDIR}
PUBLIC_HEADER DESTINATION ${QGIS_INCLUDE_DIR})

IF (APPLE)
INSTALL(CODE "EXECUTE_PROCESS(COMMAND /bin/echo -n \"APPLQGIS\" OUTPUT_FILE \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/../PkgInfo\")")
Expand Down
Loading

0 comments on commit a5b7d6c

Please sign in to comment.