2016-07-31 10:56:54 +01:00
|
|
|
# value of 3.4.0 or lower.
|
2017-06-13 13:34:17 +01:00
|
|
|
cmake_minimum_required(VERSION 3.4)
|
2014-12-14 12:05:43 +00:00
|
|
|
|
2017-05-08 18:51:29 +01:00
|
|
|
if(COMMAND cmake_policy)
|
|
|
|
cmake_policy(SET CMP0003 NEW)
|
|
|
|
endif(COMMAND cmake_policy)
|
|
|
|
|
2017-02-20 15:28:46 +00:00
|
|
|
# Sets the version of CMake required to build the native
|
|
|
|
# library. You should either keep the default value or pass a
|
2016-07-31 10:56:54 +01:00
|
|
|
# value of 3.4.0 or lower.
|
2017-05-02 07:42:21 +01:00
|
|
|
include(CMakeToolsHelpers OPTIONAL)
|
2015-08-08 15:11:29 +01:00
|
|
|
|
2016-08-03 00:30:02 +01:00
|
|
|
project( YAP )
|
|
|
|
|
2017-07-30 22:24:00 +01:00
|
|
|
include(FeatureSummary)
|
2017-05-08 18:51:29 +01:00
|
|
|
|
2017-06-12 18:02:37 +01:00
|
|
|
set(YAP_APP_DIR "${CMAKE_SOURCE_DIR}/../..")
|
2016-11-08 07:37:36 +00:00
|
|
|
cmake_policy(VERSION 3.4)
|
2016-11-11 07:23:34 +00:00
|
|
|
|
2016-07-31 10:56:54 +01:00
|
|
|
set(
|
2016-12-16 17:22:50 +00:00
|
|
|
CMAKE_MODULE_PATH
|
|
|
|
"${CMAKE_SOURCE_DIR}"
|
|
|
|
"${CMAKE_SOURCE_DIR}/cmake"
|
|
|
|
)
|
2016-05-30 11:23:36 +01:00
|
|
|
|
2016-07-31 10:56:54 +01:00
|
|
|
include(CheckIncludeFiles)
|
2015-06-19 01:30:13 +01:00
|
|
|
include(CheckLibraryExists)
|
|
|
|
include(CheckSymbolExists)
|
|
|
|
include(CheckTypeSize)
|
2016-07-31 10:56:54 +01:00
|
|
|
include(CMakeDependentOption)
|
|
|
|
include(MacroOptionalAddSubdirectory)
|
|
|
|
include(MacroOptionalFindPackage)
|
2017-07-30 22:24:00 +01:00
|
|
|
include(FeatureSummary)
|
2016-07-31 10:56:54 +01:00
|
|
|
include(FindPackageHandleStandardArgs)
|
2016-08-30 14:29:40 +01:00
|
|
|
include (GNUInstallDirs)
|
2016-12-10 07:06:16 +00:00
|
|
|
|
2016-07-31 10:56:54 +01:00
|
|
|
# Creates and names a library, sets it as either STATIC
|
2017-02-20 15:28:46 +00:00
|
|
|
# or SHARED, and provides the relative paths to its source code.z
|
|
|
|
# You can define libraries, and CMake builds it for you.
|
2016-07-31 10:56:54 +01:00
|
|
|
# Gradle automatically packages shared libraries with your APK.
|
2015-06-19 01:30:13 +01:00
|
|
|
|
2016-11-11 07:23:34 +00:00
|
|
|
#cross-compilation support
|
|
|
|
# Search packages for host system instead of packages for target system
|
2017-02-20 15:28:46 +00:00
|
|
|
# in case of cross compilation define these macro by toolchain file
|
2016-11-11 07:23:34 +00:00
|
|
|
if(NOT COMMAND find_host_package)
|
|
|
|
macro(find_host_package)
|
|
|
|
find_package(${ARGN})
|
|
|
|
endmacro()
|
|
|
|
endif()
|
|
|
|
if(NOT COMMAND find_host_program)
|
|
|
|
macro(find_host_program)
|
|
|
|
find_program(${ARGN})
|
|
|
|
endmacro()
|
|
|
|
endif()
|
2015-06-19 01:30:13 +01:00
|
|
|
|
2016-11-23 23:23:59 +00:00
|
|
|
option(BUILD_SHARED_LIBS "Build shared library" ON)
|
2016-12-16 17:22:50 +00:00
|
|
|
set (CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
2017-02-20 15:28:46 +00:00
|
|
|
set (CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
|
2016-11-23 23:23:59 +00:00
|
|
|
|
2016-07-31 10:56:54 +01:00
|
|
|
include(Prelims NO_POLICY_SCOPE)
|
2016-06-02 11:52:22 +01:00
|
|
|
|
2016-07-31 10:56:54 +01:00
|
|
|
include(Sources NO_POLICY_SCOPE)
|
2016-05-30 11:23:36 +01:00
|
|
|
|
2016-07-31 10:56:54 +01:00
|
|
|
include(Model NO_POLICY_SCOPE)
|
2016-05-30 11:23:36 +01:00
|
|
|
|
2017-06-13 13:34:17 +01:00
|
|
|
|
2016-11-24 04:35:39 +00:00
|
|
|
include_directories ( utf8proc packages/myddas packages/myddas/sqlite3/src)
|
2016-11-11 15:53:09 +00:00
|
|
|
|
|
|
|
if (ANDROID)
|
|
|
|
include_directories (
|
2017-06-13 13:34:17 +01:00
|
|
|
packages/myddas/sqlite3/src/Android/jni/sqlite
|
|
|
|
packages/myddas/sqlite3/src/Android/jni/sqlite/nativehelper
|
|
|
|
)
|
|
|
|
endif (ANDROID)
|
2016-11-11 15:53:09 +00:00
|
|
|
|
2017-06-13 13:34:17 +01:00
|
|
|
set_property( SOURCE ${LIBYAP_SOURCES} APPEND PROPERTY COMPILE_DEFINITIONS YAP_KERNEL=1)
|
2017-02-20 15:28:46 +00:00
|
|
|
|
2016-07-31 10:56:54 +01:00
|
|
|
add_definitions(-DUSE_MYDDAS=1 -DMYDDAS_SQLITE3=1)
|
2016-05-30 11:23:36 +01:00
|
|
|
|
2016-07-31 10:56:54 +01:00
|
|
|
if (MYSQL_FOUND)
|
2017-06-13 13:34:17 +01:00
|
|
|
add_definitions(= -DMYDDAS_MYSQL=1)
|
|
|
|
endif()
|
2015-06-19 01:30:13 +01:00
|
|
|
|
2016-07-31 10:56:54 +01:00
|
|
|
if (ODBC_FOUND)
|
2017-06-13 13:34:17 +01:00
|
|
|
add_definitions(= -DMYDDAS_ODBC=1)
|
|
|
|
endif()
|
2014-12-04 07:59:30 +00:00
|
|
|
|
2016-07-31 10:56:54 +01:00
|
|
|
if (MYSQL_POSTGRES)
|
2017-06-13 13:34:17 +01:00
|
|
|
add_definitions(= -DMYDDAS_POSTGRES=1)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
OPTION (WITH_SWIG " Enable SWIG interfaces to foreign languages" ON)
|
2014-12-04 07:59:30 +00:00
|
|
|
|
2017-06-13 13:34:17 +01:00
|
|
|
IF (WITH_SWIG)
|
|
|
|
find_host_package (SWIG)
|
|
|
|
ENDIF (WITH_SWIG)
|
2016-12-16 17:22:50 +00:00
|
|
|
|
2017-06-13 13:34:17 +01:00
|
|
|
option (WITH_PYTHON
|
|
|
|
"Allow Python->YAP and YAP->Python" ON)
|
|
|
|
|
|
|
|
IF (WITH_PYTHON)
|
|
|
|
include(python NO_POLICY_SCOPE)
|
|
|
|
ENDIF (WITH_PYTHON)
|
|
|
|
|
|
|
|
|
|
|
|
IF (SWIG_FOUND)
|
|
|
|
add_subDIRECTORY (packages/swig NO_POLICY_SCOPE)
|
|
|
|
ENDIF(SWIG_FOUND)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ANDROID)
|
2015-03-28 20:08:33 +00:00
|
|
|
|
2016-07-31 10:56:54 +01:00
|
|
|
ADD_SUBDIRECTORY(os)
|
|
|
|
ADD_SUBDIRECTORY(OPTYap)
|
|
|
|
ADD_SUBDIRECTORY(packages/myddas)
|
|
|
|
ADD_SUBDIRECTORY(utf8proc)
|
|
|
|
ADD_SUBDIRECTORY(CXX)
|
|
|
|
|
2016-12-10 07:06:16 +00:00
|
|
|
|
2017-02-20 15:28:46 +00:00
|
|
|
else()
|
2016-07-31 10:56:54 +01:00
|
|
|
|
2017-06-13 13:34:17 +01:00
|
|
|
List (APPEND YLIBS $<TARGET_OBJECTS:libOPTYap> )
|
|
|
|
List (APPEND YLIBS $<TARGET_OBJECTS:libYAPOs> )
|
|
|
|
List (APPEND YLIBS $<TARGET_OBJECTS:utf8proc> )
|
|
|
|
List (APPEND YLIBS $<TARGET_OBJECTS:myddas> )
|
|
|
|
List (APPEND YLIBS $<TARGET_OBJECTS:Yapsqlite3> )
|
|
|
|
List (APPEND YLIBS $<TARGET_OBJECTS:libswi> )
|
|
|
|
if (WIN32)
|
|
|
|
List (APPEND YLIBS $<TARGET_OBJECTS:YAP++> )
|
|
|
|
if (WITH_PYTHON )
|
2017-07-03 21:18:01 +01:00
|
|
|
List (APPEND YLIBS $<TARGET_OBJECTS:Py4YAP> )
|
2017-06-13 13:34:17 +01:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
endif()
|
|
|
|
|
2016-12-03 16:38:07 +00:00
|
|
|
|
|
|
|
|
2016-07-31 10:56:54 +01:00
|
|
|
add_library( # Sets the name of the library.
|
|
|
|
libYap
|
|
|
|
|
|
|
|
# Sets the library as a shared library.
|
|
|
|
SHARED
|
2017-02-20 15:28:46 +00:00
|
|
|
|
|
|
|
${ENGINE_SOURCES}
|
|
|
|
${C_INTERFACE_SOURCES}
|
|
|
|
//${STATIC_SOURCES}
|
|
|
|
# cmake object libraries
|
2016-08-01 12:54:28 +01:00
|
|
|
${YLIBS}
|
2016-07-31 10:56:54 +01:00
|
|
|
)
|
2016-04-08 09:13:45 +01:00
|
|
|
|
2017-02-20 15:28:46 +00:00
|
|
|
if (WIN32)
|
|
|
|
target_link_libraries(libYap ${WINDLLS})
|
2017-06-12 18:00:47 +01:00
|
|
|
if (PYTHON_INCLUDE_DIRS AND PYTHON_LIBRARIES )
|
|
|
|
target_link_libraries(libYap ${PYTHON_LIBRARIES})
|
|
|
|
endif()
|
2017-02-20 15:28:46 +00:00
|
|
|
endif (WIN32)
|
|
|
|
|
2016-08-01 12:54:28 +01:00
|
|
|
include(libYap NO_POLICY_SCOPE)
|
|
|
|
|
2016-07-31 10:56:54 +01:00
|
|
|
if (USE_READLINE)
|
2016-08-01 12:54:28 +01:00
|
|
|
target_link_libraries(libYap ${READLINE_LIBRARIES})
|
2016-07-31 10:56:54 +01:00
|
|
|
endif (USE_READLINE)
|
2014-12-04 07:59:30 +00:00
|
|
|
|
2016-06-02 11:52:22 +01:00
|
|
|
if (ANDROID)
|
2016-11-11 07:23:34 +00:00
|
|
|
add_dependencies(libYap plmyddas )
|
2016-05-31 19:28:29 +01:00
|
|
|
|
2016-08-03 00:30:02 +01:00
|
|
|
target_link_libraries(libYap android log)
|
2016-08-22 05:31:21 +01:00
|
|
|
|
2016-07-31 10:56:54 +01:00
|
|
|
endif ()
|
2016-05-31 19:28:29 +01:00
|
|
|
|
2016-07-31 10:56:54 +01:00
|
|
|
set_target_properties(libYap
|
2017-02-20 15:28:46 +00:00
|
|
|
PROPERTIES OUTPUT_NAME Yap
|
|
|
|
)
|
2016-08-01 12:54:28 +01:00
|
|
|
|
|
|
|
MY_include(Packages NO_POLICY_SCOPE)
|
2017-06-13 13:34:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
if (PYTHONLIBS_FOUND AND SWIG_FOUND)
|
|
|
|
add_subdirectory(packages/python/swig)
|
|
|
|
|
|
|
|
include(FindPythonModule)
|
|
|
|
|
|
|
|
find_python_module( jupyter )
|
|
|
|
|
|
|
|
if (PY_JUPYTER)
|
|
|
|
add_subdirectory(packages/python/yap_kernel)
|
|
|
|
ENDIF()
|
|
|
|
endif()
|
|
|
|
|
2017-02-20 15:28:46 +00:00
|
|
|
include(Config NO_POLICY_SCOPE)
|
2017-07-30 22:24:00 +01:00
|
|
|
|
|
|
|
feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES
|
|
|
|
INCLUDE_QUIET_PACKAGES
|
|
|
|
)
|