This commit is contained in:
Vitor Santos Costa 2016-04-05 23:56:25 +01:00
parent da315b2688
commit b7eb38fc44
7 changed files with 180 additions and 21 deletions

2
.gitignore vendored
View File

@ -140,7 +140,7 @@ Release
Build
xcode
Threads
android
droid
mxe
caret
codelite

View File

@ -135,17 +135,15 @@ set (BUILD_SHARED_LIBS ON)
include (Sources)
if (ANDROID)
if (YAP_SINGLE_FILE)
set(YAP_MODULES
$<TARGET_OBJECTS:Yapsqlite3>
$<TARGET_OBJECTS:Yap++>
$<TARGET_OBJECTS:utf8proc>
)
set(CMAKE_INSTALL_PREFIX
${CMAKE_BINARY_DIR}/packages/swig/android/assets)
else()
else(YAP_SINGLE_FILE)
set( UTF8PROC_DL utf8proc)
endif()
endif(YAP_SINGLE_FILE)
add_library(libYap
@ -185,6 +183,20 @@ set(CMAKE_TOP_BINARY_DIR ${CMAKE_BINARY_DIR})
set(YAP_PL_SRCDIR ${CMAKE_SOURCE_DIR}/pl)
# Compatibility vars with autotols
if (ANDROID)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/packages/swig/android)
set ( prefix "${CMAKE_INSTALL_PREFIX}")
set ( exec_prefix "${prefix}")
set ( libdir "${exec_prefix}/libs/${ANDROID_ABI}")
set ( dlls "${libdir}")
set ( includedir "${prefix}/assets/include")
set ( datarootdir "${prefix}/assets/share")
set ( libpl "${datarootdir}/Yap")
set ( datadir "${datarootdir}")
set ( mandir "${datarootdir}/assets/man")
set ( bindir "${exec_prefix}/bin")
set ( docdir "${exec_prefix}/share/doc/Yap")
else()
set ( prefix "${CMAKE_INSTALL_PREFIX}")
set ( exec_prefix "${prefix}")
set ( libdir "${exec_prefix}/lib")
@ -196,6 +208,7 @@ set ( datadir "${datarootdir}")
set ( mandir "${datarootdir}/man")
set ( bindir "${exec_prefix}/bin")
set ( docdir "${exec_prefix}/share/doc/Yap")
endif()
set(YAP_ROOTDIR ${prefix})

View File

@ -15,14 +15,10 @@ set (CXX_SOURCES
)
if (ANDROID)
add_library (Yap++ OBJECT
${CXX_SOURCES}
)
else()
add_library (Yap++ SHARED
${CXX_SOURCES}
)
if (YAP_SINGLE_FILE)
add_library (Yap++ OBJECT ${CXX_SOURCES} )
else(YAP_SINGLE_FILE)
add_library (Yap++ SHARED ${CXX_SOURCES} )
target_link_libraries(Yap++ ${CMAKE_DL_LIBS} libYap)
@ -30,7 +26,7 @@ install(TARGETS Yap++
LIBRARY DESTINATION ${libdir}
ARCHIVE DESTINATION ${libdir}
)
endif()
endif(YAP_SINGLE_FILE)
include_directories (H include ${CMAKE_BINARY_DIR} ${GMP_INCLUDE_DIR})

View File

@ -33,9 +33,9 @@ set (SQLITE3_FOUND ON PARENT_SCOPE)
set (MYDDAS_FLAGS ${MYDDAS_FLAGS} -DMYDDAS_SQLITE3=1 PARENT_SCOPE)
set_property( DIRECTORY .. APPEND PROPERTY COMPILE_DEFINITIONS MYDDAS_SQLITE3=1 )
if (ANDROID)
if (YAP_SINGLE_FILE)
add_library (Yapsqlite3 OBJECT ${YAPSQLITE3_SOURCES} ${YAPSQLITE3_ANDROID_SOURCES})
else()
else(YAP_SINGLE_FILE)
add_library (Yapsqlite3 SHARED ${YAPSQLITE3_SOURCES})
target_link_libraries(Yapsqlite3 libYap)
set_target_properties (Yapsqlite3 PROPERTIES
@ -47,4 +47,4 @@ set (SQLITE3_FOUND ON PARENT_SCOPE)
LIBRARY DESTINATION ${libdir}
ARCHIVE DESTINATION ${libdir}
)
endif()
endif(YAP_SINGLE_FILE)

View File

