diff --git a/CMakeLists.txt b/CMakeLists.txt index e84f60e1b..70da63661 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,8 +83,9 @@ endif () ## options: libraries option(WITH_THREADED_CODE "threaded code" ON) +if (NOT ANDROID) option(WITH_MPI "Interface to OpenMPI/MPICH" ON) -option(WITH_READLINE "use readline or libedit" ON) + endif() option(WITH_JIT "just in Time Clause Compilation" OFF) if (APPLE) @@ -539,6 +540,7 @@ endif (HAVE_GCC) # #option (YAP_SWI_IO ON) +#TODO: #TODO: if (WITH_CALL_TRACER) list(APPEND YAP_SYSTEM_OPTIONS "call_tracer " ${YAP_SYSTEM_OPTIONS}) @@ -560,6 +562,47 @@ IF (WITH_R) add_subDIRECTORY(packages/real) ENDIF (WITH_R) + +include(Sources) + + +ADD_SUBDIRECTORY(OPTYap) +ADD_SUBDIRECTORY(os) +ADD_SUBDIRECTORY(library/dialect/swi/fli) +ADD_SUBDIRECTORY(CXX) + +add_subDIRECTORY(utf8proc ) + + if(ANDROID) + + set(CXX_SWIG_OUTDIR ${CMAKE_BINARY_DIR}/packages/swig/android) + add_subdirectory(packages/swig/android) + add_definitions(-DMYDDAS=1 -DEMBEDDED_MYDDAS=1 -DMYDDAS_SQLITE3=1 -DEMBEDDED_SQLITE3=1) + link_directories(${CMAKE_SOURCE_DIR}/../sqlite-android/jni/${CMAKE_ANDROID_ARCH_ABI}) + + else() + add_definitions(-DMYDDAS=1 -DEMBEDDED_MYDDAS=1 -DMYDDAS_SQLITE3=1 ) + +endif() + if (MYSQL_FOUND) + add_definitions( -DMYDDAS_MYSQL=1) + endif () + + if (ODBC_FOUND) + add_definitions( -DMYDDAS_ODBC=1) + endif () + + if (POSTGRES_FOUND) + add_definitions( -DMYDDAS_POSTGRES=1) + endif() +#utf-8 is not aPconn option +# we use the nice UTF-8 package +#available at the Julia project + + +add_subDIRECTORY( packages/myddas ) + + List(APPEND YLIBS $) List(APPEND YLIBS $) List(APPEND YLIBS $) @@ -572,47 +615,11 @@ if (WIN32 OR ANDROID) endif () if (ANDROID) List(APPEND YLIBS $) - List(APPEND YLIBS $) + List(APPEND YLIBS $) endif () endif () -include(Sources) - - - if(ANDROID) - - set(CXX_SWIG_OUTDIR ${CMAKE_BINARY_DIR}/packages/swig/android) - add_subdirectory(packages/swig/android) - add_definitions(-DMYDDAS=1 -DEMBEDDED_MYDDAS=1 -DMYDDAS_SQLITE3=1 -DEMBEDDED_SQLITE3=1) - - else() - add_definitions(-DMYDDAS=1 -DEMBEDDED_MYDDAS=1 -DMYDDAS_SQLITE3=1 ) - -endif() - if (WITH_MYSQL) - add_definitions( -DMYDDAS_MYSQL=1) - endif () - - if (WITH_ODBC) - add_definitions( -DMYDDAS_ODBC=1) - endif () - - if (WITH_POSTGRES) - add_definitions( -DMYDDAS_POSTGRES=1) - endif() -#utf-8 is not aPconn option -# we use the nice UTF-8 package -#available at the Julia project - -ADD_SUBDIRECTORY(OPTYap) -ADD_SUBDIRECTORY(os) -ADD_SUBDIRECTORY(library/dialect/swi/fli) -ADD_SUBDIRECTORY(CXX) - -add_subDIRECTORY(utf8proc ) -add_subDIRECTORY( packages/myddas ) - add_library( # Sets the name of the library. libYap @@ -637,7 +644,7 @@ if (READLINE_FOUND) endif () if (ANDROID) - target_link_libraries(libYap android log) + target_link_libraries(libYap sqliteX android log) endif() if (WIN32) diff --git a/packages/myddas/CMakeLists.txt b/packages/myddas/CMakeLists.txt index 5fd1150d3..e16746177 100644 --- a/packages/myddas/CMakeLists.txt +++ b/packages/myddas/CMakeLists.txt @@ -29,18 +29,14 @@ set(MYDDAS_UTIL_SOURCES myddas_util.c myddas_initialization.c) - -set_property(GLOBAL - APPEND PROPERTY - COMPILE_DEFINITIONS - -DMYDDAS=1) - add_subdirectory(sqlite3) add_subdirectory(mysql) add_subdirectory(odbc) add_subdirectory(postgres) + set(CXX_SWIG_OUTDIR ${CMAKE_BINARY_DIR}/packages/swig/android) + add_component(myddas ${MYDDAS_SOURCES} ${MYDDAS_UTIL_SOURCES} diff --git a/packages/myddas/myddas_initialization.c b/packages/myddas/myddas_initialization.c index 893eb7079..77b94424c 100644 --- a/packages/myddas/myddas_initialization.c +++ b/packages/myddas/myddas_initialization.c @@ -1,7 +1,6 @@ #include #include -#include #include "Yap.h" #include "myddas.h" #ifdef MYDDAS_STATS diff --git a/packages/myddas/myddas_shared.c b/packages/myddas/myddas_shared.c index 94bbb46fa..9061cc05c 100644 --- a/packages/myddas/myddas_shared.c +++ b/packages/myddas/myddas_shared.c @@ -690,6 +690,8 @@ void init_myddas(void) { return; } #if MYDDAS +Yap_InitMYDDAS_SharedPreds(); + Yap_InitBackMYDDAS_SharedPreds(); #define stringify(X) _stringify(X) #define _stringify(X) #X Yap_REGS.MYDDAS_GLOBAL_POINTER = NULL; diff --git a/packages/myddas/mysql/CMakeLists.txt b/packages/myddas/mysql/CMakeLists.txt index f2bc4cd7d..34bb4587b 100644 --- a/packages/myddas/mysql/CMakeLists.txt +++ b/packages/myddas/mysql/CMakeLists.txt @@ -32,7 +32,7 @@ if (WITH_MYSQL) LIBRARY DESTINATION ${YAP_INSTALL_LIBDIR} ) endif() - include_directories(${MYSQL_INCLUDE_DIR} ..) + include_directories(${MYSQL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/..) set_target_properties(YAPmysql PROPERTIES POSITION_INDEPENDENT_CODE ON PREFIX "" diff --git a/packages/myddas/pl/myddas.ypp b/packages/myddas/pl/myddas.ypp index 4fd39e152..40b1ca32e 100644 --- a/packages/myddas/pl/myddas.ypp +++ b/packages/myddas/pl/myddas.ypp @@ -15,8 +15,6 @@ * * *************************************************************************/ -:- load_foreign_files([myddas], [], init_myddas). - #ifdef DEBUG :- yap_flag(single_var_warnings,on). :- yap_flag(write_strings,on). @@ -112,6 +110,8 @@ ]). +:- load_foreign_files([myddas], [], init_myddas). + /* Initialize MYDDAS GLOBAL STRUCTURES */ :- c_db_initialize_myddas. diff --git a/packages/myddas/sqlite3/CMakeLists.txt b/packages/myddas/sqlite3/CMakeLists.txt index 2c0b1c3f8..f06bd65ed 100644 --- a/packages/myddas/sqlite3/CMakeLists.txt +++ b/packages/myddas/sqlite3/CMakeLists.txt @@ -1,7 +1,6 @@ -if (MYDDAS_SQLITE3) - # message( " * Sqlite3 Data-Base (http://www.sqlite3.org), distributed with MYDDAS" ) + if (WITH_SQLITE3) set (SQLITE_TEST sqlitest.yap) @@ -9,10 +8,10 @@ if (MYDDAS_SQLITE3) set( YAPSQLITE3_SOURCES myddas_sqlite3.c - src/sqlite3.h - src/sqlite3ext.h ) + message( " * Sqlite3 Data-Base (http://www.sqlite3.org), distributed with MYDDAS" ) + add_to_dir(SQLITE_DB ${YAP_INSTALL_DATADIR}) add_to_dir( SQLITE_TEST ${YAP_INSTALL_DATADIR}) @@ -23,13 +22,9 @@ if (MYDDAS_SQLITE3) set_property(DIRECTORY APPEND PROPERTY - INCLUDE_DIRECTORIES ${ODBC_INCLUDE_DIRECTORIES} ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR} ) - + INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/src ) - if (ANDROID) - add_definitions(-DSQLITE_FCNTL_MMAP_SIZE=0 ) - endif() add_definitions(-DSQLITE_ENABLE_COLUMN_METADATA=1 ) @@ -42,15 +37,18 @@ set_property(DIRECTORY SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS YAP_KERNEL=1 ) +message("ql ${EMBEDDED_SQLITE3}") + message( " * Sqlite3 Data-Base (http://www.sqlite3.org), distributed with MYDDAS" ) + if ( ANDROID ) + add_definitions(-DSQLITE_FCNTL_MMAP_SIZE=0 ) - list(APPEND YAPSQLITE3_SOURCES src/sqlite3.c) - - if (XXANDROID ) - add_library( YAPsqlite3 OBJECT + add_library( YAPsqlite3 OBJECT ${YAPSQLITE3_SOURCES} ) else() - + + list(APPEND YAPSQLITE3_SOURCES src/sqlite3.c) + add_library( YAPsqlite3 SHARED ${YAPSQLITE3_SOURCES}) diff --git a/packages/myddas/sqlite3/myddas_sqlite3.c b/packages/myddas/sqlite3/myddas_sqlite3.c index 77f214ab5..164ef0b27 100644 --- a/packages/myddas/sqlite3/myddas_sqlite3.c +++ b/packages/myddas/sqlite3/myddas_sqlite3.c @@ -673,7 +673,6 @@ static void Yap_InitBackMYDDAS_SQLITE3Preds(void) { X_API void init_sqlite3(void) { Term cm = CurrentModule; - CurrentModule = MkAtomTerm(Yap_LookupAtom("user")); Yap_InitMYDDAS_SQLITE3Preds(); diff --git a/pl/CMakeLists.txt b/pl/CMakeLists.txt index 032db1ff8..608abad2d 100644 --- a/pl/CMakeLists.txt +++ b/pl/CMakeLists.txt @@ -79,7 +79,7 @@ else () DEPENDS ${CMAKE_TOP_BINARY_DIR}/${YAP_STARTUP} ) add_custom_command(OUTPUT ${CMAKE_TOP_BINARY_DIR}/${YAP_STARTUP} - COMMAND yap-bin -B + COMMAND yap-bin -b VERBATIM DEPENDS ${PL_BOOT_SOURCES} yap-bin )