new make setup
This commit is contained in:
parent
73b10e7207
commit
37ddd18a9d
182
Prelims.cmake
Normal file
182
Prelims.cmake
Normal file
@ -0,0 +1,182 @@
|
||||
|
||||
#begining stuff for top CMakeLists
|
||||
|
||||
include (MacroLogFeature)
|
||||
|
||||
|
||||
if (ANDROID)
|
||||
macro ( MY_add_custom_target)
|
||||
endmacro()
|
||||
else()
|
||||
macro ( MY_add_custom_target )
|
||||
add_custom_target (${ARGN})
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
|
||||
if (ANDROID)
|
||||
macro ( add_component arg1)
|
||||
foreach(item ${ARGN})
|
||||
get_filename_component(i ${item} ABSOLUTE)
|
||||
set( ALL_SOURCES ${ALL_SOURCES} ${i} )
|
||||
endforeach()
|
||||
set( ALL_SOURCES ${ALL_SOURCES} PARENT_SCOPE )
|
||||
endmacro()
|
||||
macro ( add_external arg1)
|
||||
foreach(item ${ARGN})
|
||||
get_filename_component(i ${item} ABSOLUTE)
|
||||
set( ALL_SOURCES ${ALL_SOURCES} ${i} )
|
||||
endforeach()
|
||||
set( ALL_SOURCES ${ALL_SOURCES} PARENT_SCOPE )
|
||||
endmacro()
|
||||
else()
|
||||
macro ( add_component arg1 )
|
||||
add_library ( ${arg1} OBJECT ${ARGN})
|
||||
endmacro()
|
||||
macro ( add_external arg1 )
|
||||
add_library ( ${arg1} SHARED ${ARGN})
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
if (ANDROID)
|
||||
macro ( MY_add_dependencies)
|
||||
endmacro()
|
||||
else()
|
||||
macro ( MY_add_dependencies )
|
||||
add_dependencies (${ARGN})
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
if (ANDROID)
|
||||
macro ( MY_add_library)
|
||||
endmacro()
|
||||
else()
|
||||
macro ( MY_add_library )
|
||||
add_library (${ARGN})
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
if (ANDROID)
|
||||
macro ( MY_add_subdirectory)
|
||||
endmacro()
|
||||
else()
|
||||
macro ( MY_add_subdirectory )
|
||||
add_subdirectory (${ARGN})
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
if (ANDROID)
|
||||
macro ( MY_include)
|
||||
endmacro()
|
||||
else()
|
||||
macro ( MY_include )
|
||||
include (${ARGN})
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
if (ANDROID)
|
||||
macro ( MY_install)
|
||||
endmacro()
|
||||
else()
|
||||
macro ( MY_install )
|
||||
install (${ARGN})
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
if (ANDROID)
|
||||
macro ( MY_set_target_properties)
|
||||
endmacro()
|
||||
else()
|
||||
macro ( MY_set_target_properties )
|
||||
set_target_properties (${ARGN})
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
if (ANDROID)
|
||||
macro ( MY_target_link_libraries)
|
||||
endmacro()
|
||||
else()
|
||||
macro ( MY_target_link_libraries )
|
||||
target_link_libraries (${ARGN})
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
|
||||
#cross-compilation support
|
||||
# Search packages for host system instead of packages for target system
|
||||
# in case of cross compilation these macro should be defined by toolchain file
|
||||
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()
|
||||
|
||||
# where we have most scripts
|
||||
# set path to additional CMake modules
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
include(disallow)
|
||||
|
||||
disallow_intree_builds()
|
||||
|
||||
# set(CMAKE_BUILD_TYPE Debug)
|
||||
|
||||
if (APPLE)
|
||||
set (MACOSX_RPATH ON)
|
||||
endif (APPLE )
|
||||
if(POLICY CMP0042)
|
||||
cmake_policy(SET CMP0042 NEW)
|
||||
endif(POLICY CMP0042)
|
||||
if(POLICY CMP0043)
|
||||
cmake_policy(SET CMP0043 NEW)
|
||||
endif(POLICY CMP0043)
|
||||
|
||||
if (ANDROID)
|
||||
|
||||
set (prefix ${CMAKE_SOURCE_DIR}/../app/src/main)
|
||||
set ( exec_prefix "${prefix}")
|
||||
set ( libdir "${exec_prefix}/jni/${ANDROID_ABI}")
|
||||
set ( dlls "${libdir}")
|
||||
set ( includedir "${prefix}/assets/include")
|
||||
set ( datarootdir "${prefix}/assets/share")
|
||||
set ( libpl "${prefix}/assets/share/Yap")
|
||||
set ( datadir "${datarootdir}")
|
||||
set ( mandir "${datarootdir}/man")
|
||||
set ( bindir "${exec_prefix}/bin")
|
||||
set ( docdir "${exec_prefix}/assets/share/doc/yap")
|
||||
else()
|
||||
set ( prefix "${CMAKE_INSTALL_PREFIX}")
|
||||
set ( exec_prefix "${prefix}")
|
||||
set ( libdir "${exec_prefix}/lib")
|
||||
set ( dlls "${exec_prefix}/lib/Yap")
|
||||
set ( includedir "${prefix}/include")
|
||||
set ( datarootdir "${prefix}/share")
|
||||
set ( libpl "${prefix}/share/Yap")
|
||||
set ( datadir "${datarootdir}")
|
||||
set ( mandir "${datarootdir}/man")
|
||||
set ( bindir "${exec_prefix}/bin")
|
||||
set ( docdir "${exec_prefix}/share/doc/Yap")
|
||||
endif()
|
||||
|
||||
set(YAP_ROOTDIR ${prefix})
|
||||
|
||||
# erootdir -> rootdir
|
||||
# bindir defined above
|
||||
# libdir defined above
|
||||
set(YAP_LIBDIR "${dlls}")
|
||||
set(YAP_SHAREDIR "${datarootdir}")
|
||||
set(YAP_BINDIR "${bindir}")
|
||||
set(YAP_INCLUDEDIR "${includedir}")
|
||||
set(YAP_ROOTDIR "${prefix}")
|
||||
|
||||
#
|
||||
#
|
||||
# include( Sources NO_POLICY_SCOPE )
|
||||
#
|
||||
# include( Model NO_POLICY_SCOPE )
|
63
Threads.cmake
Normal file
63
Threads.cmake
Normal file
@ -0,0 +1,63 @@
|
||||
|
||||
|
||||
macro_optional_find_package (Threads OFF)
|
||||
macro_log_feature (THREADS_FOUND "Threads Support"
|
||||
"GNU Threads Library (or similar)"
|
||||
"http://www.gnu.org/software/threads")
|
||||
if (WITH_Threads)
|
||||
#
|
||||
# CMAKE_THREAD_LIBS_INIT - the thread library
|
||||
# CMAKE_USE_SPROC_INIT - are we using sproc?
|
||||
# CMAKE_USE_WIN32_THREADS_INIT - using WIN32 threads?
|
||||
# CMAKE_USE_PTHREADS_INIT - are we using pthreads
|
||||
# CMAKE_HP_PTHREADS_INIT - are we using hp pthreads
|
||||
#
|
||||
# The following import target is created
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# Threads::Threads
|
||||
#
|
||||
# For systems with multiple thread libraries, caller can set
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# CMAKE_THREAD_PREFER_PTHREAD
|
||||
#
|
||||
# If the use of the -pthread compiler and linker flag is prefered then the
|
||||
# caller can set
|
||||
#
|
||||
# ::
|
||||
#
|
||||
set( THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
|
||||
if (CMAKE_USE_PTHREADS_INIT)
|
||||
target_link_libraries(libYap pthread)
|
||||
set (HAVE_READLINE_READLINE_H 1)
|
||||
# set( CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )
|
||||
check_function_exists( pthread_mutexattr_setkind_np HAVE_PTHREAD_MUTEXATTR_SETKIND_NP )
|
||||
check_function_exists( pthread_mutexattr_settype HAVE_PTHREAD_MUTEXATTR_SETTYPE )
|
||||
check_function_exists( pthread_setconcurrency HAVE_PTHREAD_SETCONCURRENCY )
|
||||
endif (CMAKE_USE_PTHREADS_INIT)
|
||||
set(YAP_SYSTEM_OPTIONS "threads " ${YAP_SYSTEM_OPTIONS})
|
||||
set_property( DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS THREADS=1)
|
||||
#
|
||||
# Please note that the compiler flag can only be used with the imported
|
||||
# target. Use of both the imported target as well as this switch is highly
|
||||
# recommended for new code.
|
||||
endif (WITH_Threads)
|
||||
|
||||
|
||||
cmake_dependent_option (WITH_Pthread_Locking
|
||||
"use pthread locking primitives for internal locking" ON
|
||||
"WITH_Threads" OFF)
|
||||
|
||||
IF(WITH_Pthread_Lockin)
|
||||
set_DIRECTORY_properties(PROPERTIES APPEND COMPILE_DEFINITIONS USE_PTHREAD_LOCKING=1)
|
||||
ENDIF()
|
||||
|
||||
CMAKE_DEPENDENT_OPTION (WITH_MAX_Threads 1024
|
||||
"maximum number of threads" "WITH_Threads" 1)
|
||||
|
||||
CMAKE_DEPENDENT_OPTION (WITH_MAX_Workers 64
|
||||
"maximum number of or-parallel workers" "WITH_MAX_Workers" 1)
|
Reference in New Issue
Block a user