[flang][cuda] Adapt ExternalNameConversion to work in gpu module (#117039)
[llvm-project.git] / flang / lib / Decimal / CMakeLists.txt
blob880b190f1c5815a1ed4fe4f3defe53327c92a5bc
1 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
2   cmake_minimum_required(VERSION 3.20.0)
4   project(FortranDecimal C CXX)
6   set(CMAKE_CXX_STANDARD 17)
7   set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
8   set(CMAKE_CXX_EXTENSIONS OFF)
10   set(FLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..")
12   set(LLVM_COMMON_CMAKE_UTILS "${FLANG_SOURCE_DIR}/../cmake")
13   set(LLVM_CMAKE_UTILS "${FLANG_SOURCE_DIR}/../llvm/cmake")
14   set(CLANG_CMAKE_UTILS "${FLANG_SOURCE_DIR}/../clang/cmake")
16   # Add path for custom modules
17   list(INSERT CMAKE_MODULE_PATH 0
18     "${FLANG_SOURCE_DIR}/cmake"
19     "${FLANG_SOURCE_DIR}/cmake/modules"
20     "${LLVM_COMMON_CMAKE_UTILS}"
21     "${LLVM_COMMON_CMAKE_UTILS}/Modules"
22     "${LLVM_CMAKE_UTILS}"
23     "${LLVM_CMAKE_UTILS}/modules"
24     "${CLANG_CMAKE_UTILS}/modules"
25     )
27   include(AddClang)
28   include(AddLLVM)
29   include(AddFlang)
30   include(HandleLLVMOptions)
32   include(TestBigEndian)
33   test_big_endian(IS_BIGENDIAN)
34   if (IS_BIGENDIAN)
35     add_compile_definitions(FLANG_BIG_ENDIAN=1)
36   else ()
37     add_compile_definitions(FLANG_LITTLE_ENDIAN=1)
38   endif ()
39   include_directories(BEFORE
40     ${FLANG_SOURCE_DIR}/include)
41 endif()
43 check_cxx_compiler_flag(-fno-lto FLANG_RUNTIME_HAS_FNO_LTO_FLAG)
44 if (FLANG_RUNTIME_HAS_FNO_LTO_FLAG)
45   append("-fno-lto" CMAKE_CXX_FLAGS)
46 endif()
48 # Disable libstdc++ assertions, even in an LLVM_ENABLE_ASSERTIONS build, to
49 # avoid an unwanted dependency on libstdc++.so.
50 add_definitions(-U_GLIBCXX_ASSERTIONS)
52 set(sources
53   binary-to-decimal.cpp
54   decimal-to-binary.cpp
57 include(AddFlangOffloadRuntime)
58 enable_cuda_compilation(FortranDecimal "${sources}")
59 enable_omp_offload_compilation("${sources}")
61 add_flang_library(FortranDecimal INSTALL_WITH_TOOLCHAIN ${sources})
63 if (DEFINED MSVC)
64   set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded)
65   add_flang_library(FortranDecimal.static INSTALL_WITH_TOOLCHAIN
66           binary-to-decimal.cpp
67           decimal-to-binary.cpp
68   )
69   set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
70   add_flang_library(FortranDecimal.dynamic INSTALL_WITH_TOOLCHAIN
71     binary-to-decimal.cpp
72     decimal-to-binary.cpp
73   )
74   set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDebug)
75   add_flang_library(FortranDecimal.static_dbg INSTALL_WITH_TOOLCHAIN
76           binary-to-decimal.cpp
77           decimal-to-binary.cpp
78   )
79   set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDebugDLL)
80   add_flang_library(FortranDecimal.dynamic_dbg INSTALL_WITH_TOOLCHAIN
81     binary-to-decimal.cpp
82     decimal-to-binary.cpp
83   )
84   add_dependencies(FortranDecimal FortranDecimal.static FortranDecimal.dynamic
85     FortranDecimal.static_dbg FortranDecimal.dynamic_dbg)
86 endif()