summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rwxr-xr-xcmake/config-ix.cmake49
-rwxr-xr-xcmake/modules/AddLLVM.cmake22
-rw-r--r--cmake/modules/GetTargetTriple.cmake11
-rw-r--r--cmake/modules/LLVMLibDeps.cmake1
4 files changed, 70 insertions, 13 deletions
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index acf3a2e..3a2b91c 100755
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -4,6 +4,11 @@ include(CheckSymbolExists)
include(CheckFunctionExists)
include(CheckCXXSourceCompiles)
+if( UNIX )
+ # Used by check_symbol_exists:
+ set(CMAKE_REQUIRED_LIBRARIES m)
+endif()
+
# Helper macros and functions
macro(add_cxx_include result files)
set(${result} "")
@@ -39,7 +44,9 @@ check_include_file(malloc.h HAVE_MALLOC_H)
check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H)
check_include_file(memory.h HAVE_MEMORY_H)
check_include_file(ndir.h HAVE_NDIR_H)
-check_include_file(pthread.h HAVE_PTHREAD_H)
+if( NOT LLVM_ON_WIN32 )
+ check_include_file(pthread.h HAVE_PTHREAD_H)
+endif()
check_include_file(setjmp.h HAVE_SETJMP_H)
check_include_file(signal.h HAVE_SIGNAL_H)
check_include_file(stdint.h HAVE_STDINT_H)
@@ -63,10 +70,12 @@ check_include_file(utime.h HAVE_UTIME_H)
check_include_file(windows.h HAVE_WINDOWS_H)
# library checks
-check_library_exists(pthread pthread_create "" HAVE_LIBPTHREAD)
-check_library_exists(pthread pthread_getspecific "" HAVE_PTHREAD_GETSPECIFIC)
-check_library_exists(pthread pthread_rwlock_init "" HAVE_PTHREAD_RWLOCK_INIT)
-check_library_exists(dl dlopen "" HAVE_LIBDL)
+if( NOT LLVM_ON_WIN32 )
+ check_library_exists(pthread pthread_create "" HAVE_LIBPTHREAD)
+ check_library_exists(pthread pthread_getspecific "" HAVE_PTHREAD_GETSPECIFIC)
+ check_library_exists(pthread pthread_rwlock_init "" HAVE_PTHREAD_RWLOCK_INIT)
+ check_library_exists(dl dlopen "" HAVE_LIBDL)
+endif()
# function checks
check_symbol_exists(getpagesize unistd.h HAVE_GETPAGESIZE)
@@ -80,13 +89,16 @@ check_symbol_exists(isnan cmath HAVE_ISNAN_IN_CMATH)
check_symbol_exists(isnan math.h HAVE_ISNAN_IN_MATH_H)
check_symbol_exists(ceilf math.h HAVE_CEILF)
check_symbol_exists(floorf math.h HAVE_FLOORF)
+check_symbol_exists(nearbyintf math.h HAVE_NEARBYINTF)
check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO)
check_symbol_exists(malloc_zone_statistics malloc/malloc.h
HAVE_MALLOC_ZONE_STATISTICS)
check_symbol_exists(mkdtemp "stdlib.h;unistd.h" HAVE_MKDTEMP)
check_symbol_exists(mkstemp "stdlib.h;unistd.h" HAVE_MKSTEMP)
check_symbol_exists(mktemp "stdlib.h;unistd.h" HAVE_MKTEMP)
-check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK)
+if( NOT LLVM_ON_WIN32 )
+ check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK)
+endif()
check_symbol_exists(sbrk unistd.h HAVE_SBRK)
check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL)
check_symbol_exists(strerror string.h HAVE_STRERROR)
@@ -120,6 +132,27 @@ endif()
check_type_exists(uint64_t "${headers}" HAVE_UINT64_T)
check_type_exists(u_int64_t "${headers}" HAVE_U_INT64_T)
+# available programs checks
+function(llvm_find_program name)
+ string(TOUPPER ${name} NAME)
+ find_program(LLVM_PATH_${NAME} ${name})
+ mark_as_advanced(LLVM_PATH_${NAME})
+ if(LLVM_PATH_${NAME})
+ set(HAVE_${NAME} 1 CACHE INTERNAL "Is ${name} available ?")
+ mark_as_advanced(HAVE_${NAME})
+ else(LLVM_PATH_${NAME})
+ set(HAVE_${NAME} "" CACHE INTERNAL "Is ${name} available ?")
+ endif(LLVM_PATH_${NAME})
+endfunction()
+
+llvm_find_program(gv)
+llvm_find_program(circo)
+llvm_find_program(twopi)
+llvm_find_program(neato)
+llvm_find_program(fdp)
+llvm_find_program(dot)
+llvm_find_program(dotty)
+
# Define LLVM_MULTITHREADED if gcc atomic builtins exists.
include(CheckAtomic)
@@ -132,7 +165,9 @@ endif()
include(GetTargetTriple)
get_target_triple(LLVM_HOSTTRIPLE)
-message(STATUS "LLVM_HOSTTRIPLE: ${LLVM_HOSTTRIPLE}")
+
+# FIXME: We don't distinguish the target and the host. :(
+set(TARGET_TRIPLE "${LLVM_HOSTTRIPLE}")
# Determine the native architecture.
string(TOLOWER "${LLVM_TARGET_ARCH}" LLVM_NATIVE_ARCH)
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
index 205ddb7..c0ce897 100755
--- a/cmake/modules/AddLLVM.cmake
+++ b/cmake/modules/AddLLVM.cmake
@@ -22,6 +22,28 @@ macro(add_llvm_library name)
endmacro(add_llvm_library name)
+macro(add_llvm_loadable_module name)
+ if( NOT LLVM_ON_UNIX )
+ message(STATUS "Loadable modules not supported on this platform.
+${name} ignored.")
+ else()
+ llvm_process_sources( ALL_FILES ${ARGN} )
+ add_library( ${name} MODULE ${ALL_FILES} )
+ set_target_properties( ${name} PROPERTIES PREFIX "" )
+
+ if (APPLE)
+ # Darwin-specific linker flags for loadable modules.
+ set_target_properties(${name} PROPERTIES
+ LINK_FLAGS "-Wl,-flat_namespace -Wl,-undefined -Wl,suppress")
+ endif()
+
+ install(TARGETS ${name}
+ LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+ ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
+ endif()
+endmacro(add_llvm_loadable_module name)
+
+
macro(add_llvm_executable name)
llvm_process_sources( ALL_FILES ${ARGN} )
add_executable(${name} ${ALL_FILES})
diff --git a/cmake/modules/GetTargetTriple.cmake b/cmake/modules/GetTargetTriple.cmake
index 87262ad..ac0c009 100644
--- a/cmake/modules/GetTargetTriple.cmake
+++ b/cmake/modules/GetTargetTriple.cmake
@@ -4,12 +4,12 @@
function( get_target_triple var )
if( MSVC )
if( CMAKE_CL_64 )
- set( ${var} "x86_64-pc-win32" PARENT_SCOPE )
+ set( value "x86_64-pc-win32" )
else()
- set( ${var} "i686-pc-win32" PARENT_SCOPE )
+ set( value "i686-pc-win32" )
endif()
elseif( MINGW AND NOT MSYS )
- set( ${var} "i686-pc-mingw32" PARENT_SCOPE )
+ set( value "i686-pc-mingw32" )
else( MSVC )
set(config_guess ${LLVM_MAIN_SRC_DIR}/autoconf/config.guess)
execute_process(COMMAND sh ${config_guess}
@@ -19,7 +19,8 @@ function( get_target_triple var )
if( NOT TT_RV EQUAL 0 )
message(FATAL_ERROR "Failed to execute ${config_guess}")
endif( NOT TT_RV EQUAL 0 )
- set( ${var} ${TT_OUT} PARENT_SCOPE )
- message(STATUS "Target triple: ${${var}}")
+ set( value ${TT_OUT} )
endif( MSVC )
+ set( ${var} ${value} PARENT_SCOPE )
+ message(STATUS "Target triple: ${value}")
endfunction( get_target_triple var )
diff --git a/cmake/modules/LLVMLibDeps.cmake b/cmake/modules/LLVMLibDeps.cmake
index 655e23e..1338d56 100644
--- a/cmake/modules/LLVMLibDeps.cmake
+++ b/cmake/modules/LLVMLibDeps.cmake
@@ -24,7 +24,6 @@ set(MSVC_LIB_DEPS_LLVMCore LLVMSupport LLVMSystem)
set(MSVC_LIB_DEPS_LLVMCppBackend LLVMCore LLVMCppBackendInfo LLVMSupport LLVMSystem LLVMTarget)
set(MSVC_LIB_DEPS_LLVMCppBackendInfo LLVMSupport)
set(MSVC_LIB_DEPS_LLVMExecutionEngine LLVMCore LLVMSupport LLVMSystem LLVMTarget)
-set(MSVC_LIB_DEPS_LLVMHello LLVMCore LLVMSupport LLVMSystem)
set(MSVC_LIB_DEPS_LLVMInstrumentation LLVMAnalysis LLVMCore LLVMScalarOpts LLVMSupport LLVMSystem LLVMTransformUtils)
set(MSVC_LIB_DEPS_LLVMInterpreter LLVMCodeGen LLVMCore LLVMExecutionEngine LLVMSupport LLVMSystem LLVMTarget)
set(MSVC_LIB_DEPS_LLVMJIT LLVMCodeGen LLVMCore LLVMExecutionEngine LLVMMC LLVMSupport LLVMSystem LLVMTarget)
OpenPOWER on IntegriCloud