Skip to content

Commit

Permalink
allow to use a perfetto library already built (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjodinchr authored Jan 13, 2024
1 parent dbb75de commit 3e8e3d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ For a real life examples, have a look at:
* `PERFETTO_TRACE_PROCESSOR_LIB` (REQUIRED): path to `libtrace_processor.a` produces by a perfetto build.
* `PERFETTO_INTERNAL_INCLUDE_PATH` (REQUIRED): path to perfetto internal include directory (`<perfetto>/include`), or where it is installed.
* OPTIONAL:
* `PERFETTO_LIBRARY`: name of a perfetto library already available (avoid having to compile `perfetto.cc`).
* `PERFETTO_GEN_INCLUDE_PATH`: path to a a perfetto build (if not installed) `<perfetto>/out/release/gen/build_config`.
* `PERFETTO_CXX_CONFIG_INCLUDE_PATH`: path to perfetto buildtools config `<perfetto>/buildtools/libcxx_config`.
* `PERFETTO_CXX_SYSTEM_INCLUDE_PATH`: path to perfetto buildtools include `<perfetto>/buildtools/libcxx/include`.
Expand Down
10 changes: 8 additions & 2 deletions layer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

add_library (vulkan-shader-profiler MODULE layer.cpp ${PERFETTO_SDK_PATH}/perfetto.cc)
if (NOT PERFETTO_LIBRARY)
add_library(perfetto STATIC ${PERFETTO_SDK_PATH}/perfetto.cc)
set_target_properties(perfetto PROPERTIES POSITION_INDEPENDENT_CODE ON)
set(PERFETTO_LIBRARY perfetto)
endif()

add_library (vulkan-shader-profiler MODULE layer.cpp)
target_include_directories(vulkan-shader-profiler PUBLIC ${Vulkan_INCLUDE_DIRS} ${PERFETTO_SDK_PATH} ${SPIRV-Tools-opt_INCLUDE_DIRS})
target_link_libraries (vulkan-shader-profiler ${SPIRV-Tools-opt_LIBRARIES})
target_link_libraries (vulkan-shader-profiler ${SPIRV-Tools-opt_LIBRARIES} ${PERFETTO_LIBRARY})

set(BACKEND "InProcess"
CACHE STRING "Select perfetto backend")
Expand Down

0 comments on commit 3e8e3d9

Please sign in to comment.