]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/processor-trace/libipt/CMakeLists.txt
Implement pci_enable_msi() and pci_disable_msi() in the LinuxKPI.
[FreeBSD/FreeBSD.git] / contrib / processor-trace / libipt / CMakeLists.txt
1 # Copyright (c) 2013-2018, Intel Corporation
2 #
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are met:
5 #
6 #  * Redistributions of source code must retain the above copyright notice,
7 #    this list of conditions and the following disclaimer.
8 #  * Redistributions in binary form must reproduce the above copyright notice,
9 #    this list of conditions and the following disclaimer in the documentation
10 #    and/or other materials provided with the distribution.
11 #  * Neither the name of Intel Corporation nor the names of its contributors
12 #    may be used to endorse or promote products derived from this software
13 #    without specific prior written permission.
14 #
15 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 # POSSIBILITY OF SUCH DAMAGE.
26
27 include_directories(
28   internal/include
29 )
30
31 set(LIBIPT_SECTION_FILES
32   src/pt_section.c
33   src/pt_section_file.c
34 )
35
36 set(LIBIPT_FILES
37   src/pt_error.c
38   src/pt_packet_decoder.c
39   src/pt_query_decoder.c
40   src/pt_encoder.c
41   src/pt_sync.c
42   src/pt_version.c
43   src/pt_last_ip.c
44   src/pt_tnt_cache.c
45   src/pt_ild.c
46   src/pt_image.c
47   src/pt_image_section_cache.c
48   src/pt_retstack.c
49   src/pt_insn_decoder.c
50   src/pt_time.c
51   src/pt_asid.c
52   src/pt_event_queue.c
53   src/pt_packet.c
54   src/pt_decoder_function.c
55   src/pt_config.c
56   src/pt_insn.c
57   src/pt_block_decoder.c
58   src/pt_block_cache.c
59   src/pt_msec_cache.c
60 )
61
62 if (CMAKE_HOST_UNIX)
63   include_directories(
64     internal/include/posix
65   )
66
67   set(LIBIPT_FILES ${LIBIPT_FILES} src/posix/init.c)
68   set(LIBIPT_SECTION_FILES ${LIBIPT_SECTION_FILES} src/posix/pt_section_posix.c)
69 endif (CMAKE_HOST_UNIX)
70
71 if (CMAKE_HOST_WIN32)
72   add_definitions(
73     # export libipt symbols
74     #
75     /Dpt_export=__declspec\(dllexport\)
76   )
77
78   include_directories(
79     internal/include/windows
80   )
81
82   set(LIBIPT_FILES ${LIBIPT_FILES} src/windows/init.c)
83   set(LIBIPT_SECTION_FILES ${LIBIPT_SECTION_FILES} src/windows/pt_section_windows.c)
84 endif (CMAKE_HOST_WIN32)
85
86 set(LIBIPT_FILES ${LIBIPT_FILES} ${LIBIPT_SECTION_FILES})
87
88 add_library(libipt SHARED
89   ${LIBIPT_FILES}
90 )
91
92 # put the version into the intel-pt header
93 #
94 configure_file(
95   ${CMAKE_CURRENT_SOURCE_DIR}/include/intel-pt.h.in
96   ${CMAKE_CURRENT_BINARY_DIR}/include/intel-pt.h
97 )
98
99 set_target_properties(libipt PROPERTIES
100   PREFIX ""
101   PUBLIC_HEADER ${CMAKE_CURRENT_BINARY_DIR}/include/intel-pt.h
102   VERSION   ${PT_VERSION}
103   SOVERSION ${PT_VERSION_MAJOR}
104 )
105
106 install(TARGETS libipt
107   RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
108   LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
109   ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
110   PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
111 )
112
113
114 function(add_ptunit_std_test name)
115     add_ptunit_c_test(${name} src/pt_${name}.c ${ARGN})
116 endfunction(add_ptunit_std_test)
117
118
119 add_ptunit_std_test(last_ip)
120 add_ptunit_std_test(tnt_cache)
121 add_ptunit_std_test(retstack)
122 add_ptunit_std_test(ild)
123 add_ptunit_std_test(cpu)
124 add_ptunit_std_test(time)
125 add_ptunit_std_test(asid)
126 add_ptunit_std_test(event_queue)
127 add_ptunit_std_test(image src/pt_asid.c)
128 add_ptunit_std_test(sync src/pt_packet.c)
129 add_ptunit_std_test(config)
130 add_ptunit_std_test(image_section_cache)
131 add_ptunit_std_test(block_cache)
132 add_ptunit_std_test(msec_cache)
133
134 add_ptunit_c_test(mapped_section src/pt_asid.c)
135 add_ptunit_c_test(query
136   src/pt_encoder.c
137   src/pt_last_ip.c
138   src/pt_packet_decoder.c
139   src/pt_sync.c
140   src/pt_tnt_cache.c
141   src/pt_time.c
142   src/pt_event_queue.c
143   src/pt_query_decoder.c
144   src/pt_packet.c
145   src/pt_decoder_function.c
146   src/pt_packet_decoder.c
147   src/pt_config.c
148   src/pt_time.c
149   src/pt_block_cache.c
150 )
151 add_ptunit_c_test(section ${LIBIPT_SECTION_FILES})
152 add_ptunit_c_test(section-file
153   test/src/ptunit-section.c
154   src/pt_section.c
155   src/pt_section_file.c
156 )
157 add_ptunit_c_test(packet
158   src/pt_encoder.c
159   src/pt_packet_decoder.c
160   src/pt_sync.c
161   src/pt_packet.c
162   src/pt_decoder_function.c
163   src/pt_config.c
164 )
165 add_ptunit_c_test(fetch
166   src/pt_decoder_function.c
167   src/pt_encoder.c
168   src/pt_config.c
169 )
170
171 add_ptunit_cpp_test(cpp)
172 add_ptunit_libraries(cpp libipt)