forked from OSchip/llvm-project
73 lines
2.1 KiB
CMake
73 lines
2.1 KiB
CMake
|
|
macro(add_polly_library name)
|
|
set(srcs ${ARGN})
|
|
if(MSVC_IDE OR XCODE)
|
|
file( GLOB_RECURSE headers *.h *.td *.def)
|
|
set(srcs ${srcs} ${headers})
|
|
string( REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR})
|
|
list( GET split_path -1 dir)
|
|
file( GLOB_RECURSE headers
|
|
../../include/polly${dir}/*.h)
|
|
set(srcs ${srcs} ${headers})
|
|
endif(MSVC_IDE OR XCODE)
|
|
if (MODULE)
|
|
set(libkind MODULE)
|
|
elseif (SHARED_LIBRARY)
|
|
set(libkind SHARED)
|
|
else()
|
|
set(libkind)
|
|
endif()
|
|
add_library( ${name} ${libkind} ${srcs} )
|
|
if( LLVM_COMMON_DEPENDS )
|
|
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
|
|
endif( LLVM_COMMON_DEPENDS )
|
|
if( LLVM_USED_LIBS )
|
|
foreach(lib ${LLVM_USED_LIBS})
|
|
target_link_libraries( ${name} ${lib} )
|
|
endforeach(lib)
|
|
endif( LLVM_USED_LIBS )
|
|
|
|
target_link_libraries( ${name} ${ISL_LIBRARY} ${GMP_LIBRARY})
|
|
|
|
if (CLOOG_FOUND)
|
|
target_link_libraries( ${name} ${CLOOG_LIBRARY})
|
|
endif(CLOOG_FOUND)
|
|
|
|
if (OPENSCOP_FOUND)
|
|
target_link_libraries( ${name} ${OPENSCOP_LIBRARY})
|
|
endif(OPENSCOP_FOUND)
|
|
if (SCOPLIB_FOUND)
|
|
target_link_libraries( ${name} ${SCOPLIB_LIBRARY})
|
|
endif(SCOPLIB_FOUND)
|
|
|
|
if( LLVM_LINK_COMPONENTS )
|
|
llvm_config(${name} ${LLVM_LINK_COMPONENTS})
|
|
endif( LLVM_LINK_COMPONENTS )
|
|
get_system_libs(llvm_system_libs)
|
|
if( llvm_system_libs )
|
|
target_link_libraries(${name} ${llvm_system_libs})
|
|
endif( llvm_system_libs )
|
|
|
|
if(MSVC)
|
|
get_target_property(cflag ${name} COMPILE_FLAGS)
|
|
if(NOT cflag)
|
|
set(cflag "")
|
|
endif(NOT cflag)
|
|
set(cflag "${cflag} /Za")
|
|
set_target_properties(${name} PROPERTIES COMPILE_FLAGS ${cflag})
|
|
endif(MSVC)
|
|
install(TARGETS ${name}
|
|
LIBRARY DESTINATION lib
|
|
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
|
|
endmacro(add_polly_library)
|
|
|
|
macro(add_polly_loadable_module name)
|
|
set(srcs ${ARGN})
|
|
add_polly_library(${name} ${srcs})
|
|
if (APPLE)
|
|
# Darwin-specific linker flags for loadable modules.
|
|
set_target_properties(${name} PROPERTIES
|
|
LINK_FLAGS "-Wl,-flat_namespace -Wl,-undefined -Wl,suppress")
|
|
endif()
|
|
endmacro(add_polly_loadable_module)
|