1 # Copyright (c) 2013-2018, Intel Corporation
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are met:
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.
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.
31 set(LIBIPT_SECTION_FILES
38 src/pt_packet_decoder.c
39 src/pt_query_decoder.c
47 src/pt_image_section_cache.c
54 src/pt_decoder_function.c
57 src/pt_block_decoder.c
64 internal/include/posix
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)
73 # export libipt symbols
75 /Dpt_export=__declspec\(dllexport\)
79 internal/include/windows
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)
86 set(LIBIPT_FILES ${LIBIPT_FILES} ${LIBIPT_SECTION_FILES})
88 add_library(libipt SHARED
92 # put the version into the intel-pt header
95 ${CMAKE_CURRENT_SOURCE_DIR}/include/intel-pt.h.in
96 ${CMAKE_CURRENT_BINARY_DIR}/include/intel-pt.h
99 set_target_properties(libipt PROPERTIES
101 PUBLIC_HEADER ${CMAKE_CURRENT_BINARY_DIR}/include/intel-pt.h
102 VERSION ${PT_VERSION}
103 SOVERSION ${PT_VERSION_MAJOR}
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}
114 function(add_ptunit_std_test name)
115 add_ptunit_c_test(${name} src/pt_${name}.c ${ARGN})
116 endfunction(add_ptunit_std_test)
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)
134 add_ptunit_c_test(mapped_section src/pt_asid.c)
135 add_ptunit_c_test(query
138 src/pt_packet_decoder.c
143 src/pt_query_decoder.c
145 src/pt_decoder_function.c
146 src/pt_packet_decoder.c
151 add_ptunit_c_test(section ${LIBIPT_SECTION_FILES})
152 add_ptunit_c_test(section-file
153 test/src/ptunit-section.c
155 src/pt_section_file.c
157 add_ptunit_c_test(packet
159 src/pt_packet_decoder.c
162 src/pt_decoder_function.c
165 add_ptunit_c_test(fetch
166 src/pt_decoder_function.c
171 add_ptunit_cpp_test(cpp)
172 add_ptunit_libraries(cpp libipt)