1add_custom_target(profile)
2
3set(PROFILE_SOURCES
4  GCDAProfiling.c
5  InstrProfiling.c
6  InstrProfilingBuffer.c
7  InstrProfilingFile.c
8  InstrProfilingPlatformDarwin.c
9  InstrProfilingPlatformOther.c
10  InstrProfilingRuntime.cc)
11
12if(APPLE)
13  add_compiler_rt_osx_static_runtime(clang_rt.profile_osx
14    ARCH ${PROFILE_SUPPORTED_ARCH}
15    SOURCES ${PROFILE_SOURCES})
16  add_dependencies(profile clang_rt.profile_osx)
17else()
18  foreach(arch ${PROFILE_SUPPORTED_ARCH})
19    add_compiler_rt_runtime(clang_rt.profile-${arch} ${arch} STATIC
20      SOURCES ${PROFILE_SOURCES})
21    add_dependencies(profile clang_rt.profile-${arch})
22
23    add_compiler_rt_runtime(clang_rt.profile-pic-${arch} ${arch} STATIC
24      CFLAGS -fPIC
25      SOURCES ${PROFILE_SOURCES})
26    add_dependencies(profile clang_rt.profile-pic-${arch})
27  endforeach()
28endif()
29
30add_dependencies(compiler-rt profile)
31