droid
This commit is contained in:
parent
45f388156c
commit
d0418167a1
@ -532,8 +532,16 @@ include_directories(utf8proc packages/myddas packages/myddas/sqlite3/src )
|
||||
set_property(SOURCE ${LIBYAP_SOURCES} APPEND PROPERTY COMPILE_DEFINITIONS YAP_KERNEL=1)
|
||||
|
||||
|
||||
IF (WITH_SWIG)
|
||||
find_host_package(SWIG)
|
||||
# macro_log_feature (SWIG_FOUND "Swig"
|
||||
# "Use SWIG Interface Generator "
|
||||
# "http://www.swig.org" ON)
|
||||
ENDIF (WITH_SWIG)
|
||||
|
||||
IF (WITH_MYDDAS)
|
||||
if (ANDROID)
|
||||
include_directories (packages/swig/android)
|
||||
else()
|
||||
|
||||
add_definitions(-DUSE_MYDDAS=1 -DMYDDAS_SQLITE3=1)
|
||||
@ -553,14 +561,6 @@ IF (WITH_MYDDAS)
|
||||
endif(WITH_MYDDAS)
|
||||
|
||||
|
||||
IF (WITH_SWIG)
|
||||
find_host_package(SWIG)
|
||||
# macro_log_feature (SWIG_FOUND "Swig"
|
||||
# "Use SWIG Interface Generator "
|
||||
# "http://www.swig.org" ON)
|
||||
ENDIF (WITH_SWIG)
|
||||
|
||||
|
||||
|
||||
IF (WITH_PYTHON)
|
||||
include(python )
|
||||
|
@ -53,7 +53,6 @@ SET_PROPERTY(SOURCE ${MYDDAS_SOURCES}
|
||||
${MYDDAS_UTIL_SOURCES}
|
||||
${MYDDAS_HEADERS} PROPERTY COMPILE_DEFINITIONS YAP_KERNEL=1 )
|
||||
|
||||
MY_add_dependencies(myddas plmyddas)
|
||||
add_subdirectory(pl)
|
||||
|
||||
|
||||
|
@ -9,74 +9,32 @@ set(MYDDAS_YPP
|
||||
myddas_prolog2sql_optimizer.ypp)
|
||||
|
||||
set(MYDDAS_DRIVERS
|
||||
"myddas_driver.ypp"
|
||||
myddas_driver.ypp
|
||||
)
|
||||
|
||||
|
||||
if (ANDROID)
|
||||
set (MYDDAS_PREFIX ${YAP_INSTALL_DATADIR} )
|
||||
else()
|
||||
set (MYDDAS_PREFIX ${CMAKE_CURRENT_BINARY_DIR} )
|
||||
endif()
|
||||
|
||||
get_property(MYDDAS_FLAGS GLOBAL PROPERTY COMPILE_DEFINITIONS)
|
||||
|
||||
function(cpp_compile output filename)
|
||||
get_filename_component(base ${filename} NAME_WE)
|
||||
set(base_abs ${MYDDAS_PREFIX}/${base})
|
||||
set(outfile ${base_abs}.yap)
|
||||
set(${output} ${${output}} ${outfile} PARENT_SCOPE)
|
||||
IF (MSVC)
|
||||
add_custom_command(
|
||||
OUTPUT ${outfile}
|
||||
COMMAND ${CMAKE_C_COMPILER} ${MYDDAS_FLAGS} /EP /P ${outfile} ${CMAKE_CURRENT_SOURCE_DIR}/${filename}
|
||||
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${filename}")
|
||||
ELSE (MSVC)
|
||||
add_custom_command(
|
||||
OUTPUT ${outfile}
|
||||
COMMAND ${CMAKE_C_COMPILER} ${MYDDAS_FLAGS} -x c -E -P -w ${CMAKE_CURRENT_SOURCE_DIR}/${filename} -o ${outfile}
|
||||
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${filename}")
|
||||
ENDIF (MSVC)
|
||||
set_source_files_properties(${outfile} PROPERTIES GENERATED TRUE)
|
||||
endfunction()
|
||||
|
||||
if (ANDROID)
|
||||
set (MYDDAS_PL_OUTDIR ${YAP_APP_DIR}/src/generated/assets/Yap )
|
||||
else()
|
||||
set (MYDDAS_PL_OUTDIR ${CMAKE_CURRENT_BINARY_DIR} )
|
||||
endif()
|
||||
|
||||
function(cpp_driver output dbms filename)
|
||||
set(outfile ${MYDDAS_PL_OUTDIR}/myddas_${dbms}.yap)
|
||||
set(${output} ${${output}} ${outfile} PARENT_SCOPE)
|
||||
IF (MSVC)
|
||||
add_custom_command(
|
||||
OUTPUT ${outfile}
|
||||
COMMAND ${CMAKE_C_COMPILER} -D${dbms} /EP /P ${outfile} ${CMAKE_CURRENT_SOURCE_DIR}/${filename}
|
||||
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${filename}")
|
||||
else ()
|
||||
add_custom_command(
|
||||
OUTPUT ${outfile}
|
||||
COMMAND ${CMAKE_C_COMPILER} -D${dbms} -x c -E -P -w ${CMAKE_CURRENT_SOURCE_DIR}/${filename} -o ${outfile}
|
||||
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${filename}")
|
||||
ENDIF (MSVC)
|
||||
set_source_files_properties(${outfile} PROPERTIES GENERATED TRUE)
|
||||
endfunction()
|
||||
|
||||
set(MYDDAS_DBMS sqlite3 postgres odbc)
|
||||
|
||||
foreach (file ${MYDDAS_YPP})
|
||||
cpp_compile(MYDDAS_YAP ${file})
|
||||
endforeach ()
|
||||
foreach (driver ${MYDDAS_DBMS})
|
||||
cpp_driver(MYDDAS_YAP ${driver} myddas_driver.ypp)
|
||||
endforeach ()
|
||||
set (MYDDAS_PL_OUTDIR ${YAP_APP_DIR}/src/generated/assets/Yap )
|
||||
get_property(MYDDAS_FLAGS GLOBAL PROPERTY COMPILE_DEFINITIONS)
|
||||
foreach (filename in ${MYDDAS_YPP})
|
||||
get_filename_component(base ${filename} NAME_WE)
|
||||
set(base_abs ${MYDDAS_PL_OUTDIR}/${base})
|
||||
set(outfile ${base_abs}.yap)
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} ${MYDDAS_FLAGS} -x c -E -P -w ${CMAKE_CURRENT_SOURCE_DIR}/${filename} -o ${outfile}
|
||||
)
|
||||
set_source_files_properties(outfile PROPERTIES GENERATED TRUE)
|
||||
endforeach ()
|
||||
foreach (dbms in ${MYDDAS_DBMS} )
|
||||
set(outfile ${MYDDAS_PL_OUTDIR}/myddas_${dbms}.yap)
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} -D${dbms} -x c -E -P -w ${CMAKE_CURRENT_SOURCE_DIR}/myddas_driver.ypp -o ${outfile}
|
||||
)
|
||||
|
||||
list (APPEND MYDDAS_YAP ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/sqlitest.yap ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/chinook.db)
|
||||
add_to_group(MYDDAS_YAP pl_library )
|
||||
set_source_files_properties(outfile PROPERTIES GENERATED TRUE)
|
||||
|
||||
add_custom_target(plmyddas ALL DEPENDS ${MYDDAS_YAP} )
|
||||
endforeach()
|
||||
|
||||
install(FILES ${MYDDAS_YAP}
|
||||
DESTINATION ${YAP_INSTALL_DATADIR}
|
||||
)
|
||||
set( MYDDAS_YAP ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/sqlitest.yap ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/chinook.db)
|
||||
#add_to_group(MYDDAS_YAP pl_library )
|
||||
file(INSTALL ${MYDDAS_YAP}
|
||||
DESTINATION ${MYDDAS_PL_OUTDIR} )
|
||||
|
@ -1,84 +1,68 @@
|
||||
|
||||
# This is a CMake file for SWIG and Android
|
||||
# This is a CMake file for SWIG and Android
|
||||
|
||||
set (SWIG_CXX_DIR ${YAP_APP_DIR}/src/generated/jni)
|
||||
FILE( MAKE_DIRECTORY ${YAP_APP_DIR}/src/generated/java/pt/up/yap/lib )
|
||||
FILE( MAKE_DIRECTORY ${YAP_APP_DIR}/src/generated/assets)
|
||||
FILE( MAKE_DIRECTORY ${YAP_APP_DIR}/src/generated/jni)
|
||||
set ( pllib ${YAP_APP_DIR}/src/generated/assets/Yap )
|
||||
set(JAVA_SWIG_OUTDIR ${CMAKE_SOURCE_DIR}/../yaplib/src/generated/java/pt/up/yap/lib)
|
||||
set(SWIG_CXX_DIR ${CMAKE_BINARY_DIR}/src/generated/jni)
|
||||
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/src/generated/java/pt/up/yap/lib)
|
||||
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/src/generated/assets/Yap/pl)
|
||||
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/src/generated/assets/so)
|
||||
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/src/generated/jni)
|
||||
set(YAP_ASSETS ${CMAKE_SOURCE_DIR}/../yaplib/src/generated/assets/Yap)
|
||||
|
||||
set ( SWIG_SOURCES ${CMAKE_SOURCE_DIR}/packages/swig/yap.i )
|
||||
SET_SOURCE_FILES_PROPERTIES(${SWIG_SOURCES} PROPERTIES CPLUSPLUS ON)
|
||||
set(SWIG_SOURCES ${CMAKE_SOURCE_DIR}/packages/swig/yap.i)
|
||||
SET_SOURCE_FILES_PROPERTIES(${SWIG_SOURCES} PROPERTIES CPLUSPLUS ON)
|
||||
|
||||
include_directories (
|
||||
${CMAKE_SOURCE_DIR}/CXX
|
||||
)
|
||||
set( GMP_ROOT ${CMAKE_SOURCE_DIR}/../gmp/${ANDROID_ABI} )
|
||||
set (GMP_INCLUDE_DIRS ${GMP_ROOT})
|
||||
set (GMP_LIBRARIES ${GMP_ROOT}/libgmp.so)
|
||||
|
||||
#
|
||||
# add_custom_target (pllib
|
||||
# COMMAND ${CMAKE_COMMAND} -E make_directory ${YAP_INSTALL_DATADIR}
|
||||
# COMMAND ${CMAKE_COMMAND} -E copy ${pl_library} ${YAP_INSTALL_DATADIR}
|
||||
# COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/android.yap ${YAP_INSTALL_DATADIR}
|
||||
# DEPENDS ${pl_library}
|
||||
#)
|
||||
#
|
||||
# add_custom_target (pllibpl
|
||||
# COMMAND ${CMAKE_COMMAND} -E make_directory ${YAP_INSTALL_DATADIR}/pl
|
||||
# COMMAND ${CMAKE_COMMAND} -E copy ${pl_boot_library} ${YAP_INSTALL_DATADIR}/pl
|
||||
#DEPENDS pllib ${pl_boot_library}
|
||||
# )
|
||||
# add_custom_target (pllibos ALL
|
||||
# COMMAND ${CMAKE_COMMAND} -E make_directory ${YAP_INSTALL_DATADIR}/os
|
||||
# COMMAND ${CMAKE_COMMAND} -E copy ${pl_os_library} ${YAP_INSTALL_DATADIR}/os
|
||||
#DEPENDS pllibpl ${pl_os_library}
|
||||
# )
|
||||
#
|
||||
# add_custom_command (OUTPUT ${CMAKE_SWIG_OUTPUT}/swig_streamer.cpp
|
||||
# COMMAND ${SWIG_EXECUTABLE} -c++ -java -package ${SWIG_MODULE_NAME} -O -outdir ${CMAKE_SWIG_OUTDIR} -addextern -I${CMAKE_CURRENT_SOURCE_DIR} -o ${CMAKE_SWIG_OUTPUT}/swig_streamer.cpp -oh ${CMAKE_SWIG_OUTPUT}/swig_streamer.hh streamer.i
|
||||
# DEPENDS streamer.i
|
||||
# )
|
||||
#
|
||||
# add_custom_command (OUTPUT ${CMAKE_SWIG_OUTPUT}/yap_swig.cpp
|
||||
# COMMAND ${SWIG_EXECUTABLE} -c++ -java -package ${SWIG_MODULE_NAME} -O -outdir ${CMAKE_SWIG_OUTDIR} -addextern -I${CMAKE_SOURCE_DIR}/CXX -I${CMAKE_SOURCE_DIR}/include -I${CMAKE_SOURCE_DIR}/H -I${CMAKE_SOURCE_DIR}/os -I${CMAKE_SOURCE_DIR}/OPTYap -I${CMAKE_BINARY_DIR} -I${GMP_INCLUDE_DIRS} -DX_API="" -o ${CMAKE_SWIG_OUTPUT}/yap_swig.cpp -oh ${CMAKE_SWIG_OUTPUT}/yap_swig.hh ${SWIG_SOURCES}
|
||||
# DEPENDS pllibos ${SWIG_SOURCES} YAP++)
|
||||
#
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/CXX
|
||||
)
|
||||
set(GMP_ROOT ${CMAKE_SOURCE_DIR}/../gmp/${ANDROID_ABI})
|
||||
set(GMP_INCLUDE_DIRS ${GMP_ROOT})
|
||||
set(GMP_LIBRARIES ${GMP_ROOT}/libgmp.so)
|
||||
|
||||
|
||||
add_library(YAPJava OBJECT
|
||||
${SWIG_CXX_DIR}/streamer_swig.cxx
|
||||
${SWIG_CXX_DIR}/yapi_swig.cxx
|
||||
streamer.cpp
|
||||
)
|
||||
file(INSTALL ${pl_library} DESTINATION ${YAP_ASSETS})
|
||||
file(INSTALL ${CMAKE_CURRENT_SOURCE_DIR}/android.yap DESTINATION ${YAP_ASSETS})
|
||||
|
||||
set_target_properties(YAPJava PROPERTIES LINKER_LANGUAGE CXX)
|
||||
file(INSTALL ${pl_boot_library} DESTINATION ${YAP_ASSETS}/pl)
|
||||
file(INSTALL ${pl_os_library} DESTINATION ${YAP_ASSETS}/os)
|
||||
|
||||
|
||||
execute_process(COMMAND swig -c++ -java -package pt.up.yap.lib -O -outdir ${JAVA_SWIG_OUTDIR} -addextern -I${CMAKE_SOURCE_DIR}/CXX -I${CMAKE_SOURCE_DIR}/include -I${CMAKE_SOURCE_DIR}/H -I${CMAKE_SOURCE_DIR}/os -I${CMAKE_SOURCE_DIR}/OPTYap -I${CMAKE_BINARY_DIR} -I${GMP_INCLUDE_DIRS} -DX_API -o ${SWIG_CXX_DIR}/yapi_swig.cxx ${SWIG_SOURCES}
|
||||
)
|
||||
|
||||
execute_process(COMMAND ${SWIG_EXECUTABLE} -c++ -java -package pt.up.yap.lib -O -outdir ${JAVA_SWIG_OUTDIR} -addextern -I${CMAKE_CURRENT_SOURCE_DIR} -o ${SWIG_CXX_DIR}/streamer_swig.cxx streamer.i
|
||||
)
|
||||
|
||||
|
||||
add_library(YAPJava OBJECT
|
||||
${CMAKE_BINARY_DIR}/src/generated/jni/streamer_swig.cxx
|
||||
${CMAKE_BINARY_DIR}/src/generated/jni/yapi_swig.cxx
|
||||
streamer.cpp
|
||||
)
|
||||
|
||||
set_target_properties(YAPJava PROPERTIES LINKER_LANGUAGE CXX)
|
||||
|
||||
# GMP_FOUND - true if GMP/MPIR was found
|
||||
# GMP_INCLUDE_DIRS - include search path
|
||||
# GMP_LIBRARIES - libraries to link with
|
||||
#config.h needs this (TODO: change in code latter)
|
||||
include_directories( .;${GMP_INCLUDE_DIRS};${CMAKE_SOURCE_DIR}/include;${CMAKE_SOURCE_DIR}/H;${CMAKE_SOURCE_DIR}/H/generated;${CMAKE_SOURCE_DIR}/os;${CMAKE_SOURCE_DIR}/OPTYap;${CMAKE_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR} )
|
||||
|
||||
|
||||
|
||||
include_directories(.;${GMP_INCLUDE_DIRS};${CMAKE_SOURCE_DIR}/include;${CMAKE_SOURCE_DIR}/H;${CMAKE_SOURCE_DIR}/H/generated;${CMAKE_SOURCE_DIR}/os;${CMAKE_SOURCE_DIR}/OPTYap;${CMAKE_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
|
||||
if (FALSE)
|
||||
|
||||
set (SWIG_ADD_MODULE YAPJava SHARED CPLUSPLUS ${SWIG_SOURCES} )
|
||||
# Define swig module with given name and specified language
|
||||
set(SWIG_ADD_MODULE YAPJava SHARED CPLUSPLUS ${SWIG_SOURCES})
|
||||
# Define swig module with given name and specified language
|
||||
|
||||
|
||||
set (SWIG_LINK_LIBRARIES YAPJava YAP++ libYAP )
|
||||
#- Link libraries to swig module
|
||||
set(SWIG_LINK_LIBRARIES YAPJava YAP++ libYAP)
|
||||
#- Link libraries to swig module
|
||||
|
||||
|
||||
add_library (YAPJavaTop SHARED
|
||||
main.cpp main.h
|
||||
)
|
||||
add_library(YAPJavaTop SHARED
|
||||
main.cpp main.h
|
||||
)
|
||||
|
||||
target_link_libraries( YAPJavaTop ${SWIG_MODULE_${YAPJava}_REAL_NAME} YAP++ libYap android)
|
||||
target_link_libraries(YAPJavaTop ${SWIG_MODULE_${YAPJava}_REAL_NAME} YAP++ libYap android)
|
||||
|
||||
endif()
|
||||
endif ()
|
||||
|
Reference in New Issue
Block a user