llvm-project/openmp/runtime/cmake/LibompMicroTests.cmake

219 lines
9.7 KiB
CMake
Raw Normal View History

Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
# The following micro-tests are small tests to perform on the library just created.
# There are currently five micro-tests:
# (1) test-touch
# - Compile and run a small program using newly created libomp library
# - Fails if test-touch.c does not compile or if test-touch.c does not run after compilation
# - Program dependencies: gcc or g++, grep, bourne shell
# - Available for all Unix,Mac,Windows builds. Not available on Intel(R) MIC Architecture builds.
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
# (2) test-relo
# - Tests dynamic libraries for position-dependent code (can not have any position dependent code)
# - Fails if TEXTREL is in output of readelf -d libomp.so command
# - Program dependencies: readelf, grep, bourne shell
# - Available for Unix, Intel(R) MIC Architecture dynamic library builds. Not available otherwise.
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
# (3) test-execstack
# - Tests if stack is executable
# - Fails if stack is executable. Should only be readable and writable. Not exectuable.
# - Program dependencies: perl, readelf
# - Available for Unix dynamic library builds. Not available otherwise.
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
# (4) test-instr (Intel(R) MIC Architecutre only)
# - Tests Intel(R) MIC Architecture libraries for valid instruction set
# - Fails if finds invalid instruction for Intel(R) MIC Architecture (wasn't compiled with correct flags)
# - Program dependencies: perl, objdump
# - Available for Intel(R) MIC Architecture and i386 builds. Not available otherwise.
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
# (5) test-deps
# - Tests newly created libomp for library dependencies
# - Fails if sees a dependence not listed in td_exp variable below
# - Program dependencies: perl, (unix)readelf, (mac)otool[64], (windows)link.exe
# - Available for Unix,Mac,Windows, Intel(R) MIC Architecture dynamic builds and Windows
# static builds. Not available otherwise.
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
# get library location
if(WIN32)
get_target_property(LIBOMP_OUTPUT_DIRECTORY omp RUNTIME_OUTPUT_DIRECTORY)
get_target_property(LIBOMPIMP_OUTPUT_DIRECTORY ompimp ARCHIVE_OUTPUT_DIRECTORY)
if(NOT LIBOMPIMP_OUTPUT_DIRECTORY)
set(LIBOMPIMP_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
else()
get_target_property(LIBOMP_OUTPUT_DIRECTORY omp LIBRARY_OUTPUT_DIRECTORY)
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
endif()
if(NOT LIBOMP_OUTPUT_DIRECTORY)
set(LIBOMP_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
endif()
# test-touch
find_program(LIBOMP_SHELL sh)
if(WIN32)
if(LIBOMP_SHELL)
set(libomp_test_touch_targets test-touch-md/.success test-touch-mt/.success)
endif()
# pick test-touch compiler
set(libomp_test_touch_compiler ${CMAKE_C_COMPILER})
# test-touch compilation flags
libomp_append(libomp_test_touch_cflags /nologo)
libomp_append(libomp_test_touch_libs ${LIBOMPIMP_OUTPUT_DIRECTORY}/${LIBOMP_IMP_LIB_FILE})
if(${IA32})
libomp_append(libomp_test_touch_ldflags /safeseh)
endif()
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
else() # (Unix based systems, Intel(R) MIC Architecture, and Mac)
if(LIBOMP_SHELL)
set(libomp_test_touch_targets test-touch-rt/.success)
endif()
# pick test-touch compiler
if(${LIBOMP_USE_STDCPPLIB})
set(libomp_test_touch_compiler ${CMAKE_CXX_COMPILER})
else()
set(libomp_test_touch_compiler ${CMAKE_C_COMPILER})
endif()
# test-touch compilation flags
libomp_append(libomp_test_touch_libs "${CMAKE_THREAD_LIBS_INIT}")
if(${IA32})
libomp_append(libomp_test_touch_cflags -m32 LIBOMP_HAVE_M32_FLAG)
endif()
libomp_append(libomp_test_touch_libs ${LIBOMP_OUTPUT_DIRECTORY}/${LIBOMP_LIB_FILE})
if(APPLE)
set(libomp_test_touch_env "DYLD_LIBRARY_PATH=.:${LIBOMP_OUTPUT_DIRECTORY}:$ENV{DYLD_LIBRARY_PATH}")
else()
set(libomp_test_touch_env "LD_LIBRARY_PATH=.:${LIBOMP_OUTPUT_DIRECTORY}:$ENV{LD_LIBRARY_PATH}")
endif()
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
endif()
macro(libomp_test_touch_recipe test_touch_dir)
set(libomp_test_touch_dependencies ${LIBOMP_SRC_DIR}/test-touch.c omp)
set(libomp_test_touch_exe ${test_touch_dir}/test-touch${CMAKE_EXECUTABLE_SUFFIX})
set(libomp_test_touch_obj ${test_touch_dir}/test-touch${CMAKE_C_OUTPUT_EXTENSION})
if(WIN32)
if(${RELEASE_BUILD} OR ${RELWITHDEBINFO_BUILD})
if(${test_touch_dir} MATCHES "test-touch-mt")
libomp_append(libomp_test_touch_cflags /MT)
else()
libomp_append(libomp_test_touch_cflags /MD)
endif()
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
else()
if(${test_touch_dir} MATCHES "test-touch-mt")
libomp_append(libomp_test_touch_cflags /MTd)
else()
libomp_append(libomp_test_touch_cflags /MDd)
endif()
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
endif()
set(libomp_test_touch_out_flags -Fe${libomp_test_touch_exe} -Fo${libomp_test_touch_obj})
list(APPEND libomp_test_touch_dependencies ompimp)
else()
set(libomp_test_touch_out_flags -o ${libomp_test_touch_exe})
endif()
add_custom_command(
OUTPUT ${test_touch_dir}/.success ${libomp_test_touch_exe} ${libomp_test_touch_obj}
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${test_touch_dir}
COMMAND ${CMAKE_COMMAND} -E remove -f ${test_touch_dir}/*
COMMAND ${libomp_test_touch_compiler} ${libomp_test_touch_out_flags} ${libomp_test_touch_cflags}
${LIBOMP_SRC_DIR}/test-touch.c ${libomp_test_touch_ldflags} ${libomp_test_touch_libs}
COMMAND ${LIBOMP_SHELL} -c \"${libomp_test_touch_env} ${libomp_test_touch_exe}\"
COMMAND ${CMAKE_COMMAND} -E touch ${test_touch_dir}/.success
DEPENDS ${libomp_test_touch_dependencies}
)
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
endmacro()
libomp_append(libomp_test_touch_env "KMP_VERSION=1")
add_custom_target(libomp-test-touch DEPENDS ${libomp_test_touch_targets})
if(WIN32)
libomp_test_touch_recipe(test-touch-mt)
libomp_test_touch_recipe(test-touch-md)
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
else()
libomp_test_touch_recipe(test-touch-rt)
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
endif()
# test-relo
add_custom_target(libomp-test-relo DEPENDS test-relo/.success)
add_custom_command(
OUTPUT test-relo/.success test-relo/readelf.log
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/test-relo
COMMAND readelf -d ${LIBOMP_OUTPUT_DIRECTORY}/${LIBOMP_LIB_FILE} > test-relo/readelf.log
COMMAND grep -e TEXTREL test-relo/readelf.log \; test $$? -eq 1
COMMAND ${CMAKE_COMMAND} -E touch test-relo/.success
DEPENDS omp
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
)
# test-execstack
add_custom_target(libomp-test-execstack DEPENDS test-execstack/.success)
add_custom_command(
OUTPUT test-execstack/.success
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/test-execstack
COMMAND ${PERL_EXECUTABLE} ${LIBOMP_TOOLS_DIR}/check-execstack.pl --os=${LIBOMP_PERL_SCRIPT_OS}
--arch=${LIBOMP_ARCH} ${LIBOMP_OUTPUT_DIRECTORY}/${LIBOMP_LIB_FILE}
COMMAND ${CMAKE_COMMAND} -E touch test-execstack/.success
DEPENDS omp
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
)
# test-instr
add_custom_target(libomp-test-instr DEPENDS test-instr/.success)
add_custom_command(
OUTPUT test-instr/.success
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/test-instr
COMMAND ${PERL_EXECUTABLE} ${LIBOMP_TOOLS_DIR}/check-instruction-set.pl --os=${LIBOMP_PERL_SCRIPT_OS}
--arch=${LIBOMP_ARCH} --show --mic-arch=${LIBOMP_MIC_ARCH} ${LIBOMP_OUTPUT_DIRECTORY}/${LIBOMP_LIB_FILE}
COMMAND ${CMAKE_COMMAND} -E touch test-instr/.success
DEPENDS omp ${LIBOMP_TOOLS_DIR}/check-instruction-set.pl
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
)
# test-deps
add_custom_target(libomp-test-deps DEPENDS test-deps/.success)
set(libomp_expected_library_deps)
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
set(libomp_expected_library_deps libc.so.7 libthr.so.3)
elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
set(libomp_expected_library_deps libc.so.12 libpthread.so.1 libm.so.0)
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
elseif(APPLE)
set(libomp_expected_library_deps /usr/lib/libSystem.B.dylib)
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
elseif(WIN32)
set(libomp_expected_library_deps kernel32.dll)
libomp_append(libomp_expected_library_deps psapi.dll LIBOMP_OMPT_SUPPORT)
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
else()
if(${MIC})
set(libomp_expected_library_deps libc.so.6 libpthread.so.0 libdl.so.2)
if("${LIBOMP_MIC_ARCH}" STREQUAL "knf")
libomp_append(libomp_expected_library_deps ld-linux-l1om.so.2)
libomp_append(libomp_expected_library_deps libgcc_s.so.1)
elseif("${LIBOMP_MIC_ARCH}" STREQUAL "knc")
libomp_append(libomp_expected_library_deps ld-linux-k1om.so.2)
endif()
else()
set(libomp_expected_library_deps libdl.so.2 libgcc_s.so.1)
if(${IA32})
libomp_append(libomp_expected_library_deps libc.so.6)
libomp_append(libomp_expected_library_deps ld-linux.so.2)
elseif(${INTEL64})
libomp_append(libomp_expected_library_deps libc.so.6)
libomp_append(libomp_expected_library_deps ld-linux-x86-64.so.2)
elseif(${ARM})
libomp_append(libomp_expected_library_deps libc.so.6)
libomp_append(libomp_expected_library_deps libffi.so.6)
libomp_append(libomp_expected_library_deps libffi.so.5)
libomp_append(libomp_expected_library_deps ld-linux-armhf.so.3)
elseif(${PPC64})
libomp_append(libomp_expected_library_deps libc.so.6)
libomp_append(libomp_expected_library_deps ld64.so.1)
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
endif()
libomp_append(libomp_expected_library_deps libpthread.so.0 IF_FALSE STUBS_LIBRARY)
endif()
libomp_append(libomp_expected_library_deps libstdc++.so.6 LIBOMP_USE_STDCPPLIB)
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
endif()
# Perl script expects comma separated list
string(REPLACE ";" "," libomp_expected_library_deps "${libomp_expected_library_deps}")
add_custom_command(
OUTPUT test-deps/.success
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/test-deps
COMMAND ${PERL_EXECUTABLE} ${LIBOMP_TOOLS_DIR}/check-depends.pl --os=${LIBOMP_PERL_SCRIPT_OS}
--arch=${LIBOMP_ARCH} --expected="${libomp_expected_library_deps}" ${LIBOMP_OUTPUT_DIRECTORY}/${LIBOMP_LIB_FILE}
COMMAND ${CMAKE_COMMAND} -E touch test-deps/.success
DEPENDS omp ${LIBOMP_TOOLS_DIR}/check-depends.pl
Large Refactor of CMake build system This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
2015-07-16 00:05:30 +08:00
)