2016-07-31 10:56:54 +01:00
|
|
|
# Sets the minimum version of CMake required to build the native
|
|
|
|
# library. You should either keep the default value or only pass a
|
|
|
|
# value of 3.4.0 or lower.
|
2014-12-14 12:05:43 +00:00
|
|
|
|
2016-07-31 10:56:54 +01:00
|
|
|
# Sets the minimum version of CMake required to build the native
|
|
|
|
# library. You should either keep the default value or only pass a
|
|
|
|
# value of 3.4.0 or lower.
|
2015-08-08 15:11:29 +01:00
|
|
|
|
2016-08-03 00:30:02 +01:00
|
|
|
project( YAP )
|
|
|
|
|
|
|
|
cmake_minimum_required(VERSION 2.8)
|
|
|
|
|
2016-08-22 05:34:43 +01:00
|
|
|
# cmake_policy(VERSION 3.4)
|
2016-08-22 05:31:21 +01:00
|
|
|
|
|
|
|
|
2016-07-31 10:56:54 +01:00
|
|
|
set(
|
|
|
|
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)
|
|
|
|
include(MacroLogFeature)
|
|
|
|
include(FindPackageHandleStandardArgs)
|
2016-08-30 14:29:40 +01:00
|
|
|
include (GNUInstallDirs)
|
2016-07-31 10:56:54 +01:00
|
|
|
# Creates and names a library, sets it as either STATIC
|
|
|
|
# or SHARED, and provides the relative paths to its source code.
|
|
|
|
# You can define multiple libraries, and CMake builds it for you.
|
|
|
|
# Gradle automatically packages shared libraries with your APK.
|
2015-06-19 01:30:13 +01: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
|
|
|
|
2016-08-02 01:16:39 +01:00
|
|
|
include_directories ( utf8proc packages/myddas packages/myddas/sqlite3 )
|
|
|
|
if (ANDROID)
|
|
|
|
include_directories ( packages/myddas/sqlite3/Android/jni/sqlite/nativehelper packages/myddas/sqlite3/Android/jni/sqlite )
|
|
|
|
endif (ANDROID)
|
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)
|
|
|
|
add_definitions(= -DMYDDAS_MYSQL=1)
|
2016-05-30 11:23:36 +01:00
|
|
|
endif()
|
2015-06-19 01:30:13 +01:00
|
|
|
|
2016-07-31 10:56:54 +01:00
|
|
|
if (ODBC_FOUND)
|
|
|
|
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)
|
|
|
|
add_definitions(= -DMYDDAS_POSTGRES=1)
|
|
|
|
endif()
|
2014-12-04 07:59:30 +00:00
|
|
|
|
2016-04-05 23:56:25 +01:00
|
|
|
if (ANDROID)
|
2015-03-28 20:08:33 +00:00
|
|
|
|
2016-08-30 14:29:40 +01:00
|
|
|
#
|
|
|
|
# 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}
|
|
|
|
)
|
2016-07-31 10:56:54 +01:00
|
|
|
|
|
|
|
ADD_SUBDIRECTORY(os)
|
|
|
|
ADD_SUBDIRECTORY(OPTYap)
|
|
|
|
ADD_SUBDIRECTORY(packages/myddas)
|
|
|
|
ADD_SUBDIRECTORY(library/random)
|
2016-08-30 14:29:40 +01:00
|
|
|
ADD_SUBDIRECTORY(packages/swig)
|
2016-07-31 10:56:54 +01:00
|
|
|
ADD_SUBDIRECTORY(library/system)
|
|
|
|
ADD_SUBDIRECTORY(utf8proc)
|
|
|
|
ADD_SUBDIRECTORY(CXX)
|
|
|
|
|
|
|
|
else ()
|
|
|
|
set(YLIBS
|
|
|
|
$<TARGET_OBJECTS:libYAPOs>
|
|
|
|
$<TARGET_OBJECTS:libOPTYap>
|
|
|
|
$<TARGET_OBJECTS:myddas>
|
|
|
|
$<TARGET_OBJECTS:Yapsqlite3>
|
|
|
|
$<TARGET_OBJECTS:libswi>
|
|
|
|
$<TARGET_OBJECTS:utf8proc>
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
endif ()
|
|
|
|
|
2016-08-01 12:54:28 +01:00
|
|
|
if (WIN32)
|
|
|
|
list (APPEND YLIBS $<TARGET_OBJECTS:Yap++>)
|
|
|
|
|
|
|
|
endif()
|
|
|
|
|
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
|
|
|
|
|
|
|
|
${ENGINE_SOURCES}
|
|
|
|
${C_INTERFACE_SOURCES}
|
|
|
|
${STATIC_SOURCES}
|
|
|
|
${ALL_SOURCES}
|
2016-08-01 12:54:28 +01:00
|
|
|
${YLIBS}
|
|
|
|
${WINDLLS}
|
2016-07-31 10:56:54 +01:00
|
|
|
)
|
2016-04-08 09:13:45 +01:00
|
|
|
|
2016-08-01 12:54:28 +01:00
|
|
|
include(libYap NO_POLICY_SCOPE)
|
|
|
|
|
2016-01-31 10:42:57 +00:00
|
|
|
|
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-08-01 12:54:28 +01:00
|
|
|
|
2016-06-02 11:52:22 +01:00
|
|
|
if (ANDROID)
|
2016-08-30 14:29:40 +01: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
|
|
|
|
PROPERTIES OUTPUT_NAME Yap
|
2016-06-02 11:52:22 +01:00
|
|
|
)
|
2016-05-31 19:28:29 +01:00
|
|
|
|
2016-08-01 12:54:28 +01:00
|
|
|
|
|
|
|
include(Config NO_POLICY_SCOPE)
|
|
|
|
MY_include(Packages NO_POLICY_SCOPE)
|