cmake vs libraries

This commit is contained in:
Vitor Santos Costa 2016-08-02 18:30:02 -05:00
parent 3ff5ddf04a
commit ca2dfeb51e
7 changed files with 26 additions and 67 deletions

View File

@ -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

View File

@ -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} )

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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 ""
)

View File

@ -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 $<TARGET_FILE_NAME:utf8proc> )