aboutsummaryrefslogtreecommitdiff
path: root/source/CMakeLists.txt
blob: d031be940cb4fc3c7a8a7a3796250e1e9986afb3 (plain) (blame)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
include_directories(.)

if ( CMAKE_SYSTEM_NAME MATCHES "Linux" )
include_directories(
  Plugins/Process/Linux
  Plugins/Process/POSIX
  )
endif ()

if ( CMAKE_SYSTEM_NAME MATCHES "FreeBSD" )
include_directories(
  Plugins/Process/FreeBSD
  Plugins/Process/POSIX
  )
endif ()

if ( CMAKE_SYSTEM_NAME MATCHES "NetBSD" )
include_directories(
  Plugins/Process/POSIX
  )
endif ()


set(lldbBase_SOURCES
    lldb.cpp
  )

foreach(file
        "${LLDB_SOURCE_DIR}/.git/logs/HEAD" # Git
        "${LLDB_SOURCE_DIR}/.svn/wc.db"     # SVN 1.7
        "${LLDB_SOURCE_DIR}/.svn/entries"   # SVN 1.6
        )
  if(EXISTS "${file}")
    set(lldb_vc "${file}")
    break()
  endif()
endforeach()

if(DEFINED lldb_vc)
  set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/SVNVersion.inc")
  set(get_svn_script "${LLVM_CMAKE_PATH}/GetSVN.cmake")

  # Create custom target to generate the VC revision include.
  add_custom_command(OUTPUT "${version_inc}"
    DEPENDS "${lldb_vc}" "${get_svn_script}"
    COMMAND
    ${CMAKE_COMMAND} "-DFIRST_SOURCE_DIR=${LLDB_SOURCE_DIR}"
                     "-DFIRST_NAME=LLDB"
                     "-DHEADER_FILE=${version_inc}"
                     -P "${get_svn_script}")

  # Mark the generated header as being generated.
  set_source_files_properties("${version_inc}"
    PROPERTIES GENERATED TRUE
               HEADER_FILE_ONLY TRUE)

  # Tell Version.cpp that it needs to build with -DHAVE_SVN_VERSION_INC.
  set_property(SOURCE lldb.cpp APPEND PROPERTY 
               COMPILE_DEFINITIONS "HAVE_SVN_VERSION_INC")
  list(APPEND lldbBase_SOURCES ${version_inc})
endif()

if(APPLE)
  set(apple_version_inc "${CMAKE_CURRENT_BINARY_DIR}/AppleVersion.inc")
  set(apple_version_script "${LLDB_SOURCE_DIR}/cmake/modules/EmbedAppleVersion.cmake")
  set(info_plist ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist)

  # Create custom target to generate the VC revision include.
  add_custom_command(OUTPUT "${apple_version_inc}"
    DEPENDS "${apple_version_script}" "${info_plist}"
    COMMAND
    ${CMAKE_COMMAND} "-DLLDB_INFO_PLIST=${info_plist}"
                     "-DHEADER_FILE=${apple_version_inc}"
                     -P "${apple_version_script}")

  # Mark the generated header as being generated.
  set_source_files_properties("${apple_version_inc}"
    PROPERTIES GENERATED TRUE
               HEADER_FILE_ONLY TRUE)

  # Tell Version.cpp that it needs to build with -DHAVE_SVN_VERSION_INC.
  set_property(SOURCE lldb.cpp APPEND PROPERTY 
               COMPILE_DEFINITIONS "HAVE_APPLE_VERSION_INC")
  list(APPEND lldbBase_SOURCES ${apple_version_inc})
elseif(LLDB_VERSION_STRING)
  set_property(SOURCE lldb.cpp APPEND PROPERTY
               COMPILE_DEFINITIONS "LLDB_VERSION_STRING=${LLDB_VERSION_STRING}")
endif()

add_lldb_library(lldbBase
  ${lldbBase_SOURCES}
  )

add_subdirectory(Breakpoint)
add_subdirectory(Commands)
add_subdirectory(Core)
add_subdirectory(DataFormatters)
add_subdirectory(Expression)
add_subdirectory(Host)
add_subdirectory(Initialization)
add_subdirectory(Interpreter)
add_subdirectory(Plugins)
add_subdirectory(Symbol)
add_subdirectory(Target)
add_subdirectory(Utility)

# Build API last.  Since liblldb needs to link against every other target, it needs
# those targets to have already been created.
add_subdirectory(API)