diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c49b373f..0b08034aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,10 @@ # library. You should either keep the default value or only pass a # value of 3.4.0 or lower. -cmake_minimum_required(VERSION 3.4.1) +project( YAP ) + +cmake_minimum_required(VERSION 2.8) + set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}" @@ -104,10 +107,11 @@ if (USE_READLINE) target_link_libraries(libYap ${READLINE_LIBRARIES}) endif (USE_READLINE) + target_link_libraries(libYap m pthread) if (ANDROID) - target_link_libraries(libYap m android log) + target_link_libraries(libYap android log) endif () set_target_properties(libYap diff --git a/CXX/CMakeLists.txt b/CXX/CMakeLists.txt index d714fe4f7..3c9a1efd3 100644 --- a/CXX/CMakeLists.txt +++ b/CXX/CMakeLists.txt @@ -24,8 +24,10 @@ MY_install(TARGETS Yap++ endif() +include_directories ( . ${CMAKE_BINARY_DIR} ${GMP_INCLUDE_DIRS}) + +set( CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${GMP_INCLUDE_DIRS} ) + -include_directories (H include ${CMAKE_BINARY_DIR} ${GMP_INCLUDE_DIR}) -set( CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${GMP_INCLUDE_DIR} ) #set( CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${GMP_LIBRARIES} ) diff --git a/cmake/Config.cmake b/cmake/Config.cmake index 1f9679fcc..7a4a9f839 100644 --- a/cmake/Config.cmake +++ b/cmake/Config.cmake @@ -128,9 +128,9 @@ if (HAVE_LIBANDROID) set(EXTRALIBS ${EXTRALIBS} android) endif (HAVE_LIBANDROID) -check_library_exists(m logf "" HAVE_LIBM) +check_library_exists(m main "" HAVE_LIBM) if (HAVE_LIBM) - set(EXTRALIBS ${EXTRALIBS} m) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} m) endif (HAVE_LIBM) check_library_exists(dl dlopen "" HAVE_LIBDL) @@ -206,6 +206,13 @@ endif (HAVE_LIBLOG) # set(EXTRALIBS ${EXTRALIBS} socket) # endif (HAVE_LIBSOCKET) + +check_library_exists(upthread main "" HAVE_LIBPTHREAD) +if (HAVE_LIBPTHREAD) + set( EXTRALIBS ${EXTRALIBS} pthread) +endif (HAVE_LIBPTHREAD) + + check_library_exists(unicode main "" HAVE_LIBUNICODE) if (HAVE_LIBUNICODE) set(EXTRALIBS ${EXTRALIBS} unicode) diff --git a/libYap.cmakr b/libYap.cmakr deleted file mode 100644 index 97b040025..000000000 --- a/libYap.cmakr +++ /dev/null @@ -1,60 +0,0 @@ - -include (Sources) - -# -include_directories (H H/generated include os OPTYap utf8proc JIT/HPP) -include_directories (BEFORE ${CMAKE_BINARY_DIR}) - - -#utf-8 is not an option -# we use the nice UTF-8 package -#available at the Julia project -include_directories ( utf8proc ) -ADD_SUBDIRECTORY ( utf8proc ) - -find_package (GMP) -macro_log_feature (GMP_FOUND - "GNU libgmp (in some cases MPIR" - "GNU big integers and rationals" - "http://gmplib.org") - set(YAP_SYSTEM_OPTIONS "big_numbers " ${YAP_SYSTEM_OPTIONS}) - -if (GMP_FOUND) -# GMP_FOUND - true if GMP/MPIR was found -# GMP_INCLUDE_DIRS - include search path -# GMP_LIBRARIES - libraries to link with -# GMP_LIBRARY_DLL - library DLL to install. Only available on WIN32. -# GMP_LIBRARIES_DIR - the directory the library we link with is found in. - include_directories (${GMP_INCLUDE_DIRS}) - #add_executable(test ${SOURCES}) -add_library(libGMP SHARED IMPORTED GLOBAL) -set_target_properties(libGMP PROPERTIES IMPORTED_LOCATION ${GMP_LIBRARIES}) - #config.h needs this (TODO: change in code latter) - set( CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${GMP_INCLUDE_DIRS} ) - -endif (GMP_FOUND) - - -include( Threads ) -# -# include OS and I/o stuff -# -# convenience libraries -# OPTYap exports important flags -# -add_subDIRECTORY (OPTYap) - -add_subDIRECTORY (packages/myddas) - - -add_subDIRECTORY (os) - -#bootstrap and saved state -add_subDIRECTORY (pl) - -#C++ interface -add_subDIRECTORY (CXX) - -ADD_SUBDIRECTORY(swi/library) - -ADD_SUBDIRECTORY(library) diff --git a/library/system/CMakeLists.txt b/library/system/CMakeLists.txt index 2b5e5b15b..af67b740a 100644 --- a/library/system/CMakeLists.txt +++ b/library/system/CMakeLists.txt @@ -10,6 +10,7 @@ set (TARGET sys) endif() +if (NOT ANDROID) # # this will support getting better cryptographic support, # but right now Open SSL is not supported enough. @@ -26,6 +27,8 @@ if (OPENSSL_FOUND) check_include_file( "openssl/md5.h" HAVE_OPENSSL_MD5_H ) endif (OPENSSL_FOUND) +endif() + check_library_exists( crypt crypt "" HAVE_LIBCRYPT ) if (HAVE_LIBCRYPT) target_link_libraries(${TARGET} crypt) diff --git a/packages/myddas/sqlite3/CMakeLists.txt b/packages/myddas/sqlite3/CMakeLists.txt index f36f0a805..bdeaae65b 100644 --- a/packages/myddas/sqlite3/CMakeLists.txt +++ b/packages/myddas/sqlite3/CMakeLists.txt @@ -40,6 +40,7 @@ set_property(GLOBAL APPEND PROPERTY COMPILE_DEFINITIONS if (NOT ANDROID) #target_link_libraries(Yapsqlite3 libYap) set_target_properties (Yapsqlite3 PROPERTIES + POSITION_INDEPENDENT_CODE ON PREFIX "" ) diff --git a/utf8proc/CMakeLists.txt b/utf8proc/CMakeLists.txt index f1a39b3ca..bb87930fb 100644 --- a/utf8proc/CMakeLists.txt +++ b/utf8proc/CMakeLists.txt @@ -25,15 +25,17 @@ add_definitions ( -DUTF8PROC_EXPORTS ) + #if (NOT MSVC) #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -std=c99 -pedantic -Wall") #endif () ##SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${my_cxx_flags}" ) #SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${my_cxx_flags}" ) +set_target_properties( utf8proc PROPERTIES POSITION_INDEPENDENT_CODE ON + ) set( CMAKE_REQUIRED_INCLUDES . ${CMAKE_REQUIRED_INCLUDES} ) - set ( YAP_YAPUTF8LIB $ )