forked from OSchip/llvm-project
Integrate libiomp CMake into LLVM CMake build system.
This patch integrates the libiomp CMake build system into the LLVM CMake build system so that users can checkout libiomp into the projects directory of llvm and build llvm,clang, and libiomp all together. These changes specifically introduce a new install target which will put libraries and headers into the correct locations when either a standalone build or part of llvm. The copy_recipe() method has been removed in favor of the POST_BUILD method to move headers into the exports subdirectory. And lastly, the MicroTests.cmake file was refactored which led to simpler target dependencies and a new target, make libiomp-micro-tests, which performs the 5 small tests (test-relo, test-touch, etc.) when called. llvm-svn: 236534
This commit is contained in:
parent
22f6189fb0
commit
648467ed05
|
@ -0,0 +1,2 @@
|
||||||
|
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
|
||||||
|
add_subdirectory(runtime)
|
|
@ -12,7 +12,6 @@
|
||||||
################
|
################
|
||||||
# CMAKE libiomp5
|
# CMAKE libiomp5
|
||||||
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
|
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
|
||||||
project(libiomp C CXX)
|
|
||||||
|
|
||||||
#########
|
#########
|
||||||
# GLOBALS
|
# GLOBALS
|
||||||
|
@ -25,6 +24,15 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
|
||||||
# The top-level CMakeLists.txt should define this variable.
|
# The top-level CMakeLists.txt should define this variable.
|
||||||
set(LIBOMP_WORK ${CMAKE_CURRENT_SOURCE_DIR})
|
set(LIBOMP_WORK ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
# Standalone build or part of LLVM?
|
||||||
|
set(LIBIOMP_STANDALONE_BUILD FALSE)
|
||||||
|
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}" OR
|
||||||
|
"${CMAKE_SOURCE_DIR}/runtime" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
|
project(libiomp C CXX)
|
||||||
|
set(LIBIOMP_STANDALONE_BUILD TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
# These include files are in cmake/ subdirectory except for FindPerl which is a cmake standard module
|
# These include files are in cmake/ subdirectory except for FindPerl which is a cmake standard module
|
||||||
include(HelperFunctions)
|
include(HelperFunctions)
|
||||||
include(Definitions) # -D definitions when compiling
|
include(Definitions) # -D definitions when compiling
|
||||||
|
@ -102,13 +110,13 @@ set(ompt_blame true CACHE BOOL "OMPT-blame?"
|
||||||
set(ompt_trace true CACHE BOOL "OMPT-trace?" )
|
set(ompt_trace true CACHE BOOL "OMPT-trace?" )
|
||||||
|
|
||||||
# User specified flags. These are appended to the predetermined flags found in CommonFlags.cmake and ${CMAKE_C_COMPILER_ID}/*Flags.cmake (e.g., GNU/CFlags.cmake)
|
# User specified flags. These are appended to the predetermined flags found in CommonFlags.cmake and ${CMAKE_C_COMPILER_ID}/*Flags.cmake (e.g., GNU/CFlags.cmake)
|
||||||
set(USER_C_FLAGS "" CACHE STRING "Appended user specified C compiler flags." )
|
set(LIBIOMP_CFLAGS "" CACHE STRING "Appended user specified C compiler flags." )
|
||||||
set(USER_CXX_FLAGS "" CACHE STRING "Appended user specified C++ compiler flags." )
|
set(LIBIOMP_CXXFLAGS "" CACHE STRING "Appended user specified C++ compiler flags." )
|
||||||
set(USER_CPP_FLAGS "" CACHE STRING "Appended user specified C preprocessor flags." )
|
set(LIBIOMP_CPPFLAGS "" CACHE STRING "Appended user specified C preprocessor flags." )
|
||||||
set(USER_ASM_FLAGS "" CACHE STRING "Appended user specified assembler flags." )
|
set(LIBIOMP_ASMFLAGS "" CACHE STRING "Appended user specified assembler flags." )
|
||||||
set(USER_LD_FLAGS "" CACHE STRING "Appended user specified linker flags." )
|
set(LIBIOMP_LDFLAGS "" CACHE STRING "Appended user specified linker flags." )
|
||||||
set(USER_LD_LIB_FLAGS "" CACHE STRING "Appended user specified linked libs flags. (e.g., -lm)")
|
set(LIBIOMP_LIBFLAGS "" CACHE STRING "Appended user specified linked libs flags. (e.g., -lm)")
|
||||||
set(USER_F_FLAGS "" CACHE STRING "Appended user specified Fortran compiler flags. These are only used if create_fortran_modules==true." )
|
set(LIBIOMP_FFLAGS "" CACHE STRING "Appended user specified Fortran compiler flags. These are only used if create_fortran_modules==true." )
|
||||||
|
|
||||||
# - Allow three build types: Release, Debug, RelWithDebInfo (these relate to build.pl's release, debug, and diag settings respectively)
|
# - Allow three build types: Release, Debug, RelWithDebInfo (these relate to build.pl's release, debug, and diag settings respectively)
|
||||||
# - default is Release (when CMAKE_BUILD_TYPE is not defined)
|
# - default is Release (when CMAKE_BUILD_TYPE is not defined)
|
||||||
|
@ -128,6 +136,12 @@ else()
|
||||||
check_variable(cmake_build_type_lowercase "${build_type_possible_values}")
|
check_variable(cmake_build_type_lowercase "${build_type_possible_values}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(${LIBIOMP_STANDALONE_BUILD})
|
||||||
|
set(LIBIOMP_LIBDIR_SUFFIX "" CACHE STRING "suffix of lib installation directory e.g., 64 => lib64")
|
||||||
|
else()
|
||||||
|
set(LIBIOMP_LIBDIR_SUFFIX ${LLVM_LIBDIR_SUFFIX})
|
||||||
|
endif()
|
||||||
|
|
||||||
# Check valid values
|
# Check valid values
|
||||||
check_variable(os "${os_possible_values}" )
|
check_variable(os "${os_possible_values}" )
|
||||||
check_variable(arch "${arch_possible_values}" )
|
check_variable(arch "${arch_possible_values}" )
|
||||||
|
@ -339,8 +353,11 @@ set(build_dir "${CMAKE_CURRENT_BINARY_DIR}" ) # build directory (Wher
|
||||||
set(src_dir "${LIBOMP_WORK}/src" )
|
set(src_dir "${LIBOMP_WORK}/src" )
|
||||||
set(tools_dir "${LIBOMP_WORK}/tools" )
|
set(tools_dir "${LIBOMP_WORK}/tools" )
|
||||||
set(export_dir "${LIBOMP_WORK}/exports" )
|
set(export_dir "${LIBOMP_WORK}/exports" )
|
||||||
set(export_cmn_dir "${export_dir}/common${suffix}" )
|
|
||||||
set(export_ptf_dir "${export_dir}/${platform}${suffix}")
|
set(export_ptf_dir "${export_dir}/${platform}${suffix}")
|
||||||
|
set(export_cmn_dir1 "${export_dir}/common${suffix}/include")
|
||||||
|
set(export_cmn_dir2 "${export_dir}/common${suffix}/include_compat")
|
||||||
|
set(export_inc_dir "${export_ptf_dir}/include")
|
||||||
|
set(export_mod_dir "${export_ptf_dir}/include_compat")
|
||||||
_export_lib_dir(${platform} export_lib_dir) # set exports directory (relative to build_dir) e.g., ../exports/lin_32e/lib/
|
_export_lib_dir(${platform} export_lib_dir) # set exports directory (relative to build_dir) e.g., ../exports/lin_32e/lib/
|
||||||
# or ../exports/mac_32e/lib.thin/ for mac
|
# or ../exports/mac_32e/lib.thin/ for mac
|
||||||
if(${MAC})
|
if(${MAC})
|
||||||
|
@ -371,7 +388,7 @@ set(lib_ext "${dll}")
|
||||||
set(lib_file "${lib_item}${lib_ext}")
|
set(lib_file "${lib_item}${lib_ext}")
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
# Setting export file names (full paths)
|
# Setting export file names
|
||||||
if(${WINDOWS})
|
if(${WINDOWS})
|
||||||
set(imp_file "${lib_item}${lib}") # this is exported (libiomp5md.lib)
|
set(imp_file "${lib_item}${lib}") # this is exported (libiomp5md.lib)
|
||||||
set(def_file "${lib_item}.def") # this is not exported
|
set(def_file "${lib_item}.def") # this is not exported
|
||||||
|
@ -390,15 +407,9 @@ if(${OMPT_SUPPORT})
|
||||||
set(export_cmn_files1 ${export_cmn_files1} "ompt.h")
|
set(export_cmn_files1 ${export_cmn_files1} "ompt.h")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_prefix("${export_lib_dir}/" export_lib_files)
|
|
||||||
add_prefix("${export_ptf_dir}/include_compat/" export_inc_files)
|
|
||||||
add_prefix("${export_ptf_dir}/include/" export_mod_files)
|
|
||||||
add_prefix("${export_cmn_dir}/include/" export_cmn_files1)
|
|
||||||
add_prefix("${export_cmn_dir}/include_compat/" export_cmn_files2)
|
|
||||||
set(export_cmn_files "${export_cmn_files1}" "${export_cmn_files2}")
|
set(export_cmn_files "${export_cmn_files1}" "${export_cmn_files2}")
|
||||||
if("${export_lib_fat_dir}")
|
if("${export_lib_fat_dir}")
|
||||||
set(export_lib_fat_files "${lib_file}" "${imp_file}")
|
set(export_lib_fat_files "${lib_file}" "${imp_file}")
|
||||||
add_prefix("${export_lib_fat_dir}/" export_lib_fat_files)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
|
@ -415,7 +426,7 @@ set_legal_arch(legal_arch)
|
||||||
# Linker Flags (cmake/CommonFlags.cmake)
|
# Linker Flags (cmake/CommonFlags.cmake)
|
||||||
# Archiver Flags (cmake/CommonFlags.cmake)
|
# Archiver Flags (cmake/CommonFlags.cmake)
|
||||||
# Helper Perl Script Flags (cmake/PerlFlags.cmake)
|
# Helper Perl Script Flags (cmake/PerlFlags.cmake)
|
||||||
# * Inside the cmake/CommonFlags.cmake file, the USER_*_FLAGS are added.
|
# * Inside the cmake/CommonFlags.cmake file, the LIBIOMP_*FLAGS are added.
|
||||||
# * Cannot use CMAKE_*_FLAGS directly because -x c++ is put in the linker command and mangles the linking phase.
|
# * Cannot use CMAKE_*_FLAGS directly because -x c++ is put in the linker command and mangles the linking phase.
|
||||||
|
|
||||||
# preprocessor flags (-D definitions and -I includes)
|
# preprocessor flags (-D definitions and -I includes)
|
||||||
|
@ -423,6 +434,17 @@ set_legal_arch(legal_arch)
|
||||||
set(include_dirs ${CMAKE_CURRENT_BINARY_DIR} ${src_dir} ${src_dir}/i18n ${inc_dir} ${src_dir}/thirdparty/ittnotify)
|
set(include_dirs ${CMAKE_CURRENT_BINARY_DIR} ${src_dir} ${src_dir}/i18n ${inc_dir} ${src_dir}/thirdparty/ittnotify)
|
||||||
include_directories(${include_dirs})
|
include_directories(${include_dirs})
|
||||||
|
|
||||||
|
# Grab compiler-dependent flags
|
||||||
|
# Cmake will look for cmake/${CMAKE_C_COMPILER_ID}/CFlags.cmake to append additional c, cxx, and linker flags.
|
||||||
|
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${CMAKE_C_COMPILER_ID} ${CMAKE_MODULE_PATH})
|
||||||
|
find_file(compiler_specific_include_file_found CFlags.cmake ${CMAKE_MODULE_PATH})
|
||||||
|
if(compiler_specific_include_file_found)
|
||||||
|
include(CFlags) # COMPILER_SUPPORTS_QUAD_PRECISION changed in here
|
||||||
|
append_compiler_specific_c_and_cxx_flags(C_FLAGS CXX_FLAGS)
|
||||||
|
append_compiler_specific_linker_flags(LD_FLAGS LD_LIB_FLAGS)
|
||||||
|
else()
|
||||||
|
warning_say("Could not find cmake/${CMAKE_C_COMPILER_ID}/CFlags.cmake: will only use default flags")
|
||||||
|
endif()
|
||||||
# Grab assembler-dependent flags
|
# Grab assembler-dependent flags
|
||||||
# CMake will look for cmake/${CMAKE_ASM_COMPILER_ID}/AsmFlags.cmake to append additional assembler flags.
|
# CMake will look for cmake/${CMAKE_ASM_COMPILER_ID}/AsmFlags.cmake to append additional assembler flags.
|
||||||
if(${WINDOWS})
|
if(${WINDOWS})
|
||||||
|
@ -440,8 +462,6 @@ if(${WINDOWS})
|
||||||
else()
|
else()
|
||||||
# Unix (including Mac) based systems use CMAKE_ASM_COMPILER
|
# Unix (including Mac) based systems use CMAKE_ASM_COMPILER
|
||||||
# Unix assembly files can be handled by compiler usually.
|
# Unix assembly files can be handled by compiler usually.
|
||||||
enable_language(ASM)
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${CMAKE_ASM_COMPILER_ID} ${CMAKE_MODULE_PATH})
|
|
||||||
find_file(assembler_specific_include_file_found AsmFlags.cmake ${CMAKE_MODULE_PATH})
|
find_file(assembler_specific_include_file_found AsmFlags.cmake ${CMAKE_MODULE_PATH})
|
||||||
if(assembler_specific_include_file_found)
|
if(assembler_specific_include_file_found)
|
||||||
include(AsmFlags)
|
include(AsmFlags)
|
||||||
|
@ -450,17 +470,6 @@ else()
|
||||||
warning_say("Could not find cmake/${CMAKE_ASM_COMPILER_ID}/AsmFlags.cmake: will only use default flags")
|
warning_say("Could not find cmake/${CMAKE_ASM_COMPILER_ID}/AsmFlags.cmake: will only use default flags")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
# Grab compiler-dependent flags
|
|
||||||
# Cmake will look for cmake/${CMAKE_C_COMPILER_ID}/CFlags.cmake to append additional c, cxx, and linker flags.
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${CMAKE_C_COMPILER_ID} ${CMAKE_MODULE_PATH})
|
|
||||||
find_file(compiler_specific_include_file_found CFlags.cmake ${CMAKE_MODULE_PATH})
|
|
||||||
if(compiler_specific_include_file_found)
|
|
||||||
include(CFlags) # COMPILER_SUPPORTS_QUAD_PRECISION changed in here
|
|
||||||
append_compiler_specific_c_and_cxx_flags(C_FLAGS CXX_FLAGS)
|
|
||||||
append_compiler_specific_linker_flags(LD_FLAGS LD_LIB_FLAGS)
|
|
||||||
else()
|
|
||||||
warning_say("Could not find cmake/${CMAKE_C_COMPILER_ID}/CFlags.cmake: will only use default flags")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Grab all the compiler-independent flags
|
# Grab all the compiler-independent flags
|
||||||
append_c_and_cxx_flags_common(C_FLAGS CXX_FLAGS)
|
append_c_and_cxx_flags_common(C_FLAGS CXX_FLAGS)
|
||||||
|
@ -552,19 +561,10 @@ debug_say_var(imp_src_files)
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# --- Create all ---
|
# --- Create all ---
|
||||||
add_custom_target(lib ALL DEPENDS ${export_lib_files})
|
add_custom_target(lib ALL DEPENDS iomp5)
|
||||||
add_custom_target(inc ALL DEPENDS ${export_inc_files})
|
add_custom_target(inc ALL DEPENDS ${export_inc_files})
|
||||||
if(${create_fortran_modules})
|
if(${create_fortran_modules})
|
||||||
add_custom_target(mod ALL DEPENDS ${export_mod_files})
|
add_custom_target(mod ALL DEPENDS ${export_mod_files})
|
||||||
endif()
|
|
||||||
# --- Enforce the tests to be completed/skipped before copying to exports directory ---
|
|
||||||
if(${tests})
|
|
||||||
if(${WINDOWS})
|
|
||||||
set(test-dependencies test-touch-mt/.success test-touch-md/.success test-relo/.success test-execstack/.success test-instr/.success test-deps/.success)
|
|
||||||
else()
|
|
||||||
set(test-dependencies test-touch-rt/.success test-relo/.success test-execstack/.success test-instr/.success test-deps/.success)
|
|
||||||
endif()
|
|
||||||
set_source_files_properties(${export_lib_files} PROPERTIES OBJECT_DEPENDS "${test-dependencies}")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#############################
|
#############################
|
||||||
|
@ -572,42 +572,33 @@ endif()
|
||||||
add_custom_target(common ALL DEPENDS ${export_cmn_files})
|
add_custom_target(common ALL DEPENDS ${export_cmn_files})
|
||||||
add_custom_target(clean-common COMMAND ${CMAKE_COMMAND} -E remove -f ${export_cmn_files})
|
add_custom_target(clean-common COMMAND ${CMAKE_COMMAND} -E remove -f ${export_cmn_files})
|
||||||
|
|
||||||
##########################################
|
# --- Put headers in convenient locations post build ---
|
||||||
# --- Copy files to export directories ---
|
add_custom_command(TARGET common POST_BUILD
|
||||||
# - just a simple copy recipe which acts as an install step
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${export_cmn_dir1}
|
||||||
# - copies out of the src_dir into the dest_dir
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${export_cmn_dir2}
|
||||||
#
|
COMMAND ${CMAKE_COMMAND} -E copy omp.h ${export_cmn_dir1}
|
||||||
# dest_dir/target : src_dir/target
|
COMMAND ${CMAKE_COMMAND} -E copy omp_lib.h ${export_cmn_dir1}
|
||||||
# cp src_dir/target dest_dir/target
|
COMMAND ${CMAKE_COMMAND} -E copy omp_lib.f ${export_cmn_dir1}
|
||||||
macro (simple_copy_recipe target src_dir dest_dir)
|
COMMAND ${CMAKE_COMMAND} -E copy omp_lib.f90 ${export_cmn_dir1}
|
||||||
get_source_file_property(extra_depends ${dest_dir}/${target} OBJECT_DEPENDS)
|
COMMAND ${CMAKE_COMMAND} -E copy iomp.h ${export_cmn_dir2}
|
||||||
if("${extra_depends}" MATCHES "NOTFOUND")
|
)
|
||||||
set(extra_depends)
|
if(${OMPT_SUPPORT})
|
||||||
endif()
|
add_custom_command(TARGET common POST_BUILD
|
||||||
set(ldeps ${src_dir}/${target} "${extra_depends}")
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${export_cmn_dir1}
|
||||||
if(NOT "${target}" STREQUAL "")
|
COMMAND ${CMAKE_COMMAND} -E copy ompt.h ${export_cmn_dir1}
|
||||||
file(MAKE_DIRECTORY ${dest_dir}) # make sure destination directory exists
|
)
|
||||||
add_custom_command(
|
endif()
|
||||||
OUTPUT ${dest_dir}/${target}
|
add_custom_command(TARGET inc POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${src_dir}/${target} ${dest_dir}/${target}
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${export_inc_dir}
|
||||||
DEPENDS ${ldeps}
|
COMMAND ${CMAKE_COMMAND} -E copy iomp_lib.h ${export_inc_dir}
|
||||||
)
|
)
|
||||||
endif()
|
if(${create_fortran_modules})
|
||||||
endmacro()
|
add_custom_command(TARGET mod POST_BUILD
|
||||||
# copy from build directory to final resting places in exports directory
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${export_mod_dir}
|
||||||
simple_copy_recipe("omp.h" "${build_dir}" "${export_cmn_dir}/include")
|
COMMAND ${CMAKE_COMMAND} -E copy omp_lib.mod ${export_mod_dir}
|
||||||
simple_copy_recipe("ompt.h" "${build_dir}" "${export_cmn_dir}/include")
|
COMMAND ${CMAKE_COMMAND} -E copy omp_lib_kinds.mod ${export_mod_dir}
|
||||||
simple_copy_recipe("omp_lib.h" "${build_dir}" "${export_cmn_dir}/include")
|
)
|
||||||
simple_copy_recipe("omp_lib.f" "${build_dir}" "${export_cmn_dir}/include")
|
endif()
|
||||||
simple_copy_recipe("omp_lib.f90" "${build_dir}" "${export_cmn_dir}/include")
|
|
||||||
simple_copy_recipe("iomp.h" "${build_dir}" "${export_cmn_dir}/include_compat")
|
|
||||||
simple_copy_recipe("${lib_file}" "${build_dir}" "${export_lib_dir}")
|
|
||||||
simple_copy_recipe("${imp_file}" "${build_dir}" "${export_lib_dir}")
|
|
||||||
simple_copy_recipe("${pdb_file}" "${build_dir}" "${export_lib_dir}")
|
|
||||||
simple_copy_recipe("${dbg_file}" "${build_dir}" "${export_lib_dir}")
|
|
||||||
simple_copy_recipe("omp_lib.mod" "${build_dir}" "${export_ptf_dir}/include")
|
|
||||||
simple_copy_recipe("omp_lib_kinds.mod" "${build_dir}" "${export_ptf_dir}/include")
|
|
||||||
simple_copy_recipe("iomp_lib.h" "${build_dir}" "${export_ptf_dir}/include_compat")
|
|
||||||
|
|
||||||
######################################################
|
######################################################
|
||||||
# --- Build the main library ---
|
# --- Build the main library ---
|
||||||
|
@ -621,11 +612,6 @@ add_custom_target(needed-headers DEPENDS ${build_dir}/kmp_i18n_id.inc ${build_di
|
||||||
if(${WINDOWS})
|
if(${WINDOWS})
|
||||||
add_custom_target(needed-windows-files DEPENDS ${build_dir}/${def_file} ${build_dir}/${rc_file})
|
add_custom_target(needed-windows-files DEPENDS ${build_dir}/${def_file} ${build_dir}/${rc_file})
|
||||||
list(APPEND lib_src_files ${build_dir}/${rc_file})
|
list(APPEND lib_src_files ${build_dir}/${rc_file})
|
||||||
# The windows assembly files are in MASM format, and they require a tool that can handle MASM syntax (ml.exe or ml64.exe typically)
|
|
||||||
enable_language(ASM_MASM)
|
|
||||||
else()
|
|
||||||
# Unix assembly files can be handled by compiler.
|
|
||||||
enable_language(ASM)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Remove any cmake-automatic linking of libraries by linker, This is so linux
|
# Remove any cmake-automatic linking of libraries by linker, This is so linux
|
||||||
|
@ -645,8 +631,21 @@ set_target_properties(iomp5 PROPERTIES
|
||||||
LINKER_LANGUAGE C # use C Compiler for linking step
|
LINKER_LANGUAGE C # use C Compiler for linking step
|
||||||
SKIP_BUILD_RPATH true # have Mac linker -install_name just be "-install_name libiomp5.dylib"
|
SKIP_BUILD_RPATH true # have Mac linker -install_name just be "-install_name libiomp5.dylib"
|
||||||
)
|
)
|
||||||
# Target lib (export files) depend on the library (iomp5) being built
|
|
||||||
add_dependencies(lib iomp5)
|
# --- Copy libiomp into exports directory post build ---
|
||||||
|
if(${WINDOWS})
|
||||||
|
get_target_property(LIBIOMP_OUTPUT_DIRECTORY iomp5 RUNTIME_OUTPUT_DIRECTORY)
|
||||||
|
else()
|
||||||
|
get_target_property(LIBIOMP_OUTPUT_DIRECTORY iomp5 LIBRARY_OUTPUT_DIRECTORY)
|
||||||
|
endif()
|
||||||
|
if(NOT LIBIOMP_OUTPUT_DIRECTORY)
|
||||||
|
set(LIBIOMP_OUTPUT_DIRECTORY ${build_dir})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_custom_command(TARGET iomp5 POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${export_lib_dir}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${LIBIOMP_OUTPUT_DIRECTORY}/${lib_file} ${export_lib_dir}
|
||||||
|
)
|
||||||
|
|
||||||
# Linking command will include libraries in LD_LIB_FLAGS
|
# Linking command will include libraries in LD_LIB_FLAGS
|
||||||
target_link_libraries(iomp5 ${LD_LIB_FLAGS} ${CMAKE_DL_LIBS})
|
target_link_libraries(iomp5 ${LD_LIB_FLAGS} ${CMAKE_DL_LIBS})
|
||||||
|
@ -662,7 +661,13 @@ endif()
|
||||||
set_source_files_properties(${lib_c_items}
|
set_source_files_properties(${lib_c_items}
|
||||||
${imp_c_items} PROPERTIES COMPILE_FLAGS "${C_FLAGS}" )
|
${imp_c_items} PROPERTIES COMPILE_FLAGS "${C_FLAGS}" )
|
||||||
set_source_files_properties(${lib_cxx_items} PROPERTIES COMPILE_FLAGS "${CXX_FLAGS}")
|
set_source_files_properties(${lib_cxx_items} PROPERTIES COMPILE_FLAGS "${CXX_FLAGS}")
|
||||||
set_source_files_properties(${lib_asm_items} PROPERTIES COMPILE_FLAGS "${ASM_FLAGS}")
|
if(${WINDOWS})
|
||||||
|
# Windows operating system has to use MASM assembler
|
||||||
|
set_source_files_properties(${lib_asm_items} PROPERTIES COMPILE_FLAGS "${ASM_FLAGS}")
|
||||||
|
else()
|
||||||
|
# Non-Windows operating systems can use compiler to assemble the assembly files
|
||||||
|
set_source_files_properties(${lib_asm_items} PROPERTIES COMPILE_FLAGS "${ASM_FLAGS}" LANGUAGE C)
|
||||||
|
endif()
|
||||||
# Set the -D definitions for all sources
|
# Set the -D definitions for all sources
|
||||||
add_definitions(${DEFINITIONS_FLAGS})
|
add_definitions(${DEFINITIONS_FLAGS})
|
||||||
|
|
||||||
|
@ -701,10 +706,10 @@ if(${MAC})
|
||||||
_export_lib_fat_dir( "mac_32e" export_fat_mac_32e)
|
_export_lib_fat_dir( "mac_32e" export_fat_mac_32e)
|
||||||
_export_lib_dir( "mac_32" export_mac_32 )
|
_export_lib_dir( "mac_32" export_mac_32 )
|
||||||
_export_lib_dir( "mac_32e" export_mac_32e )
|
_export_lib_dir( "mac_32e" export_mac_32e )
|
||||||
file(MAKE_DIRECTORY ${export_fat_mac_32e})
|
|
||||||
add_custom_target(fat
|
add_custom_target(fat
|
||||||
COMMAND ${CMAKE_COMMAND} -E echo Building 32 and 32e fat libraries from ${export_mac_32}/${lib_file} and ${export_mac_32e}/${lib_file}
|
COMMAND ${CMAKE_COMMAND} -E echo Building 32 and 32e fat libraries from ${export_mac_32}/${lib_file} and ${export_mac_32e}/${lib_file}
|
||||||
COMMAND ${CMAKE_COMMAND} -E echo Will put fat library in ${export_fat_mac_32e} directory
|
COMMAND ${CMAKE_COMMAND} -E echo Will put fat library in ${export_fat_mac_32e} directory
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${export_fat_mac_32e}
|
||||||
COMMAND lipo -create -output ${export_fat_mac_32e}/${lib_file} ${export_mac_32}/${lib_file} ${export_mac_32e}/${lib_file}
|
COMMAND lipo -create -output ${export_fat_mac_32e}/${lib_file} ${export_mac_32}/${lib_file} ${export_mac_32e}/${lib_file}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
@ -730,6 +735,14 @@ if(${WINDOWS})
|
||||||
)
|
)
|
||||||
add_custom_command(TARGET iomp5imp PRE_BUILD COMMAND ${CMAKE_COMMAND} -E remove -f ${imp_file})
|
add_custom_command(TARGET iomp5imp PRE_BUILD COMMAND ${CMAKE_COMMAND} -E remove -f ${imp_file})
|
||||||
add_dependencies(iomp5imp iomp5)
|
add_dependencies(iomp5imp iomp5)
|
||||||
|
get_target_property(LIBIOMPIMP_OUTPUT_DIRECTORY iomp5imp ARCHIVE_OUTPUT_DIRECTORY)
|
||||||
|
if(NOT LIBIOMPIMP_OUTPUT_DIRECTORY)
|
||||||
|
set(LIBIOMPIMP_OUTPUT_DIRECTORY ${build_dir})
|
||||||
|
endif()
|
||||||
|
add_custom_command(TARGET iomp5imp POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${export_lib_dir}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${LIBIOMPIMP_OUTPUT_DIRECTORY}/${imp_file} ${export_lib_dir}
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# --- Create $(def_file) ---
|
# --- Create $(def_file) ---
|
||||||
|
@ -772,6 +785,22 @@ add_custom_command(
|
||||||
# - Only perform if ${tests} == true (specify when invoking: cmake -Dtests=on ...)
|
# - Only perform if ${tests} == true (specify when invoking: cmake -Dtests=on ...)
|
||||||
if(${tests})
|
if(${tests})
|
||||||
include(MicroTests)
|
include(MicroTests)
|
||||||
|
add_custom_target(libiomp-micro-tests)
|
||||||
|
if(NOT ${MIC} AND ${test_touch})
|
||||||
|
add_dependencies(libiomp-micro-tests libiomp-test-touch)
|
||||||
|
endif()
|
||||||
|
if(${LINUX} AND ${test_relo})
|
||||||
|
add_dependencies(libiomp-micro-tests libiomp-test-relo)
|
||||||
|
endif()
|
||||||
|
if(${LINUX} AND ${test_execstack})
|
||||||
|
add_dependencies(libiomp-micro-tests libiomp-test-execstack)
|
||||||
|
endif()
|
||||||
|
if(${MIC} AND ${test_instr})
|
||||||
|
add_dependencies(libiomp-micro-tests libiomp-test-instr)
|
||||||
|
endif()
|
||||||
|
if(${test_deps})
|
||||||
|
add_dependencies(libiomp-micro-tests libiomp-test-deps)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
######################################################
|
######################################################
|
||||||
|
@ -808,21 +837,18 @@ endif()
|
||||||
# --- Using expand-vars.pl to generate files ---
|
# --- Using expand-vars.pl to generate files ---
|
||||||
# - 'file' is generated using expand-vars.pl and 'file'.var
|
# - 'file' is generated using expand-vars.pl and 'file'.var
|
||||||
# - Any .h .f .f90 .rc files should be created with this recipe
|
# - Any .h .f .f90 .rc files should be created with this recipe
|
||||||
macro(expand_vars_recipe filename)
|
macro(expand_vars_recipe file_dir filename)
|
||||||
get_source_file_property(extra_ev_flags ${filename} COMPILE_DEFINITIONS)
|
get_source_file_property(extra_ev_flags ${filename} COMPILE_DEFINITIONS)
|
||||||
if("${extra_ev_flags}" MATCHES "NOTFOUND")
|
if("${extra_ev_flags}" MATCHES "NOTFOUND")
|
||||||
set(extra_ev_flags)
|
set(extra_ev_flags)
|
||||||
else()
|
else()
|
||||||
string_to_list("${extra_ev_flags}" extra_ev_flags)
|
string_to_list("${extra_ev_flags}" extra_ev_flags)
|
||||||
endif()
|
endif()
|
||||||
find_file(${filename}_path ${filename}.var PATHS ${src_dir}/include/${omp_version} ${src_dir})
|
|
||||||
set(ldeps "${${filename}_path}" "${src_dir}/kmp_version.c" "${tools_dir}/expand-vars.pl")
|
|
||||||
set(expandvarscmd ${PERL_EXECUTABLE} ${tools_dir}/expand-vars.pl --strict ${ev_flags} ${extra_ev_flags} ${${filename}_path} ${filename})
|
|
||||||
if(NOT "${filename}" STREQUAL "")
|
if(NOT "${filename}" STREQUAL "")
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${filename}
|
OUTPUT ${filename}
|
||||||
COMMAND ${expandvarscmd}
|
COMMAND ${PERL_EXECUTABLE} ${tools_dir}/expand-vars.pl --strict ${ev_flags} ${extra_ev_flags} ${file_dir}/${filename}.var ${filename}
|
||||||
DEPENDS ${ldeps}
|
DEPENDS ${file_dir}/${filename}.var ${src_dir}/kmp_version.c ${tools_dir}/expand-vars.pl
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
@ -837,46 +863,71 @@ else()
|
||||||
endif()
|
endif()
|
||||||
# libiomp.rc : ev-flags += -D KMP_FILE=$(lib_file)
|
# libiomp.rc : ev-flags += -D KMP_FILE=$(lib_file)
|
||||||
set_source_files_properties(libiomp.rc PROPERTIES COMPILE_DEFINITIONS "-D KMP_FILE=${lib_file}")
|
set_source_files_properties(libiomp.rc PROPERTIES COMPILE_DEFINITIONS "-D KMP_FILE=${lib_file}")
|
||||||
expand_vars_recipe(omp.h)
|
expand_vars_recipe(${src_dir}/include/${omp_version} omp.h)
|
||||||
expand_vars_recipe(ompt.h)
|
expand_vars_recipe(${src_dir}/include/${omp_version} ompt.h)
|
||||||
expand_vars_recipe(omp_lib.h)
|
expand_vars_recipe(${src_dir}/include/${omp_version} omp_lib.h)
|
||||||
expand_vars_recipe(omp_lib.f)
|
expand_vars_recipe(${src_dir}/include/${omp_version} omp_lib.f)
|
||||||
expand_vars_recipe(omp_lib.f90)
|
expand_vars_recipe(${src_dir}/include/${omp_version} omp_lib.f90)
|
||||||
expand_vars_recipe(iomp.h)
|
expand_vars_recipe(${src_dir}/include/${omp_version} iomp.h)
|
||||||
expand_vars_recipe(iomp_lib.h)
|
expand_vars_recipe(${src_dir}/include/${omp_version} iomp_lib.h)
|
||||||
expand_vars_recipe(libiomp.rc)
|
expand_vars_recipe(${src_dir} libiomp.rc)
|
||||||
|
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
# Print configuration after all variables are set.
|
# Print configuration after all variables are set.
|
||||||
say("")
|
if(${LIBIOMP_STANDALONE_BUILD})
|
||||||
say("----------------------- CONFIGURATION -----------------------")
|
say("LIBIOMP: Operating System -- ${os}")
|
||||||
say("Operating System : ${os}")
|
say("LIBIOMP: Target Architecture -- ${arch}")
|
||||||
say("Target Architecture : ${arch}")
|
if(${MIC})
|
||||||
if(${MIC})
|
say("LIBIOMP: Intel(R) MIC Architecture -- ${mic_arch}")
|
||||||
say("Intel(R) MIC Architecture : ${mic_arch}")
|
endif()
|
||||||
|
say("LIBIOMP: Build Type -- ${CMAKE_BUILD_TYPE}")
|
||||||
|
say("LIBIOMP: OpenMP Version -- ${omp_version}")
|
||||||
|
say("LIBIOMP: Lib Type -- ${lib_type}")
|
||||||
|
say("LIBIOMP: Fortran Modules -- ${create_fortran_modules}")
|
||||||
|
# will say development if all zeros
|
||||||
|
if("${build_number}" STREQUAL "00000000")
|
||||||
|
set(build "development")
|
||||||
|
else()
|
||||||
|
set(build "${build_number}")
|
||||||
|
endif()
|
||||||
|
say("LIBIOMP: Build -- ${build}")
|
||||||
|
say("LIBIOMP: Stats-Gathering -- ${stats}")
|
||||||
|
say("LIBIOMP: OMPT-support -- ${ompt_support}")
|
||||||
|
if(${OMPT_SUPPORT})
|
||||||
|
say("LIBIOMP: OMPT-blame -- ${ompt_blame}")
|
||||||
|
say("LIBIOMP: OMPT-trace -- ${ompt_trace}")
|
||||||
|
endif()
|
||||||
|
say("LIBIOMP: Use build.pl rules -- ${USE_BUILDPL_RULES}")
|
||||||
|
say("LIBIOMP: Adaptive locks -- ${USE_ADAPTIVE_LOCKS}")
|
||||||
|
say("LIBIOMP: Use predefined linker flags -- ${USE_PREDEFINED_LINKER_FLAGS}")
|
||||||
|
say("LIBIOMP: Compiler supports quad precision -- ${COMPILER_SUPPORTS_QUAD_PRECISION}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
####################################################################
|
||||||
|
# Install rules
|
||||||
|
# We want to install libiomp5 in DESTDIR/CMAKE_INSTALL_PREFIX/lib
|
||||||
|
# We want to install headers in DESTDIR/CMAKE_INSTALL_PREFIX/include
|
||||||
|
if(${LIBIOMP_STANDALONE_BUILD})
|
||||||
|
set(LIBIOMP_HEADERS_INSTALL_PATH include)
|
||||||
|
else()
|
||||||
|
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION ${PACKAGE_VERSION})
|
||||||
|
set(LIBIOMP_HEADERS_INSTALL_PATH lib${LIBIOMP_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
|
||||||
|
endif()
|
||||||
|
if(${WINDOWS})
|
||||||
|
install(TARGETS iomp5 RUNTIME DESTINATION bin)
|
||||||
|
if(NOT "${imp_file}" STREQUAL "")
|
||||||
|
install(TARGETS iomp5imp ARCHIVE DESTINATION lib${LIBIOMP_LIBDIR_SUFFIX})
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
install(TARGETS iomp5 LIBRARY DESTINATION lib${LIBIOMP_LIBDIR_SUFFIX})
|
||||||
|
endif()
|
||||||
|
install(
|
||||||
|
FILES
|
||||||
|
${build_dir}/omp.h
|
||||||
|
${build_dir}/iomp.h
|
||||||
|
DESTINATION ${LIBIOMP_HEADERS_INSTALL_PATH}
|
||||||
|
)
|
||||||
|
if(${OMPT_SUPPORT})
|
||||||
|
install( FILES ${build_dir}/ompt.h DESTINATION ${LIBIOMP_HEADERS_INSTALL_PATH})
|
||||||
endif()
|
endif()
|
||||||
say("Build Type : ${CMAKE_BUILD_TYPE}")
|
|
||||||
say("OpenMP Version : ${omp_version}")
|
|
||||||
say("Lib Type : ${lib_type}")
|
|
||||||
say("Fortran Modules : ${create_fortran_modules}")
|
|
||||||
# will say development if all zeros
|
|
||||||
if("${build_number}" STREQUAL "00000000")
|
|
||||||
set(build "development")
|
|
||||||
else()
|
|
||||||
set(build "${build_number}")
|
|
||||||
endif()
|
|
||||||
say("Build : ${build}")
|
|
||||||
say("Stats-Gathering : ${stats}")
|
|
||||||
say("OMPT-support : ${ompt_support}")
|
|
||||||
if(${OMPT_SUPPORT})
|
|
||||||
say("OMPT-blame : ${ompt_blame}")
|
|
||||||
say("OMPT-trace : ${ompt_trace}")
|
|
||||||
endif()
|
|
||||||
say("Use build.pl rules : ${USE_BUILDPL_RULES}")
|
|
||||||
say("Adaptive locks : ${USE_ADAPTIVE_LOCKS}")
|
|
||||||
say("Use predefined linker flags : ${USE_PREDEFINED_LINKER_FLAGS}")
|
|
||||||
say("Compiler supports quad precision : ${COMPILER_SUPPORTS_QUAD_PRECISION}")
|
|
||||||
say("-------------------------------------------------------------")
|
|
||||||
say("")
|
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ endmacro()
|
||||||
# Global Assembly flags
|
# Global Assembly flags
|
||||||
function(append_asm_flags_common input_asm_flags)
|
function(append_asm_flags_common input_asm_flags)
|
||||||
set(local_asm_flags)
|
set(local_asm_flags)
|
||||||
set(${input_asm_flags} "${${input_asm_flags}}" "${local_asm_flags}" "${USER_ASM_FLAGS}" PARENT_SCOPE)
|
set(${input_asm_flags} "${${input_asm_flags}}" "${local_asm_flags}" "${LIBIOMP_ASMFLAGS}" PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
|
@ -65,15 +65,15 @@ endfunction()
|
||||||
function(append_c_and_cxx_flags_common input_c_flags input_cxx_flags)
|
function(append_c_and_cxx_flags_common input_c_flags input_cxx_flags)
|
||||||
set(local_c_flags)
|
set(local_c_flags)
|
||||||
set(local_cxx_flags)
|
set(local_cxx_flags)
|
||||||
set(${input_c_flags} "${${input_c_flags}}" "${local_c_flags}" "${USER_C_FLAGS}" PARENT_SCOPE)
|
set(${input_c_flags} "${${input_c_flags}}" "${local_c_flags}" "${LIBIOMP_CFLAGS}" PARENT_SCOPE)
|
||||||
set(${input_cxx_flags} "${${input_cxx_flags}}" "${local_cxx_flags}" "${USER_CXX_FLAGS}" PARENT_SCOPE)
|
set(${input_cxx_flags} "${${input_cxx_flags}}" "${local_cxx_flags}" "${LIBIOMP_CXXFLAGS}" PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
# Global Fortran Compiler flags (for creating .mod files)
|
# Global Fortran Compiler flags (for creating .mod files)
|
||||||
function(append_fort_flags_common input_fort_flags)
|
function(append_fort_flags_common input_fort_flags)
|
||||||
set(local_fort_flags)
|
set(local_fort_flags)
|
||||||
set(${input_fort_flags} "${${input_fort_flags}}" "${local_fort_flags}" "${USER_F_FLAGS}" PARENT_SCOPE)
|
set(${input_fort_flags} "${${input_fort_flags}}" "${local_fort_flags}" "${LIBIOMP_FFLAGS}" PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
|
@ -125,8 +125,8 @@ function(append_linker_flags_common input_ld_flags input_ld_flags_libs)
|
||||||
|
|
||||||
endif() # USE_PREDEFINED_LINKER_FLAGS
|
endif() # USE_PREDEFINED_LINKER_FLAGS
|
||||||
|
|
||||||
set(${input_ld_flags} "${${input_ld_flags}}" "${local_ld_flags}" "${USER_LD_FLAGS}" PARENT_SCOPE)
|
set(${input_ld_flags} "${${input_ld_flags}}" "${local_ld_flags}" "${LIBIOMP_LDFLAGS}" PARENT_SCOPE)
|
||||||
set(${input_ld_flags_libs} "${${input_ld_flags_libs}}" "${local_ld_flags_libs}" "${USER_LD_LIB_FLAGS}" PARENT_SCOPE)
|
set(${input_ld_flags_libs} "${${input_ld_flags_libs}}" "${local_ld_flags_libs}" "${LIBIOMP_LIBFLAGS}" PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
|
|
|
@ -155,6 +155,6 @@ function(append_cpp_flags input_cpp_flags)
|
||||||
else()
|
else()
|
||||||
append_definitions("-D KMP_USE_INTERNODE_ALIGNMENT=0")
|
append_definitions("-D KMP_USE_INTERNODE_ALIGNMENT=0")
|
||||||
endif()
|
endif()
|
||||||
set(${input_cpp_flags} "${${input_cpp_flags}}" "${local_cpp_flags}" "${USER_CPP_FLAGS}" "$ENV{CPPFLAGS}" PARENT_SCOPE)
|
set(${input_cpp_flags} "${${input_cpp_flags}}" "${local_cpp_flags}" "${LIBIOMP_CPPFLAGS}" "$ENV{CPPFLAGS}" PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
# void say(string message_to_user);
|
# void say(string message_to_user);
|
||||||
# - prints out message_to_user
|
# - prints out message_to_user
|
||||||
macro(say message_to_user)
|
macro(say message_to_user)
|
||||||
message("${message_to_user}")
|
message(STATUS "${message_to_user}")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# void warning_say(string message_to_user);
|
# void warning_say(string message_to_user);
|
||||||
|
|
|
@ -44,242 +44,175 @@
|
||||||
# An individual test can be turned off by issuing something like -Dtest_touch=off when calling cmake
|
# An individual test can be turned off by issuing something like -Dtest_touch=off when calling cmake
|
||||||
|
|
||||||
# test-touch
|
# test-touch
|
||||||
if(NOT ${MIC} AND ${test_touch} AND ${tests})
|
if(${WINDOWS})
|
||||||
if(${WINDOWS})
|
set(do_test_touch_mt TRUE)
|
||||||
set(do_test_touch_mt TRUE)
|
if(${do_test_touch_mt})
|
||||||
if(${do_test_touch_mt})
|
set(test_touch_items ${test_touch_items} test-touch-md test-touch-mt)
|
||||||
set(test_touch_items ${test_touch_items} test-touch-md test-touch-mt)
|
|
||||||
else()
|
|
||||||
set(test_touch_items ${test_touch_items} test-touch-md)
|
|
||||||
endif()
|
|
||||||
else()
|
else()
|
||||||
set(test_touch_items ${test_touch_items} test-touch-rt)
|
set(test_touch_items ${test_touch_items} test-touch-md)
|
||||||
endif()
|
|
||||||
set(regular_test_touch_items "${test_touch_items}")
|
|
||||||
add_suffix("/.success" regular_test_touch_items)
|
|
||||||
# test-touch : ${test_touch_items}/.success
|
|
||||||
set(ldeps "${regular_test_touch_items}")
|
|
||||||
add_custom_target( test-touch DEPENDS ${ldeps})
|
|
||||||
|
|
||||||
if(${WINDOWS})
|
|
||||||
# pick test-touch compiler
|
|
||||||
set(tt-c cl)
|
|
||||||
# test-touch compilation flags
|
|
||||||
list(APPEND tt-c-flags -nologo)
|
|
||||||
if(${RELEASE_BUILD} OR ${RELWITHDEBINFO_BUILD})
|
|
||||||
list(APPEND tt-c-flags-mt -MT)
|
|
||||||
list(APPEND tt-c-flags-md -MD)
|
|
||||||
else()
|
|
||||||
list(APPEND tt-c-flags-mt -MTd)
|
|
||||||
list(APPEND tt-c-flags-md -MDd)
|
|
||||||
endif()
|
|
||||||
list(APPEND tt-libs ${build_dir}/${imp_file})
|
|
||||||
list(APPEND tt-ld-flags -link -nodefaultlib:oldnames)
|
|
||||||
if(${IA32})
|
|
||||||
list(APPEND tt-ld-flags -safeseh)
|
|
||||||
endif()
|
|
||||||
list(APPEND tt-ld-flags-v -verbose)
|
|
||||||
else() # (Unix based systems, Intel(R) MIC Architecture, and Mac)
|
|
||||||
# pick test-touch compiler
|
|
||||||
if(${STD_CPP_LIB})
|
|
||||||
set(tt-c ${CMAKE_CXX_COMPILER})
|
|
||||||
else()
|
|
||||||
set(tt-c ${CMAKE_C_COMPILER})
|
|
||||||
endif()
|
|
||||||
# test-touch compilation flags
|
|
||||||
if(${LINUX})
|
|
||||||
list(APPEND tt-c-flags -pthread)
|
|
||||||
endif()
|
|
||||||
if(${IA32})
|
|
||||||
list(APPEND tt-c-flags -m32)
|
|
||||||
elseif(${INTEL64})
|
|
||||||
list(APPEND tt-c-flags -m64)
|
|
||||||
endif()
|
|
||||||
list(APPEND tt-libs ${build_dir}/${lib_file})
|
|
||||||
if(${MAC})
|
|
||||||
list(APPEND tt-ld-flags-v -Wl,-t)
|
|
||||||
set(tt-env "DYLD_LIBRARY_PATH=.:$ENV{DYLD_LIBRARY_PATH}")
|
|
||||||
else()
|
|
||||||
list(APPEND tt-ld-flags-v -Wl,--verbose)
|
|
||||||
set(tt-env LD_LIBRARY_PATH=".:${build_dir}:$ENV{LD_LIBRARY_PATH}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
list(APPEND tt-c-flags "${tt-c-flags-rt}")
|
|
||||||
list(APPEND tt-env "KMP_VERSION=1")
|
|
||||||
|
|
||||||
macro(test_touch_recipe test_touch_dir)
|
|
||||||
file(MAKE_DIRECTORY ${build_dir}/${test_touch_dir})
|
|
||||||
set(ldeps ${src_dir}/test-touch.c ${build_dir}/${lib_file})
|
|
||||||
set(tt-exe-file ${test_touch_dir}/test-touch${exe})
|
|
||||||
if(${WINDOWS})
|
|
||||||
# ****** list(APPEND tt-c-flags -Fo$(dir $@)test-touch${obj} -Fe$(dir $@)test-touch${exe}) *******
|
|
||||||
set(tt-c-flags-out -Fo${test_touch_dir}/test-touch${obj} -Fe${test_touch_dir}/test-touch${exe})
|
|
||||||
list(APPEND ldeps ${build_dir}/${imp_file})
|
|
||||||
else()
|
|
||||||
# ****** list(APPEND tt-c-flags -o $(dir $@)test-touch${exe}) ********
|
|
||||||
set(tt-c-flags-out -o ${test_touch_dir}/test-touch${exe})
|
|
||||||
endif()
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${test_touch_dir}/.success
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove -f ${test_touch_dir}/*
|
|
||||||
COMMAND ${tt-c} ${tt-c-flags-out} ${tt-c-flags} ${src_dir}/test-touch.c ${tt-libs} ${tt-ld-flags}
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove -f ${tt-exe-file}
|
|
||||||
COMMAND ${tt-c} ${tt-c-flags-out} ${tt-c-flags} ${src_dir}/test-touch.c ${tt-libs} ${tt-ld-flags} ${tt-ld-flags-v} > ${test_touch_dir}/build.log 2>&1
|
|
||||||
COMMAND ${tt-env} ${tt-exe-file}
|
|
||||||
#COMMAND grep -i -e \"[^_]libirc\" ${test_touch_dir}/build.log > ${test_touch_dir}/libirc.log \; [ $$? -eq 1 ]
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E touch ${test_touch_dir}/.success
|
|
||||||
DEPENDS ${ldeps}
|
|
||||||
)
|
|
||||||
endmacro()
|
|
||||||
if(${WINDOWS})
|
|
||||||
test_touch_recipe(test-touch-mt)
|
|
||||||
test_touch_recipe(test-touch-md)
|
|
||||||
else()
|
|
||||||
test_touch_recipe(test-touch-rt)
|
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
add_custom_target(test-touch DEPENDS test-touch/.success)
|
set(test_touch_items ${test_touch_items} test-touch-rt)
|
||||||
macro(test_touch_recipe_skip test_touch_dir)
|
endif()
|
||||||
if(${tests} AND ${test_touch})
|
set(regular_test_touch_items "${test_touch_items}")
|
||||||
set(test_touch_message 'test-touch is not available for the Intel(R) MIC Architecture. Will not perform it.')
|
add_suffix("/.success" regular_test_touch_items)
|
||||||
else()
|
# test-touch : ${test_touch_items}/.success
|
||||||
set(test_touch_message "test-touch is turned off. Will not perform it.")
|
set(ldeps "${regular_test_touch_items}")
|
||||||
endif()
|
add_custom_target(libiomp-test-touch DEPENDS ${ldeps})
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${test_touch_dir}/.success
|
if(${WINDOWS})
|
||||||
COMMAND ${CMAKE_COMMAND} -E echo ${test_touch_message}
|
# pick test-touch compiler
|
||||||
)
|
set(tt-c cl)
|
||||||
endmacro()
|
# test-touch compilation flags
|
||||||
test_touch_recipe_skip(test-touch-rt)
|
list(APPEND tt-c-flags -nologo)
|
||||||
test_touch_recipe_skip(test-touch-mt)
|
if(${RELEASE_BUILD} OR ${RELWITHDEBINFO_BUILD})
|
||||||
test_touch_recipe_skip(test-touch-md)
|
list(APPEND tt-c-flags-mt -MT)
|
||||||
|
list(APPEND tt-c-flags-md -MD)
|
||||||
|
else()
|
||||||
|
list(APPEND tt-c-flags-mt -MTd)
|
||||||
|
list(APPEND tt-c-flags-md -MDd)
|
||||||
|
endif()
|
||||||
|
list(APPEND tt-libs ${build_dir}/${imp_file})
|
||||||
|
list(APPEND tt-ld-flags -link -nodefaultlib:oldnames)
|
||||||
|
if(${IA32})
|
||||||
|
list(APPEND tt-ld-flags -safeseh)
|
||||||
|
endif()
|
||||||
|
list(APPEND tt-ld-flags-v -verbose)
|
||||||
|
else() # (Unix based systems, Intel(R) MIC Architecture, and Mac)
|
||||||
|
# pick test-touch compiler
|
||||||
|
if(${STD_CPP_LIB})
|
||||||
|
set(tt-c ${CMAKE_CXX_COMPILER})
|
||||||
|
else()
|
||||||
|
set(tt-c ${CMAKE_C_COMPILER})
|
||||||
|
endif()
|
||||||
|
# test-touch compilation flags
|
||||||
|
if(${LINUX})
|
||||||
|
list(APPEND tt-c-flags -pthread)
|
||||||
|
endif()
|
||||||
|
if(${IA32})
|
||||||
|
list(APPEND tt-c-flags -m32)
|
||||||
|
elseif(${INTEL64})
|
||||||
|
list(APPEND tt-c-flags -m64)
|
||||||
|
endif()
|
||||||
|
list(APPEND tt-libs ${build_dir}/${lib_file})
|
||||||
|
if(${MAC})
|
||||||
|
list(APPEND tt-ld-flags-v -Wl,-t)
|
||||||
|
set(tt-env "DYLD_LIBRARY_PATH=.:$ENV{DYLD_LIBRARY_PATH}")
|
||||||
|
else()
|
||||||
|
list(APPEND tt-ld-flags-v -Wl,--verbose)
|
||||||
|
set(tt-env LD_LIBRARY_PATH=".:${build_dir}:$ENV{LD_LIBRARY_PATH}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
list(APPEND tt-c-flags "${tt-c-flags-rt}")
|
||||||
|
list(APPEND tt-env "KMP_VERSION=1")
|
||||||
|
|
||||||
|
macro(test_touch_recipe test_touch_dir)
|
||||||
|
set(ldeps ${src_dir}/test-touch.c lib)
|
||||||
|
set(tt-exe-file ${test_touch_dir}/test-touch${exe})
|
||||||
|
if(${WINDOWS})
|
||||||
|
# ****** list(APPEND tt-c-flags -Fo$(dir $@)test-touch${obj} -Fe$(dir $@)test-touch${exe}) *******
|
||||||
|
set(tt-c-flags-out -Fo${test_touch_dir}/test-touch${obj} -Fe${test_touch_dir}/test-touch${exe})
|
||||||
|
list(APPEND ldeps ${build_dir}/${imp_file})
|
||||||
|
else()
|
||||||
|
# ****** list(APPEND tt-c-flags -o $(dir $@)test-touch${exe}) ********
|
||||||
|
set(tt-c-flags-out -o ${test_touch_dir}/test-touch${exe})
|
||||||
|
endif()
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${test_touch_dir}/.success
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${build_dir}/${test_touch_dir}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E remove -f ${test_touch_dir}/*
|
||||||
|
COMMAND ${tt-c} ${tt-c-flags-out} ${tt-c-flags} ${src_dir}/test-touch.c ${tt-libs} ${tt-ld-flags}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E remove -f ${tt-exe-file}
|
||||||
|
COMMAND ${tt-c} ${tt-c-flags-out} ${tt-c-flags} ${src_dir}/test-touch.c ${tt-libs} ${tt-ld-flags} ${tt-ld-flags-v} > ${test_touch_dir}/build.log 2>&1
|
||||||
|
COMMAND ${tt-env} ${tt-exe-file}
|
||||||
|
#COMMAND grep -i -e \"[^_]libirc\" ${test_touch_dir}/build.log > ${test_touch_dir}/libirc.log \; [ $$? -eq 1 ]
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E touch ${test_touch_dir}/.success
|
||||||
|
DEPENDS ${ldeps}
|
||||||
|
)
|
||||||
|
endmacro()
|
||||||
|
if(${WINDOWS})
|
||||||
|
test_touch_recipe(test-touch-mt)
|
||||||
|
test_touch_recipe(test-touch-md)
|
||||||
|
else()
|
||||||
|
test_touch_recipe(test-touch-rt)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# test-relo
|
# test-relo
|
||||||
add_custom_target(test-relo DEPENDS test-relo/.success)
|
add_custom_target(libiomp-test-relo DEPENDS test-relo/.success)
|
||||||
if(${LINUX} AND ${test_relo} AND ${tests})
|
add_custom_command(
|
||||||
file(MAKE_DIRECTORY ${build_dir}/test-relo)
|
OUTPUT test-relo/.success
|
||||||
add_custom_command(
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${build_dir}/test-relo
|
||||||
OUTPUT test-relo/.success
|
COMMAND readelf -d ${build_dir}/${lib_file} > test-relo/readelf.log
|
||||||
COMMAND readelf -d ${build_dir}/${lib_file} > test-relo/readelf.log
|
COMMAND grep -e TEXTREL test-relo/readelf.log \; [ $$? -eq 1 ]
|
||||||
COMMAND grep -e TEXTREL test-relo/readelf.log \; [ $$? -eq 1 ]
|
COMMAND ${CMAKE_COMMAND} -E touch test-relo/.success
|
||||||
COMMAND ${CMAKE_COMMAND} -E touch test-relo/.success
|
DEPENDS lib
|
||||||
DEPENDS ${build_dir}/${lib_file}
|
)
|
||||||
)
|
|
||||||
else()
|
|
||||||
if(${tests} AND ${test_relo})
|
|
||||||
set(test_relo_message 'test-relo is only available for dynamic library on Linux or Intel(R) MIC Architecture. Will not perform it.')
|
|
||||||
else()
|
|
||||||
set(test_relo_message "test-relo is turned off. Will not perform it.")
|
|
||||||
endif()
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT test-relo/.success
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E echo ${test_relo_message}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# test-execstack
|
# test-execstack
|
||||||
add_custom_target(test-execstack DEPENDS test-execstack/.success)
|
add_custom_target(libiomp-test-execstack DEPENDS test-execstack/.success)
|
||||||
if(${LINUX} AND ${test_execstack} AND ${tests})
|
add_custom_command(
|
||||||
file(MAKE_DIRECTORY ${build_dir}/test-execstack)
|
OUTPUT test-execstack/.success
|
||||||
add_custom_command(
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${build_dir}/test-execstack
|
||||||
OUTPUT test-execstack/.success
|
COMMAND ${PERL_EXECUTABLE} ${tools_dir}/check-execstack.pl ${oa_opts} ${build_dir}/${lib_file}
|
||||||
COMMAND ${PERL_EXECUTABLE} ${tools_dir}/check-execstack.pl ${oa_opts} ${build_dir}/${lib_file}
|
COMMAND ${CMAKE_COMMAND} -E touch test-execstack/.success
|
||||||
COMMAND ${CMAKE_COMMAND} -E touch test-execstack/.success
|
DEPENDS lib
|
||||||
DEPENDS ${build_dir}/${lib_file}
|
)
|
||||||
)
|
|
||||||
else()
|
|
||||||
if(${tests} AND ${test_execstack})
|
|
||||||
set(test_execstack_message "test-execstack is only available for dynamic library on Linux. Will not perform it.")
|
|
||||||
else()
|
|
||||||
set(test_execstack_message "test-execstack is turned off. Will not perform it.")
|
|
||||||
endif()
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT test-execstack/.success
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E echo ${test_execstack_message}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# test-instr
|
# test-instr
|
||||||
add_custom_target(test-instr DEPENDS test-instr/.success)
|
add_custom_target(libiomp-test-instr DEPENDS test-instr/.success)
|
||||||
if(${MIC} AND ${test_instr} AND ${tests})
|
add_custom_command(
|
||||||
file(MAKE_DIRECTORY ${build_dir}/test-instr)
|
OUTPUT test-instr/.success
|
||||||
add_custom_command(
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${build_dir}/test-instr
|
||||||
OUTPUT test-instr/.success
|
COMMAND ${PERL_EXECUTABLE} ${tools_dir}/check-instruction-set.pl ${oa_opts} --show --mic-arch=${mic_arch} ${build_dir}/${lib_file}
|
||||||
COMMAND ${PERL_EXECUTABLE} ${tools_dir}/check-instruction-set.pl ${oa_opts} --show --mic-arch=${mic_arch} ${build_dir}/${lib_file}
|
COMMAND ${CMAKE_COMMAND} -E touch test-instr/.success
|
||||||
COMMAND ${CMAKE_COMMAND} -E touch test-instr/.success
|
DEPENDS lib ${tools_dir}/check-instruction-set.pl
|
||||||
DEPENDS ${build_dir}/${lib_file} ${tools_dir}/check-instruction-set.pl
|
)
|
||||||
)
|
|
||||||
else()
|
|
||||||
if(${tests} AND ${test_instr})
|
|
||||||
set(test_instr_message 'test-instr is only available for Intel(R) MIC Architecture libraries. Will not perform it.')
|
|
||||||
else()
|
|
||||||
set(test_instr_message "test-instr is turned off. Will not perform it.")
|
|
||||||
endif()
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT test-instr/.success
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E echo ${test_instr_message}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# test-deps
|
# test-deps
|
||||||
add_custom_target(test-deps DEPENDS test-deps/.success)
|
add_custom_target(libiomp-test-deps DEPENDS test-deps/.success)
|
||||||
if(${test_deps} AND ${tests})
|
set(td_exp)
|
||||||
set(td_exp)
|
if(${FREEBSD})
|
||||||
if(${FREEBSD})
|
set(td_exp libc.so.7 libthr.so.3 libunwind.so.5)
|
||||||
set(td_exp libc.so.7 libthr.so.3 libunwind.so.5)
|
elseif(${MAC})
|
||||||
elseif(${MAC})
|
set(td_exp /usr/lib/libSystem.B.dylib)
|
||||||
set(td_exp /usr/lib/libSystem.B.dylib)
|
elseif(${WINDOWS})
|
||||||
elseif(${WINDOWS})
|
set(td_exp kernel32.dll)
|
||||||
set(td_exp kernel32.dll)
|
elseif(${LINUX})
|
||||||
elseif(${LINUX})
|
if(${MIC})
|
||||||
if(${MIC})
|
set(td_exp libc.so.6,libpthread.so.0,libdl.so.2)
|
||||||
set(td_exp libc.so.6,libpthread.so.0,libdl.so.2)
|
|
||||||
if(${STD_CPP_LIB})
|
|
||||||
set(td_exp ${td_exp},libstdc++.so.6)
|
|
||||||
endif()
|
|
||||||
if("${mic_arch}" STREQUAL "knf")
|
|
||||||
set(td_exp ${td_exp},ld-linux-l1om.so.2,libgcc_s.so.1)
|
|
||||||
elseif("${mic_arch}" STREQUAL "knc")
|
|
||||||
set(td_exp ${td_exp},ld-linux-k1om.so.2)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
set(td_exp libdl.so.2,libgcc_s.so.1)
|
|
||||||
if(${IA32})
|
|
||||||
set(td_exp ${td_exp},libc.so.6,ld-linux.so.2)
|
|
||||||
elseif(${INTEL64})
|
|
||||||
set(td_exp ${td_exp},libc.so.6,ld-linux-x86-64.so.2)
|
|
||||||
elseif(${ARM})
|
|
||||||
set(td_exp ${td_exp},libffi.so.6,libffi.so.5,libc.so.6,ld-linux-armhf.so.3)
|
|
||||||
elseif(${PPC64})
|
|
||||||
set(td_exp ${td_exp},libc.so.6,ld64.so.1)
|
|
||||||
endif()
|
|
||||||
if(${STD_CPP_LIB})
|
if(${STD_CPP_LIB})
|
||||||
set(td_exp ${td_exp},libstdc++.so.6)
|
set(td_exp ${td_exp},libstdc++.so.6)
|
||||||
endif()
|
endif()
|
||||||
if(NOT ${STUBS_LIBRARY})
|
if("${mic_arch}" STREQUAL "knf")
|
||||||
set(td_exp ${td_exp},libpthread.so.0)
|
set(td_exp ${td_exp},ld-linux-l1om.so.2,libgcc_s.so.1)
|
||||||
|
elseif("${mic_arch}" STREQUAL "knc")
|
||||||
|
set(td_exp ${td_exp},ld-linux-k1om.so.2)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
file(MAKE_DIRECTORY ${build_dir}/test-deps)
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT test-deps/.success
|
|
||||||
COMMAND ${PERL_EXECUTABLE} ${tools_dir}/check-depends.pl ${oa_opts} --expected="${td_exp}" ${build_dir}/${lib_file}
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E touch test-deps/.success
|
|
||||||
DEPENDS ${build_dir}/${lib_file} ${tools_dir}/check-depends.pl
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
if(${tests} AND ${test_deps})
|
|
||||||
set(test_deps_message 'test-deps is available for dynamic libraries on Linux, Mac, Intel(R) MIC Architecture, Windows and static libraries on Windows. Will not perform it.')
|
|
||||||
else()
|
else()
|
||||||
set(test_deps_message "test-deps is turned off. Will not perform it.")
|
set(td_exp libdl.so.2,libgcc_s.so.1)
|
||||||
|
if(${IA32})
|
||||||
|
set(td_exp ${td_exp},libc.so.6,ld-linux.so.2)
|
||||||
|
elseif(${INTEL64})
|
||||||
|
set(td_exp ${td_exp},libc.so.6,ld-linux-x86-64.so.2)
|
||||||
|
elseif(${ARM})
|
||||||
|
set(td_exp ${td_exp},libffi.so.6,libffi.so.5,libc.so.6,ld-linux-armhf.so.3)
|
||||||
|
elseif(${PPC64})
|
||||||
|
set(td_exp ${td_exp},libc.so.6,ld64.so.1)
|
||||||
endif()
|
endif()
|
||||||
add_custom_command(
|
if(${STD_CPP_LIB})
|
||||||
OUTPUT test-deps/.success
|
set(td_exp ${td_exp},libstdc++.so.6)
|
||||||
COMMAND ${CMAKE_COMMAND} -E echo ${test_deps_message}
|
endif()
|
||||||
)
|
if(NOT ${STUBS_LIBRARY})
|
||||||
|
set(td_exp ${td_exp},libpthread.so.0)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT test-deps/.success
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${build_dir}/test-deps
|
||||||
|
COMMAND ${PERL_EXECUTABLE} ${tools_dir}/check-depends.pl ${oa_opts} --expected="${td_exp}" ${build_dir}/${lib_file}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E touch test-deps/.success
|
||||||
|
DEPENDS lib ${tools_dir}/check-depends.pl
|
||||||
|
)
|
||||||
# END OF TESTS
|
# END OF TESTS
|
||||||
######################################################
|
######################################################
|
||||||
|
|
Loading…
Reference in New Issue