diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bd50bfa43..7401e3f9b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,6 @@ -message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&") -message(" CMake AMD SMI (Library) [root] ") -message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&") # # Minimum version of cmake required # -## Verbose output. -set(CMAKE_VERBOSE_MAKEFILE on) - cmake_minimum_required(VERSION 3.20) set(AMD_SMI "amd_smi") @@ -174,10 +168,6 @@ if(ENABLE_ESMI_LIB) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-write-strings") endif() -# sets DRM_LIBRARIES and DRM_INCLUDE_DIRS -# sets AMDGPU_DRM_LIBRARIES and AMDGPU_DRM_INCLUDE_DIRS - - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/third_party/shared_mutex ${CMAKE_CURRENT_SOURCE_DIR}/include/amd_smi ${ESMI_INC_DIR}) @@ -390,7 +380,3 @@ set(CPACK_RPM_FILE_NAME "RPM-DEFAULT") include(CPack) generic_package_post() - -message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&") -message(" CMake AMD SMI (Library) [root] END ") -message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&") diff --git a/README.md b/README.md index a1eb43089e..1913f76f49 100644 --- a/README.md +++ b/README.md @@ -169,7 +169,7 @@ This section describes the prerequisites and steps to build AMD SMI from source. To build the AMD SMI library, the following components are required. Note that the software versions specified were used during development; earlier versions are not guaranteed to work. -* CMake (v3.15.0 or later) -- `python3 -m pip install cmake` +* CMake (v3.20.0 or later) -- `python3 -m pip install cmake` * g++ (v5.4.0 or later) * libdrm-dev (for Ubuntu and Debian) * libdrm-devel (for RPM-based distributions) diff --git a/amdsmi_cli/CMakeLists.txt b/amdsmi_cli/CMakeLists.txt index 46a49648a5..acdcaf0081 100644 --- a/amdsmi_cli/CMakeLists.txt +++ b/amdsmi_cli/CMakeLists.txt @@ -2,7 +2,6 @@ message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&") message(" CMake AMDSMI CLI Install ") message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&") -set(CMAKE_VERBOSE_MAKEFILE on) # Set CLI Build Directory set(PY_PACKAGE_DIR "amdsmi_cli") set(PY_CLI_INSTALL_DIR diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 22e36d06ec..b5322fea2a 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -1,5 +1,4 @@ -set(CMAKE_VERBOSE_MAKEFILE on) -cmake_minimum_required(VERSION 3.15) +cmake_minimum_required(VERSION 3.20) option(ENABLE_ESMI_LIB "Build ESMI Library" ON) option(CMAKE_VERBOSE_MAKEFILE "Enable verbose output" ON) diff --git a/goamdsmi_shim/CMakeLists.txt b/goamdsmi_shim/CMakeLists.txt index 1af606cd0b..5542c7621e 100644 --- a/goamdsmi_shim/CMakeLists.txt +++ b/goamdsmi_shim/CMakeLists.txt @@ -61,8 +61,6 @@ if (NOT GOAMDSMI_SHIM_PACKAGE) endif() set(CPACK_PACKAGE_FILE_NAME "${GOAMDSMI_SHIM_PACKAGE}-${SO_VERSION_STRING}") -## Verbose output. -set(CMAKE_VERBOSE_MAKEFILE on) ## Compiler flags set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fpic -fno-rtti -m64") diff --git a/py-interface/CMakeLists.txt b/py-interface/CMakeLists.txt index 18f1590fb3..c3e4f5486e 100644 --- a/py-interface/CMakeLists.txt +++ b/py-interface/CMakeLists.txt @@ -1,6 +1,5 @@ # Generate py-interface and package targets -set(CMAKE_VERBOSE_MAKEFILE on) # CLANG installed must be 16.0 or above # CLANG is only needed for generating new amdsmi_wrapper.py # this is normally done in a docker container with a controlled clang and python-clang versions diff --git a/rocm_smi/CMakeLists.txt b/rocm_smi/CMakeLists.txt index 07b10ea18c..a7085a17a8 100644 --- a/rocm_smi/CMakeLists.txt +++ b/rocm_smi/CMakeLists.txt @@ -1,31 +1,18 @@ -# -# Minimum version of cmake required -# - message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&") message(" CMake ROCm SMI (Library) ") message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&") -## Verbose output. -set(CMAKE_VERBOSE_MAKEFILE on) - message("") message("Build Configuration:") -# message("-----------BuildType: " ${CMAKE_BUILD_TYPE}) -# message("------------Compiler: " ${CMAKE_CXX_COMPILER}) -# message("-------------Version: " ${CMAKE_CXX_COMPILER_VERSION}) message("--------Proj Src Dir: " ${PROJECT_SOURCE_DIR}) -# message("--------Proj Bld Dir: " ${PROJECT_BINARY_DIR}) -# message("--------Proj Lib Dir: " ${PROJECT_BINARY_DIR}/lib) -# message("--------Proj Exe Dir: " ${PROJECT_BINARY_DIR}/bin) -# message("--------RSMI Lib Dir: " ${RSMI_LIB_DIR}) -# message("--------RSMI Inc Dir: " ${RSMI_INC_DIR}) -# message("") set(ROCM_SMI "rocm_smi") set(ROCM_SMI_COMPONENT "lib${ROCM_SMI}") set(ROCM_SMI_TARGET "${ROCM_SMI}64") +# Used by ESMI +set(SMI_SRC_LIST ${CMN_SRC_LIST}) + ## Include common cmake modules include(utils) @@ -40,8 +27,8 @@ message("Package version: ${PKG_VERSION_STR}") get_version_from_tag("1.0.0.0" ${SO_VERSION_GIT_TAG_PREFIX} GIT) # VERSION_* variables should be set by get_version_from_tag -if ( ${ROCM_PATCH_VERSION} ) - set ( VERSION_PATCH ${ROCM_PATCH_VERSION}) +if(${ROCM_PATCH_VERSION}) + set(VERSION_PATCH ${ROCM_PATCH_VERSION}) set(SO_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") else() set(SO_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}") @@ -53,100 +40,29 @@ set(${ROCM_SMI}_VERSION_BUILD "0") set(${ROCM_SMI}_VERSION_HASH "${PKG_VERSION_HASH}") message("SOVERSION: ${SO_VERSION_STRING}") -# Configure rsmiBindingsInit.py.in with SO major version: -# configure_file( -# "${COMMON_SRC_ROOT}/python_smi_tools/rsmiBindingsInit.py.in" -# "${COMMON_SRC_ROOT}/python_smi_tools/rsmiBindingsInit.py") - # Create a configure file to get version info from within library configure_file("src/${ROCM_SMI_TARGET}Config.in" "${CMAKE_CURRENT_SOURCE_DIR}/include/rocm_smi/${ROCM_SMI_TARGET}Config.h") -set(RSMI_SRC_DIR "src") -set(RSMI_INC_DIR "include") -set(RSMI_DOCS_DIR "docs") - -# Add any rocm_smi_lib specific source files here -set(SMI_SRC_LIST ${CMN_SRC_LIST}) - -# Add any rocm_smi_lib specific headers here -set(SMI_INC_LIST "") - -set(SMI_EXAMPLE_EXE "rocm_smi_ex") - -# add_executable(${SMI_EXAMPLE_EXE} "example/rocm_smi_example.cc") -# target_link_libraries(${SMI_EXAMPLE_EXE} ${ROCM_SMI_TARGET}) -add_library(${ROCM_SMI_TARGET} ${CMN_SRC_LIST} ${CMN_INC_LIST}) +add_library(${ROCM_SMI_TARGET} ${CMN_SRC_LIST} ${CMN_INC_LIST}) target_link_libraries(${ROCM_SMI_TARGET} PRIVATE pthread rt dl) -target_include_directories(${ROCM_SMI_TARGET} PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/common/shared_mutex) +target_include_directories(${ROCM_SMI_TARGET} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/common/shared_mutex) # use the target_include_directories() command to specify the include directories for the target -target_include_directories(${ROCM_SMI_TARGET} - PUBLIC - "$" - "$" -) - -if(FILE_REORG_BACKWARD_COMPATIBILITY) - target_include_directories(${ROCM_SMI_TARGET} - PUBLIC - "$") -endif() +target_include_directories(${ROCM_SMI_TARGET} PUBLIC "$" + "$") ## Set the VERSION and SOVERSION values -set_property(TARGET ${ROCM_SMI_TARGET} PROPERTY - SOVERSION "${VERSION_MAJOR}") -set_property(TARGET ${ROCM_SMI_TARGET} PROPERTY - VERSION "${SO_VERSION_STRING}") +set_property(TARGET ${ROCM_SMI_TARGET} PROPERTY SOVERSION "${VERSION_MAJOR}") +set_property(TARGET ${ROCM_SMI_TARGET} PROPERTY VERSION "${SO_VERSION_STRING}") ## If the library is a release, strip the target library -if ("${CMAKE_BUILD_TYPE}" STREQUAL Release) - if(${BUILD_SHARED_LIBS}) #stripping only for .so - add_custom_command( - TARGET ${ROCM_SMI_TARGET} - POST_BUILD COMMAND ${CMAKE_STRIP} lib${ROCM_SMI_TARGET}.so.${SO_VERSION_STRING}) - endif() -endif () - -#file reorganization changes -#rocm_smi.py moved to libexec/rocm_smi. so creating rocm-smi symlink -# file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) -# add_custom_target(link-rocm-smi ALL -# WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -# COMMAND ${CMAKE_COMMAND} -E create_symlink -# ../${CMAKE_INSTALL_LIBEXECDIR}/${ROCM_SMI}/rocm_smi.py ${CMAKE_CURRENT_BINARY_DIR}/bin/rocm-smi) - -## Add the install directives for the runtime library. -# install(TARGETS ${ROCM_SMI_TARGET} -# EXPORT rocm_smiTargets -# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT dev -# ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT dev) -# install(TARGETS ${ROCM_SMI_TARGET} -# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -# COMPONENT asan) - -# install(FILES ${COMMON_SRC_ROOT}/include/rocm_smi/rocm_smi.h -# DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rocm_smi -# COMPONENT dev) -# install(FILES ${COMMON_SRC_ROOT}/include/rocm_smi/${ROCM_SMI_TARGET}Config.h -# DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rocm_smi -# COMPONENT dev) -# install(FILES ${COMMON_SRC_ROOT}/include/rocm_smi/kfd_ioctl.h -# DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rocm_smi -# COMPONENT dev) -# install(PROGRAMS ${COMMON_SRC_ROOT}/python_smi_tools/rsmiBindingsInit.py -# DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/${ROCM_SMI} -# COMPONENT dev) -# install(PROGRAMS ${COMMON_SRC_ROOT}/python_smi_tools/rsmiBindings.py -# DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/${ROCM_SMI} -# COMPONENT dev) -# install(PROGRAMS ${COMMON_SRC_ROOT}/python_smi_tools/rocm_smi.py -# DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/${ROCM_SMI} -# COMPONENT dev) -# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/bin/rocm-smi -# DESTINATION ${CMAKE_INSTALL_BINDIR} -# COMPONENT dev) -message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&") -message(" CMake ROCm SMI (Library) END ") -message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&") +if("${CMAKE_BUILD_TYPE}" STREQUAL Release) + if(${BUILD_SHARED_LIBS}) #stripping only for .so + add_custom_command( + TARGET ${ROCM_SMI_TARGET} + POST_BUILD + COMMAND ${CMAKE_STRIP} lib${ROCM_SMI_TARGET}.so.${SO_VERSION_STRING}) + endif() +endif() diff --git a/rust-interface/CMakeLists.txt b/rust-interface/CMakeLists.txt index 6c13acba54..3e87612c09 100644 --- a/rust-interface/CMakeLists.txt +++ b/rust-interface/CMakeLists.txt @@ -1,5 +1,4 @@ # Generate rust-wrapper and package targets -set(CMAKE_VERBOSE_MAKEFILE on) # This string is the installation directory containing all rust files set(RUST_WRAPPER_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/rust-wrapper" CACHE STRING "Rust wrapper installation directory") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c6f14f05f6..e54a54338d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,3 @@ -# -# Minimum version of cmake required -# -set(CMAKE_VERBOSE_MAKEFILE on) message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&") message(" CMake AMD SMI C/C++ Library ") message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&") diff --git a/tests/amd_smi_test/CMakeLists.txt b/tests/amd_smi_test/CMakeLists.txt index 5f3e9f04c5..99e22e8a16 100644 --- a/tests/amd_smi_test/CMakeLists.txt +++ b/tests/amd_smi_test/CMakeLists.txt @@ -1,4 +1,3 @@ -set(CMAKE_VERBOSE_MAKEFILE on) # Required Defines first: option(INSTALL_GTEST "Install GTest (only useful if GTest is not already installed)" OFF) diff --git a/tests/python_unittest/CMakeLists.txt b/tests/python_unittest/CMakeLists.txt index 9dcedabcd8..3669d2bddf 100644 --- a/tests/python_unittest/CMakeLists.txt +++ b/tests/python_unittest/CMakeLists.txt @@ -25,4 +25,4 @@ install( PATTERN "*.py" ) -# message(FATAL_ERROR "python lib stop") \ No newline at end of file +# message(FATAL_ERROR "python lib stop")