Android support
This commit is contained in:
parent
110a23b209
commit
04ff54917e
@ -18,8 +18,6 @@ set(
|
|||||||
"${CMAKE_SOURCE_DIR}"
|
"${CMAKE_SOURCE_DIR}"
|
||||||
"${CMAKE_SOURCE_DIR}/cmake")
|
"${CMAKE_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
set(LIBYAP_SOURCES ../../externalNativeBuild/swig/yapj.cpp)
|
|
||||||
|
|
||||||
include(CheckIncludeFiles)
|
include(CheckIncludeFiles)
|
||||||
include(CheckLibraryExists)
|
include(CheckLibraryExists)
|
||||||
include(CheckSymbolExists)
|
include(CheckSymbolExists)
|
||||||
@ -29,6 +27,7 @@ include(MacroOptionalAddSubdirectory)
|
|||||||
include(MacroOptionalFindPackage)
|
include(MacroOptionalFindPackage)
|
||||||
include(MacroLogFeature)
|
include(MacroLogFeature)
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
|
include (GNUInstallDirs)
|
||||||
# Creates and names a library, sets it as either STATIC
|
# Creates and names a library, sets it as either STATIC
|
||||||
# or SHARED, and provides the relative paths to its source code.
|
# or SHARED, and provides the relative paths to its source code.
|
||||||
# You can define multiple libraries, and CMake builds it for you.
|
# You can define multiple libraries, and CMake builds it for you.
|
||||||
@ -61,12 +60,33 @@ if (MYSQL_POSTGRES)
|
|||||||
|
|
||||||
if (ANDROID)
|
if (ANDROID)
|
||||||
|
|
||||||
set(ALL_SOURCES ../../externalNativeBuild/swig/yapj.cpp)
|
#
|
||||||
|
# SWIG_FOUND - set to true if SWIG is found
|
||||||
|
# SWIG_DIR - t he directory where swig is installed
|
||||||
|
# SWIG_EXECUTABLE - the path to the swig executable
|
||||||
|
# SWIG_VERSION - the version number of the swig executable
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
set (SWIG_SOURCES ${CMAKE_SOURCE_DIR}/packages/swig/yap.i)
|
||||||
|
set (SWIG_CXX ${CMAKE_BINARY_DIR}/packages/swig/android/yap.cpp)
|
||||||
|
list (APPEND ENGINE_SOURCES ${SWIG_CXX})
|
||||||
|
find_host_package (SWIG)
|
||||||
|
macro_log_feature (SWIG_FOUND "Swig"
|
||||||
|
"Use SWIG Language Interface "
|
||||||
|
"http://www.swig.org" ON)
|
||||||
|
|
||||||
|
|
||||||
|
add_custom_command (OUTPUT ${SWIG_CXX}
|
||||||
|
COMMAND ${SWIG_EXECUTABLE} -java -package pt.up.yap.lib -outdir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/../../../../../generated/src/java -c++ -addextern -I${CMAKE_SOURCE_DIR}/CXX -o ${SWIG_CXX}
|
||||||
|
${SWIG_SOURCES}
|
||||||
|
)
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(os)
|
ADD_SUBDIRECTORY(os)
|
||||||
ADD_SUBDIRECTORY(OPTYap)
|
ADD_SUBDIRECTORY(OPTYap)
|
||||||
ADD_SUBDIRECTORY(packages/myddas)
|
ADD_SUBDIRECTORY(packages/myddas)
|
||||||
ADD_SUBDIRECTORY(library/random)
|
ADD_SUBDIRECTORY(library/random)
|
||||||
|
ADD_SUBDIRECTORY(packages/swig)
|
||||||
ADD_SUBDIRECTORY(library/system)
|
ADD_SUBDIRECTORY(library/system)
|
||||||
ADD_SUBDIRECTORY(utf8proc)
|
ADD_SUBDIRECTORY(utf8proc)
|
||||||
ADD_SUBDIRECTORY(CXX)
|
ADD_SUBDIRECTORY(CXX)
|
||||||
@ -112,6 +132,7 @@ endif (USE_READLINE)
|
|||||||
|
|
||||||
|
|
||||||
if (ANDROID)
|
if (ANDROID)
|
||||||
|
add_dependencies(libYap plmyddas)
|
||||||
|
|
||||||
target_link_libraries(libYap android log)
|
target_link_libraries(libYap android log)
|
||||||
|
|
||||||
|
@ -140,32 +140,18 @@ if(POLICY CMP0043)
|
|||||||
cmake_policy(SET CMP0043 NEW)
|
cmake_policy(SET CMP0043 NEW)
|
||||||
endif(POLICY CMP0043)
|
endif(POLICY CMP0043)
|
||||||
|
|
||||||
if (ANDROID)
|
|
||||||
|
|
||||||
set (prefix ${CMAKE_SOURCE_DIR}/../app/src/main)
|
|
||||||
set ( exec_prefix "${prefix}")
|
|
||||||
set ( libdir "${exec_prefix}/jni/${ANDROID_ABI}")
|
|
||||||
set ( dlls "${libdir}")
|
|
||||||
set ( includedir "${prefix}/assets/include")
|
|
||||||
set ( datarootdir "${prefix}/assets/share")
|
|
||||||
set ( libpl "${prefix}/assets/share/Yap")
|
|
||||||
set ( datadir "${datarootdir}")
|
|
||||||
set ( mandir "${datarootdir}/man")
|
|
||||||
set ( bindir "${exec_prefix}/bin")
|
|
||||||
set ( docdir "${exec_prefix}/assets/share/doc/yap")
|
|
||||||
else()
|
|
||||||
set ( prefix "${CMAKE_INSTALL_PREFIX}")
|
set ( prefix "${CMAKE_INSTALL_PREFIX}")
|
||||||
set ( exec_prefix "${prefix}")
|
set ( exec_prefix "${prefix}")
|
||||||
set ( libdir "${exec_prefix}/lib")
|
set ( libdir "${exec_prefix}/lib")
|
||||||
set ( dlls "${exec_prefix}/lib/Yap")
|
set ( dlls "${exec_prefix}/lib/Yap")
|
||||||
set ( includedir "${prefix}/include")
|
set ( includedir "${prefix}/include")
|
||||||
set ( datarootdir "${prefix}/share")
|
set ( datarootdir "${prefix}/share")
|
||||||
set ( libpl "${prefix}/share/Yap")
|
set ( libpl "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/../../../../../build/generated/assets/share/Yap")
|
||||||
set ( datadir "${datarootdir}")
|
set ( datadir "${datarootdir}")
|
||||||
set ( mandir "${datarootdir}/man")
|
set ( mandir "${datarootdir}/man")
|
||||||
set ( bindir "${exec_prefix}/bin")
|
set ( bindir "${exec_prefix}/bin")
|
||||||
set ( docdir "${exec_prefix}/share/doc/Yap")
|
set ( docdir "${exec_prefix}/share/doc/Yap")
|
||||||
endif()
|
|
||||||
|
|
||||||
set(YAP_ROOTDIR ${prefix})
|
set(YAP_ROOTDIR ${prefix})
|
||||||
|
|
||||||
|
@ -72,8 +72,11 @@ MY_add_subdirectory(rltree)
|
|||||||
MY_add_subdirectory(system)
|
MY_add_subdirectory(system)
|
||||||
MY_add_subdirectory(tries)
|
MY_add_subdirectory(tries)
|
||||||
MY_add_subdirectory(ytest)
|
MY_add_subdirectory(ytest)
|
||||||
MY_add_custom_target (library SOURCES ${LIBRARY_PL} ) # WORKING_DIRECTORY ${CMAKE_BINARY_DIR} )
|
if (ANDROID)
|
||||||
|
file(INSTALL ${LIBRARY_PL} DESTINATION ${libpl})
|
||||||
|
else()
|
||||||
|
|
||||||
install(FILES ${LIBRARY_PL}
|
install(FILES ${LIBRARY_PL}
|
||||||
DESTINATION ${libpl}
|
DESTINATION ${libpl}
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
|
@ -58,9 +58,12 @@ set (YAPOS_HEADERS
|
|||||||
chartypes.yap
|
chartypes.yap
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (ANDROID)
|
||||||
|
file(INSTALL ${YAPOS_PL_SOURCES} DESTINATION ${libpl}/os)
|
||||||
|
else()
|
||||||
install (FILES ${YAPOS_PL_SOURCES}
|
install (FILES ${YAPOS_PL_SOURCES}
|
||||||
DESTINATION ${libpl}/os )
|
DESTINATION ${libpl}/os )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
include(CheckFunctionExists)
|
include(CheckFunctionExists)
|
||||||
@ -118,4 +121,3 @@ endif (READLINE_FOUND)
|
|||||||
set( READLINE_LIBS ${READLINE_LIBRARIES} PARENT_SCOPE)
|
set( READLINE_LIBS ${READLINE_LIBRARIES} PARENT_SCOPE)
|
||||||
|
|
||||||
endif (WITH_READLINE)
|
endif (WITH_READLINE)
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ add_component(myddas
|
|||||||
${MYDDAS_UTIL_SOURCES}
|
${MYDDAS_UTIL_SOURCES}
|
||||||
${MYDDAS_HEADERS}
|
${MYDDAS_HEADERS}
|
||||||
)
|
)
|
||||||
|
|
||||||
MY_add_dependencies(myddas plmyddas)
|
MY_add_dependencies(myddas plmyddas)
|
||||||
add_subdirectory(pl)
|
add_subdirectory(pl)
|
||||||
|
|
||||||
|
@ -12,13 +12,17 @@ set(MYDDAS_DRIVERS
|
|||||||
myddas_driver.ypp
|
myddas_driver.ypp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (ANDROID)
|
||||||
|
set (PREFIX ${libpl} )
|
||||||
|
else()
|
||||||
|
set (PREFIX ${CMAKE_CURRENT_BINARY_DIR} )
|
||||||
|
endif()
|
||||||
|
|
||||||
get_property(MYDDAS_FLAGS GLOBAL PROPERTY COMPILE_DEFINITIONS)
|
get_property(MYDDAS_FLAGS GLOBAL PROPERTY COMPILE_DEFINITIONS)
|
||||||
|
|
||||||
function(cpp_compile output filename)
|
function(cpp_compile output filename)
|
||||||
get_filename_component(base ${filename} NAME_WE)
|
get_filename_component(base ${filename} NAME_WE)
|
||||||
set(base_abs ${CMAKE_CURRENT_BINARY_DIR}/${base})
|
set(base_abs ${PREFIX}/${base})
|
||||||
set(outfile ${base_abs}.yap)
|
set(outfile ${base_abs}.yap)
|
||||||
set(${output} ${${output}} ${outfile} PARENT_SCOPE)
|
set(${output} ${${output}} ${outfile} PARENT_SCOPE)
|
||||||
IF (MSVC)
|
IF (MSVC)
|
||||||
@ -61,9 +65,9 @@ foreach (driver ${MYDDAS_DBMS})
|
|||||||
cpp_driver(MYDDAS_YAP ${driver} myddas_driver.ypp)
|
cpp_driver(MYDDAS_YAP ${driver} myddas_driver.ypp)
|
||||||
endforeach ()
|
endforeach ()
|
||||||
|
|
||||||
MY_add_custom_target(plmyddas ALL DEPENDS ${MYDDAS_YAP}
|
add_custom_target(plmyddas ALL DEPENDS ${MYDDAS_YAP}
|
||||||
|
|
||||||
) # WORKING_DIRECTORY ${CMAKE_BINARY_DIR} )
|
)
|
||||||
|
|
||||||
MY_install(FILES ${MYDDAS_YAP}
|
MY_install(FILES ${MYDDAS_YAP}
|
||||||
DESTINATION ${libpl}
|
DESTINATION ${libpl}
|
||||||
|
@ -1,19 +1,15 @@
|
|||||||
|
|
||||||
# This is a CMake example for Python and Java
|
# This is a CMake example for Python and Java
|
||||||
|
|
||||||
INCLUDE(UseSWIG)
|
|
||||||
INCLUDE(UseJava)
|
INCLUDE(UseJava)
|
||||||
|
|
||||||
SET(CMAKE_SWIG_FLAGS -package pt.up.yap.lib)
|
|
||||||
|
|
||||||
SET(SWIG_SOURCES
|
|
||||||
../yap.i
|
|
||||||
)
|
|
||||||
|
|
||||||
# set(ANDROID_SO_OUTDIR ${libdir})
|
# set(ANDROID_SO_OUTDIR ${libdir})
|
||||||
# set(CMAKE_SWIG_OUTDIR ${CMAKE_SOURCE_DIR}/android/yaplib/build/generated/source/pt/up/yap/lib)
|
# set(CMAKE_SWIG_OUTDIR ${CMAKE_SOURCE_DIR}/android/yaplib/build/generated/source/pt/up/yap/lib)
|
||||||
#set(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}/derived)
|
#set(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}/derived)
|
||||||
|
|
||||||
|
|
||||||
SET_SOURCE_FILES_PROPERTIES(${SWIG_SOURCES} PROPERTIES CPLUSPLUS ON)
|
SET_SOURCE_FILES_PROPERTIES(${SWIG_SOURCES} PROPERTIES CPLUSPLUS ON)
|
||||||
|
|
||||||
include_directories (
|
include_directories (
|
||||||
@ -22,55 +18,8 @@
|
|||||||
${JNI_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 -Wno-strict-aliasing")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set (CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "")
|
add_custom_command (OUTPUT ${SWIG_CXX}
|
||||||
|
COMMAND ${SWIG} -java -outdir ${CMAKE_CURRENT_BINARY_DIR} -c++ -addextern -I${CMAKE_SOURCE_DIR}/CXX ${SWIG_SOURCES} -o ${SWIG_CXX}
|
||||||
if (ANDROID)
|
${SWIG_SOURCES}
|
||||||
SWIG_ADD_MODULE(YAPDroid java ${SWIG_SOURCES} )
|
|
||||||
|
|
||||||
ADD_LIBRARY( YAPAndroid OBJECT ${swig_generated_file_fullname})
|
|
||||||
else()
|
|
||||||
SWIG_LINK_LIBRARIES (YAPDroid Yap++ )
|
|
||||||
set (LIBDIR ${CMAKE_SOURCE_DIR}/YAPDroid/app/libs/${ANDROID_ABI})
|
|
||||||
|
|
||||||
|
|
||||||
add_custom_command (TARGET YAPDroid
|
|
||||||
POST_BUILD
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${LIBDIR}
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:YAPDroid> ${LIBDIR}
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:libYap> ${LIBDIR}
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:Yap++> ${LIBDIR}
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:Yapsqlite3> ${LIBDIR}
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:utf8proc> ${LIBDIR}
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${GMP_LIBRARIES} ${LIBDIR}
|
|
||||||
DEPENDS YAPDroid
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# set( LIBDIR ${CMAKE_SOURCE_DIR}/YAPDroid/app/src/main/jniLibs/${ANDROID_ABI})
|
|
||||||
|
|
||||||
# add_custom_command(TARGET YAPDroid
|
|
||||||
# COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_SOURCE_DIR}/YAPDroid/app/src/main/java/pt/up/yap/lib
|
|
||||||
# COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SWIG_OUTDIR} ${CMAKE_SOURCE_DIR}/YAPDroid/app/src/main/java/pt/up/yap/lib
|
|
||||||
# COMMAND ${CMAKE_COMMAND} -E make_directory ${LIBDIR}
|
|
||||||
# COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:YAPDroid> ${LIBDIR}
|
|
||||||
# COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:libYap> ${LIBDIR}
|
|
||||||
# COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:Yap++> ${LIBDIR}
|
|
||||||
# COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:Yapsqlite3> ${LIBDIR}
|
|
||||||
# COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:utf8proc> ${LIBDIR}
|
|
||||||
# COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_SOURCE_DIR}/YAPDroid/app/src/main/java/org/sqlite/database
|
|
||||||
# COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/packages/myddas/sqlite3/Android/src/org/sqlite/database
|
|
||||||
# ${CMAKE_SOURCE_DIR}/android/app/src/main/java/org/sqlite/database
|
|
||||||
# POST_BUILD
|
|
||||||
# )
|
|
||||||
|
|
||||||
install(TARGETS YAPDroid
|
|
||||||
LIBRARY DESTINATION ${dlls}
|
|
||||||
ARCHIVE DESTINATION ${dlls}
|
|
||||||
)
|
)
|
||||||
|
@ -55,8 +55,11 @@ set(PL_SOURCES
|
|||||||
yio.yap
|
yio.yap
|
||||||
)
|
)
|
||||||
|
|
||||||
if (NOT ANDROID)
|
if (ANDROID)
|
||||||
|
message("${libpl}")
|
||||||
|
file(INSTALL ${PL_SOURCES} DESTINATION ${libpl}/pl)
|
||||||
|
|
||||||
|
else()
|
||||||
add_custom_target (${YAP_STARTUP} ALL SOURCES ${PL_SOURCES} ${YAPOS_PL_SOURCES} WORKING_DIRECTORY ${CMAKE_BINARY_DIR} )
|
add_custom_target (${YAP_STARTUP} ALL SOURCES ${PL_SOURCES} ${YAPOS_PL_SOURCES} WORKING_DIRECTORY ${CMAKE_BINARY_DIR} )
|
||||||
|
|
||||||
# Create a startup.yss on the top directory.
|
# Create a startup.yss on the top directory.
|
||||||
@ -73,7 +76,7 @@ install (FILES ${CMAKE_TOP_BINARY_DIR}/${YAP_STARTUP}
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
endif (NOT ANDROID)
|
endif (ANDROID)
|
||||||
|
|
||||||
|
|
||||||
install (FILES ${PL_SOURCES}
|
install (FILES ${PL_SOURCES}
|
||||||
|
@ -37,7 +37,12 @@ set (LIBRARY_PL
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if (ANDROID)
|
||||||
|
file(INSTALL ${LIBRARY_PL} DESTINATION ${libpl})
|
||||||
|
else()
|
||||||
|
|
||||||
install(FILES ${LIBRARY_PL}
|
install(FILES ${LIBRARY_PL}
|
||||||
DESTINATION ${libpl}
|
DESTINATION ${libpl}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
endif()
|
||||||
|
Reference in New Issue
Block a user