@ -0,0 +1,146 @@
set (ANDROID_SOURCES
JavaYap.java
main.xml
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/DatabaseErrorHandler.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/SQLException.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/DefaultDatabaseErrorHandler.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/package.html
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/ExtraUtils.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/CloseGuard.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/DatabaseObjectNotClosedException.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteAbortException.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteAccessPermException.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteBindOrColumnIndexOutOfRangeException.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteBlobTooBigException.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteCantOpenDatabaseException.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteClosable.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteConnection.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteConnectionPool.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteConstraintException.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteCursor.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteCursorDriver.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteCustomFunction.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteDatabase.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteDatabaseConfiguration.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteDatabaseCorruptException.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteDatabaseLockedException.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteDatatypeMismatchException.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteDebug.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteDirectCursorDriver.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteDiskIOException.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteDoneException.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteException.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteFullException.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteGlobal.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteMisuseException.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteOpenHelper.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteOutOfMemoryException.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteProgram.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteQuery.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteReadOnlyDatabaseException.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteSession.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteStatement.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteStatementInfo.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteTableLockedException.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SQLiteTransactionListener.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/SqliteWrapper.java
${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database/sqlite/package.html
)
set (target Yap)
add_custom_target (${target} ALL
SOURCES ${ANDROID_SOURCES}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} )
# set the output directory for the .so files to point to the project's 'lib/[cpuarch] directory
set(ANDROID_SO_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}/libs/${ANDROID_ABI})
set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${ANDROID_SO_OUTDIR})
set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_RELEASE ${ANDROID_SO_OUTDIR})
set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_DEBUG ${ANDROID_SO_OUTDIR})
INCLUDE(${SWIG_USE_FILE})
# SET(CMAKE_SWIG_FLAGS -package YAP)
set (CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}/src/pt/up/fc/dcc/yap )
SET(SWIG_SOURCES
../yap.i
)
#set (CMAKE_JAVA_CLASS_OUTPUT_PATH java)
SET_SOURCE_FILES_PROPERTIES(${SWIG_SOURCES} PROPERTIES CPLUSPLUS ON)
include_directories (
${CMAKE_SOURCE_DIR}/CXX
${JAVA_INCLUDE_DIRS}
${JNI_INCLUDE_DIRS}
)
if ( ${C_COMPILER} MATCHES "Clang")
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-prototypes")
endif()
if ( ${C_COMPILER} MATCHES "GNU")
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-declarations")
endif()
#SET(CMAKE_SWIG_FLAGS "${CMAKE_SWIG_FLAGS} ")
set (CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "")
SWIG_ADD_MODULE(YapDroid java ${SWIG_SOURCES}
)
set_target_properties(YapDroid PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${ANDROID_SO_OUTDIR})
SWIG_LINK_LIBRARIES (YapDroid Yap++ )
#The output directory for the shared library linker step is redirected to the libs subdirectory of this skeleton project:
execute_process(
COMMAND ${ANDROID_SDK_TOOL} create project
--path ${CMAKE_CURRENT_BINARY_DIR}
--target $ENV{ANDROID_TARGET}
--name ${target}
--package pt.up.fc.dcc.${target}
--activity JavaYap
)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/assets/share/Yap)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/assets/lib/Yap)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/assets/lib/Yap)
file(COPY JavaYap.java DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src/pt/up/fc/dcc/app)
file(COPY main.xml DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/res/layout)
file(COPY package.html DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src/pt/up/fc/dcc/Yap)
file(COPY ${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src/org/sqlite)
file(COPY ${GMP_LIBRARIES} DESTINATION ${ANDROID_SO_OUTDIR})
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(ANT_BUILD_TYPE "debug")
else()
set(ANT_BUILD_TYPE "release")
endif()
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${ANDROID_SDK_TOOL} update project
--path ${CMAKE_CURRENT_BINARY_DIR}
)
INSTALL( CODE " execute_process(COMMAND ${ANDROID_ANT} ${ANT_BUILD_TYPE}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})" )
#set( ANDROID_ASSETS_DIRECTORIES ${CMAKE_SOURCE_DIR}/pl;${CMAKE_SOURCE_DIR}/library} )
#set( ANDROID_JAVA_SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR} )
#set( ANDROID_NATIVE_LIB_DEPENDENCIES YapDroid )
#set( ANDROID_NATIVE_LIB_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR} )
#set (ANDROID_GUI ON)
#add_executable (yapdroid JavaYap.java )
#set_target_properties (yapdroid PROPERTIES OUTPUT_NAME yap)
#target_link_libraries(yapdroid ${SWIG_MODULE_${YapDroid≈}_REAL_NAME}. )

View File

@ -246,6 +246,10 @@ public class JavaYap extends Activity
System.loadLibrary("android");
System.loadLibrary("log");
System.loadLibrary("gmp");
System.loadLibrary("sqlite3");
System.loadLibrary("utf8proc");
System.loadLibrary("Yap");
System.loadLibrary("Yap++");
System.loadLibrary("YapDroid");
}

View File

@ -26,12 +26,12 @@ endif ()
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${my_cxx_flags}" )
SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${my_cxx_flags}" )
if (ANDROID)
if (YAP_SINGLE_FILE)
add_library (utf8proc OBJECT
utf8proc.c
utf8proc.h
)
else(ANDROID)
else(YAP_SINGLE_FILE)
add_library (utf8proc SHARED
utf8proc.c
utf8proc.h
@ -42,7 +42,7 @@ install(TARGETS utf8proc
LIBRARY DESTINATION ${libdir}
ARCHIVE DESTINATION ${libdir})
endif(ANDROID)
endif(YAP_SINGLE_FILE)
set_target_properties (utf8proc PROPERTIES
POSITION_INDEPENDENT_CODE ON