diff --git a/README.md b/README.md index 9d93a60ba..1d7410708 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ It can be set by the user in different locations if needed. git clone https://github.com/ROCm/rocprofiler-sdk.git rocprofiler-sdk-source cmake \ -B rocprofiler-sdk-build \ + -D ROCPROFILER_BUILD_TOOLS=ON \ -D ROCPROFILER_BUILD_TESTS=ON \ -D ROCPROFILER_BUILD_SAMPLES=ON \ -D CMAKE_INSTALL_PREFIX=/opt/rocm \ diff --git a/cmake/rocprofiler_config_install.cmake b/cmake/rocprofiler_config_install.cmake index 5b067e895..91fd63d44 100644 --- a/cmake/rocprofiler_config_install.cmake +++ b/cmake/rocprofiler_config_install.cmake @@ -17,25 +17,29 @@ if(ROCPROFILER_BUILD_DOCS) COMPONENT docs) endif() -install( - FILES ${PROJECT_SOURCE_DIR}/LICENSE - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/doc/${PACKAGE_NAME}-tests - COMPONENT tests) +if(ROCPROFILER_BUILD_SAMPLES) + install( + DIRECTORY ${PROJECT_SOURCE_DIR}/samples + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME} + COMPONENT samples) +endif() -install( - DIRECTORY ${PROJECT_SOURCE_DIR}/samples - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME} - COMPONENT samples) +if(ROCPROFILER_BUILD_TESTS) + install( + FILES ${PROJECT_SOURCE_DIR}/LICENSE + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/doc/${PACKAGE_NAME}-tests + COMPONENT tests) -install( - DIRECTORY ${PROJECT_SOURCE_DIR}/tests - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME} - COMPONENT tests) + install( + DIRECTORY ${PROJECT_SOURCE_DIR}/tests + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME} + COMPONENT tests) -install( - FILES ${PROJECT_SOURCE_DIR}/requirements.txt - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}/tests - COMPONENT tests) + install( + FILES ${PROJECT_SOURCE_DIR}/requirements.txt + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}/tests + COMPONENT tests) +endif() install( EXPORT ${PACKAGE_NAME}-targets diff --git a/cmake/rocprofiler_config_packaging.cmake b/cmake/rocprofiler_config_packaging.cmake index 01a62b247..edd6bd432 100644 --- a/cmake/rocprofiler_config_packaging.cmake +++ b/cmake/rocprofiler_config_packaging.cmake @@ -85,9 +85,18 @@ set(COMPONENT_DESC_docs "rocprofiler-sdk documentation") set(COMPONENT_DESC_tests "rocprofiler-sdk tests") set(COMPONENT_DESC_roctx "ROCm Tools Extension library and headers") -set(EXPECTED_PACKAGING_COMPONENTS 6) +set(EXPECTED_PACKAGING_COMPONENTS 3) +if(ROCPROFILER_BUILD_TOOLS) + math(EXPR EXPECTED_PACKAGING_COMPONENTS "${EXPECTED_PACKAGING_COMPONENTS} + 1" DECIMAL) +endif() if(ROCPROFILER_BUILD_DOCS) - set(EXPECTED_PACKAGING_COMPONENTS 7) + math(EXPR EXPECTED_PACKAGING_COMPONENTS "${EXPECTED_PACKAGING_COMPONENTS} + 1" DECIMAL) +endif() +if(ROCPROFILER_BUILD_SAMPLES) + math(EXPR EXPECTED_PACKAGING_COMPONENTS "${EXPECTED_PACKAGING_COMPONENTS} + 1" DECIMAL) +endif() +if(ROCPROFILER_BUILD_TESTS) + math(EXPR EXPECTED_PACKAGING_COMPONENTS "${EXPECTED_PACKAGING_COMPONENTS} + 1" DECIMAL) endif() if(NOT NUM_ROCPROFILER_PACKAGING_COMPONENTS EQUAL EXPECTED_PACKAGING_COMPONENTS) diff --git a/cmake/rocprofiler_options.cmake b/cmake/rocprofiler_options.cmake index 2da744561..be6aa4897 100644 --- a/cmake/rocprofiler_options.cmake +++ b/cmake/rocprofiler_options.cmake @@ -34,6 +34,8 @@ rocprofiler_add_option( ROCPROFILER_BUILD_CI "Enable continuous integration default values for options" OFF ADVANCED) +rocprofiler_add_option(ROCPROFILER_BUILD_TOOLS "Enable building the tools" + ${ROCPROFILER_BUILD_CI}) rocprofiler_add_option(ROCPROFILER_BUILD_TESTS "Enable building the tests" ${ROCPROFILER_BUILD_CI}) rocprofiler_add_option(ROCPROFILER_BUILD_SAMPLES "Enable building the code samples" diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index bb26a4e67..76621196a 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -167,28 +167,30 @@ if(ROCPROFILER_BUILD_DOCS) endif() # perfetto -rocprofiler_checkout_git_submodule( - RECURSIVE - RELATIVE_PATH external/perfetto - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - TEST_FILE meson.build - REPO_URL https://android.googlesource.com/platform/external/perfetto external/perfetto - REPO_BRANCH "v44.0") - -add_library(rocprofiler-sdk-perfetto-static-library STATIC) -target_sources( - rocprofiler-sdk-perfetto-static-library - PRIVATE ${PROJECT_SOURCE_DIR}/external/perfetto/sdk/perfetto.h - ${PROJECT_SOURCE_DIR}/external/perfetto/sdk/perfetto.cc) -target_include_directories( - rocprofiler-sdk-perfetto-static-library SYSTEM - INTERFACE $) -set_target_properties( - rocprofiler-sdk-perfetto-static-library - PROPERTIES POSITION_INDEPENDENT_CODE ON OUTPUT_NAME rocprofiler-sdk-perfetto) -target_link_libraries( - rocprofiler-sdk-perfetto - INTERFACE $) +if(ROCPROFILER_BUILD_TOOLS) + rocprofiler_checkout_git_submodule( + RECURSIVE + RELATIVE_PATH external/perfetto + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + TEST_FILE meson.build + REPO_URL https://android.googlesource.com/platform/external/perfetto external/perfetto + REPO_BRANCH "v44.0") + + add_library(rocprofiler-sdk-perfetto-static-library STATIC) + target_sources( + rocprofiler-sdk-perfetto-static-library + PRIVATE ${PROJECT_SOURCE_DIR}/external/perfetto/sdk/perfetto.h + ${PROJECT_SOURCE_DIR}/external/perfetto/sdk/perfetto.cc) + target_include_directories( + rocprofiler-sdk-perfetto-static-library SYSTEM + INTERFACE $) + set_target_properties( + rocprofiler-sdk-perfetto-static-library + PROPERTIES POSITION_INDEPENDENT_CODE ON OUTPUT_NAME rocprofiler-sdk-perfetto) + target_link_libraries( + rocprofiler-sdk-perfetto + INTERFACE $) +endif() # ELFIO rocprofiler_checkout_git_submodule( @@ -208,18 +210,22 @@ if(TARGET rocprofiler-sdk-elfio) endif() # OTF2 -add_subdirectory(otf2) +if(ROCPROFILER_BUILD_TOOLS) + add_subdirectory(otf2) +endif() -rocprofiler_checkout_git_submodule( - RECURSIVE - RELATIVE_PATH external/json - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - REPO_URL https://github.com/nlohmann/json.git - REPO_BRANCH "develop") +if(ROCPROFILER_BUILD_TOOLS) + rocprofiler_checkout_git_submodule( + RECURSIVE + RELATIVE_PATH external/json + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + REPO_URL https://github.com/nlohmann/json.git + REPO_BRANCH "develop") -add_subdirectory(json) + add_subdirectory(json) -# target_link_libraries(rocprofiler-sdk-json INTERFACE $) -target_include_directories( - rocprofiler-sdk-json SYSTEM - INTERFACE $) + # target_link_libraries(rocprofiler-sdk-json INTERFACE $) + target_include_directories( + rocprofiler-sdk-json SYSTEM + INTERFACE $) +endif() diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index ec8d12b38..2c4103113 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -14,7 +14,9 @@ rocprofiler_activate_clang_tidy() add_subdirectory(include) add_subdirectory(lib) -add_subdirectory(libexec) -add_subdirectory(bin) +if(ROCPROFILER_BUILD_TOOLS) + add_subdirectory(libexec) + add_subdirectory(bin) +endif() add_subdirectory(docs) add_subdirectory(scripts) diff --git a/source/docs/install/installation.rst b/source/docs/install/installation.rst index 3507ec8d6..33340c335 100644 --- a/source/docs/install/installation.rst +++ b/source/docs/install/installation.rst @@ -64,6 +64,7 @@ Building ROCprofiler-SDK git clone https://github.com/ROCm/rocprofiler-sdk.git rocprofiler-sdk-source cmake \ -B rocprofiler-sdk-build \ + -D ROCPROFILER_BUILD_TOOLS=ON \ -D ROCPROFILER_BUILD_TESTS=ON \ -D ROCPROFILER_BUILD_SAMPLES=ON \ -D CMAKE_INSTALL_PREFIX=/opt/rocm \ @@ -95,4 +96,4 @@ To run the built tests, ``cd`` into the ``rocprofiler-sdk-build`` directory and .. code-block:: bash - /usr/local/bin/python -m pip install -r requirements.txt \ No newline at end of file + /usr/local/bin/python -m pip install -r requirements.txt diff --git a/source/lib/CMakeLists.txt b/source/lib/CMakeLists.txt index a5019423b..df33e176d 100644 --- a/source/lib/CMakeLists.txt +++ b/source/lib/CMakeLists.txt @@ -3,14 +3,18 @@ # set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "core") add_subdirectory(common) -add_subdirectory(output) +if(ROCPROFILER_BUILD_TOOLS) + add_subdirectory(output) +endif() add_subdirectory(rocprofiler-sdk) - -set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "tools") -add_subdirectory(rocprofiler-sdk-codeobj) add_subdirectory(rocprofiler-sdk-roctx) -add_subdirectory(rocprofiler-sdk-att) -add_subdirectory(rocprofiler-sdk-tool) + +if(ROCPROFILER_BUILD_TOOLS) + set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "tools") + add_subdirectory(rocprofiler-sdk-codeobj) + add_subdirectory(rocprofiler-sdk-att) + add_subdirectory(rocprofiler-sdk-tool) +endif() if(ROCPROFILER_BUILD_TESTS) add_subdirectory(tests) diff --git a/source/lib/rocprofiler-sdk/counters/metrics.cpp b/source/lib/rocprofiler-sdk/counters/metrics.cpp index cd533245a..ae5bc29dc 100644 --- a/source/lib/rocprofiler-sdk/counters/metrics.cpp +++ b/source/lib/rocprofiler-sdk/counters/metrics.cpp @@ -46,6 +46,7 @@ #include // for dladdr #include #include +#include #include #include diff --git a/source/libexec/rocprofiler-sdk/rocprofiler-avail/rocprofv3_avail.cpp b/source/libexec/rocprofiler-sdk/rocprofiler-avail/rocprofv3_avail.cpp index b67b76a2b..7fd69b7f0 100644 --- a/source/libexec/rocprofiler-sdk/rocprofiler-avail/rocprofv3_avail.cpp +++ b/source/libexec/rocprofiler-sdk/rocprofiler-avail/rocprofv3_avail.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include