File: CMakeLists.txt

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (62 lines) | stat: -rw-r--r-- 2,062 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Needed by LLVM's CMake checks because this file defines multiple targets.
set(LLVM_OPTIONAL_SOURCES ExportedFuncs.cpp PipSqueak.cpp)

set(LLVM_LINK_COMPONENTS Support)

add_library(DynamicLibraryLib STATIC
  ExportedFuncs.cpp
  )
set_target_properties(DynamicLibraryLib PROPERTIES FOLDER "Tests")

# extract_symbols.py relies on all its library arguments being in the same
# directory, so we must set the output directory in the same way as if
# add_llvm_library was used.
set_output_directory(DynamicLibraryLib
  LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}
  )

add_llvm_unittest(DynamicLibraryTests
  DynamicLibraryTest.cpp
  )
target_link_libraries(DynamicLibraryTests PRIVATE DynamicLibraryLib)
export_executable_symbols(DynamicLibraryTests)

function(dynlib_add_module NAME)
  add_library(${NAME} MODULE
    PipSqueak.cpp
    )
  set_target_properties(${NAME} PROPERTIES FOLDER "Tests")

  set_output_directory(${NAME}
    BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
    LIBRARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
    )

  set_target_properties(${NAME}
    PROPERTIES PREFIX ""
    SUFFIX ${LLVM_PLUGIN_EXT}
    )

  add_dependencies(DynamicLibraryTests ${NAME})
  
  if(LLVM_INTEGRATED_CRT_ALLOC)
    # We need to link in the Support lib for the Memory allocator override,
    # otherwise the DynamicLibrary.Shutdown test will fail, because it would
    # allocate memory with the CRT allocator, and release it with our custom
    # allocator (see llvm/lib/Support/Windows/Memory.inc).
    # /INCLUDE:malloc is there to force searching into LLVMSupport before libucrt
    llvm_map_components_to_libnames(llvm_libs Support)
    target_link_libraries(${NAME} ${llvm_libs} "-INCLUDE:malloc")
  endif()
  
endfunction(dynlib_add_module)

# Revert -Wl,-z,nodelete on this test since it relies on the file
# being unloaded.
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
  string(REPLACE "-Wl,-z,nodelete" "" CMAKE_MODULE_LINKER_FLAGS
    ${CMAKE_MODULE_LINKER_FLAGS})
endif()

dynlib_add_module(PipSqueak)
dynlib_add_module(SecondLib)