From cd0a4aa59c3550ceb9c5f68ad8d2e7c0038f7af8 Mon Sep 17 00:00:00 2001 From: Paul Fultz II Date: Wed, 23 Feb 2022 21:09:51 -0600 Subject: [PATCH] Some cmake fixes and updates (#1088) Make doc/CMakeLists.txt standalone Switch to use rocm-cmake modules for document generation Add CONFIGURE_DEPENDS to file(GLOB) so it will update without an explicit cmake run Add STRINGS property for build type to make it easier to switch build types with ccmake Various fixes and improvements --- CMakeLists.txt | 22 +- cmake/DoxygenDoc.cmake | 359 --------------------------------- cmake/MainDoc.cmake | 37 ---- cmake/SphinxDoc.cmake | 90 --------- dev-requirements.txt | 2 +- doc/CMakeLists.txt | 13 +- src/CMakeLists.txt | 4 +- src/onnx/CMakeLists.txt | 2 +- src/targets/gpu/CMakeLists.txt | 2 +- src/targets/ref/CMakeLists.txt | 2 - src/tf/CMakeLists.txt | 2 +- test/CMakeLists.txt | 8 +- test/verify/CMakeLists.txt | 2 +- 13 files changed, 31 insertions(+), 514 deletions(-) delete mode 100644 cmake/DoxygenDoc.cmake delete mode 100644 cmake/MainDoc.cmake delete mode 100644 cmake/SphinxDoc.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 20aec6d3879..1b80754cca8 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,12 @@ if( NOT MSVC_IDE AND NOT CMAKE_BUILD_TYPE ) set( CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." ) endif() +# Setup valid strings for build type +if (NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo;MinSizeRel" CACHE STRING "Configs") +endif() +set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES}) + # Default installation path if(WIN32) set(CMAKE_INSTALL_PREFIX "/opt/rocm/x86_64-w64-mingw32" CACHE PATH "") @@ -41,16 +47,10 @@ set(MIGRAPHX_SO_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}) option( BUILD_SHARED_LIBS "Build as a shared library" ON ) -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.4") - message(FATAL_ERROR "MIGraph requires at least gcc 5.4") - endif() -endif() - include(CheckCXXCompilerFlag) check_cxx_compiler_flag("--cuda-host-only -x hip" HAS_HIP) if(HAS_HIP) - message(STATUS "Enable miopen backend") + message(STATUS "Enable gpu backend") set(MIGRAPHX_ENABLE_GPU On CACHE BOOL "") else() set(MIGRAPHX_ENABLE_GPU Off CACHE BOOL "") @@ -60,10 +60,12 @@ endif() set(MIGRAPHX_ENABLE_CPU Off CACHE BOOL "") set(CMAKE_CXX_STANDARD_DEFAULT "") -if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-std=c++17) +add_compile_options(-std=c++17) + +if(${CMAKE_VERSION} VERSION_LESS "3.12.0") + set(CONFIGURE_DEPENDS) else() - add_compile_options(-std=c++14) + set(CONFIGURE_DEPENDS CONFIGURE_DEPENDS) endif() list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) diff --git a/cmake/DoxygenDoc.cmake b/cmake/DoxygenDoc.cmake deleted file mode 100644 index 86bae05cb82..00000000000 --- a/cmake/DoxygenDoc.cmake +++ /dev/null @@ -1,359 +0,0 @@ -################################################################################ -# -# MIT License -# -# Copyright (c) 2017 Advanced Micro Devices, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -# -################################################################################ -include(CMakeParseArguments) -include(MainDoc) - -find_program(DOXYGEN_EXECUTABLE NAMES doxygen - PATH_SUFFIXES bin - DOC "Doxygen documentation generator" -) -mark_as_advanced(DOXYGEN_EXECUTABLE) - -find_path(DOT_EXECUTABLE NAMES dot - PATH_SUFFIXES bin - DOC "Graphviz" -) -mark_as_advanced(DOT_EXECUTABLE) - -set(DOXYGEN_ARGS -ABBREVIATE_BRIEF -ALIASES -ALLEXTERNALS -ALLOW_UNICODE_NAMES -ALPHABETICAL_INDEX -ALWAYS_DETAILED_SEC -AUTOLINK_SUPPORT -BINARY_TOC -BRIEF_MEMBER_DESC -BUILTIN_STL_SUPPORT -CALLER_GRAPH -CALL_GRAPH -CASE_SENSE_NAMES -CHM_FILE -CHM_INDEX_ENCODING -CITE_BIB_FILES -CLANG_ASSISTED_PARSING -CLANG_OPTIONS -CLASS_DIAGRAMS -CLASS_GRAPH -COLLABORATION_GRAPH -COLS_IN_ALPHA_INDEX -COMPACT_LATEX -COMPACT_RTF -CPP_CLI_SUPPORT -CREATE_SUBDIRS -DIAFILE_DIRS -DIA_PATH -DIRECTORY_GRAPH -DISABLE_INDEX -DISTRIBUTE_GROUP_DOC -DOCBOOK_OUTPUT -DOCBOOK_PROGRAMLISTING -DOCSET_BUNDLE_ID -DOCSET_FEEDNAME -DOCSET_PUBLISHER_ID -DOCSET_PUBLISHER_NAME -DOTFILE_DIRS -DOT_CLEANUP -DOT_FONTNAME -DOT_FONTPATH -DOT_FONTSIZE -DOT_GRAPH_MAX_NODES -DOT_IMAGE_FORMAT -DOT_MULTI_TARGETS -DOT_NUM_THREADS -# DOT_PATH -DOT_TRANSPARENT -DOXYFILE_ENCODING -ECLIPSE_DOC_ID -ENABLED_SECTIONS -ENABLE_PREPROCESSING -ENUM_VALUES_PER_LINE -EXAMPLE_PATH -EXAMPLE_PATTERNS -EXAMPLE_RECURSIVE -EXCLUDE -EXCLUDE_PATTERNS -EXCLUDE_SYMBOLS -EXCLUDE_SYMLINKS -EXPAND_AS_DEFINED -EXPAND_ONLY_PREDEF -EXTENSION_MAPPING -EXTERNAL_GROUPS -EXTERNAL_PAGES -EXTERNAL_SEARCH -EXTERNAL_SEARCH_ID -EXTRACT_ALL -EXTRACT_ANON_NSPACES -EXTRACT_LOCAL_CLASSES -EXTRACT_LOCAL_METHODS -EXTRACT_PACKAGE -EXTRACT_PRIVATE -EXTRACT_STATIC -EXTRA_PACKAGES -EXTRA_SEARCH_MAPPINGS -EXT_LINKS_IN_WINDOW -FILE_PATTERNS -FILE_VERSION_FILTER -FILTER_PATTERNS -FILTER_SOURCE_FILES -FILTER_SOURCE_PATTERNS -FORCE_LOCAL_INCLUDES -FORMULA_FONTSIZE -FORMULA_TRANSPARENT -FULL_PATH_NAMES -GENERATE_AUTOGEN_DEF -GENERATE_BUGLIST -GENERATE_CHI -GENERATE_DEPRECATEDLIST -GENERATE_DOCBOOK -GENERATE_DOCSET -GENERATE_ECLIPSEHELP -GENERATE_HTML -GENERATE_HTMLHELP -GENERATE_LATEX -GENERATE_LEGEND -GENERATE_MAN -GENERATE_PERLMOD -GENERATE_QHP -GENERATE_RTF -GENERATE_TAGFILE -GENERATE_TESTLIST -GENERATE_TODOLIST -GENERATE_TREEVIEW -GENERATE_XML -GRAPHICAL_HIERARCHY -GROUP_GRAPHS -GROUP_NESTED_COMPOUNDS -# HAVE_DOT -HHC_LOCATION -HIDE_COMPOUND_REFERENCE -HIDE_FRIEND_COMPOUNDS -HIDE_IN_BODY_DOCS -HIDE_SCOPE_NAMES -HIDE_UNDOC_CLASSES -HIDE_UNDOC_MEMBERS -HIDE_UNDOC_RELATIONS -HTML_COLORSTYLE_GAMMA -HTML_COLORSTYLE_HUE -HTML_COLORSTYLE_SAT -HTML_DYNAMIC_SECTIONS -HTML_EXTRA_FILES -HTML_EXTRA_STYLESHEET -HTML_FILE_EXTENSION -HTML_FOOTER -HTML_HEADER -HTML_INDEX_NUM_ENTRIES -HTML_OUTPUT -HTML_STYLESHEET -HTML_TIMESTAMP -IDL_PROPERTY_SUPPORT -IGNORE_PREFIX -IMAGE_PATH -INCLUDED_BY_GRAPH -INCLUDE_FILE_PATTERNS -INCLUDE_GRAPH -INCLUDE_PATH -INHERIT_DOCS -INLINE_GROUPED_CLASSES -INLINE_INFO -INLINE_INHERITED_MEMB -INLINE_SIMPLE_STRUCTS -INLINE_SOURCES -INPUT -INPUT_ENCODING -INPUT_FILTER -INTERACTIVE_SVG -INTERNAL_DOCS -JAVADOC_AUTOBRIEF -LATEX_BATCHMODE -LATEX_BIB_STYLE -LATEX_CMD_NAME -LATEX_EXTRA_FILES -LATEX_EXTRA_STYLESHEET -LATEX_FOOTER -LATEX_HEADER -LATEX_HIDE_INDICES -LATEX_OUTPUT -LATEX_SOURCE_CODE -LATEX_TIMESTAMP -LAYOUT_FILE -LOOKUP_CACHE_SIZE -MACRO_EXPANSION -MAKEINDEX_CMD_NAME -MAN_EXTENSION -MAN_LINKS -MAN_OUTPUT -MAN_SUBDIR -MARKDOWN_SUPPORT -MATHJAX_CODEFILE -MATHJAX_EXTENSIONS -MATHJAX_FORMAT -MATHJAX_RELPATH -MAX_DOT_GRAPH_DEPTH -MAX_INITIALIZER_LINES -MSCFILE_DIRS -MSCGEN_PATH -MULTILINE_CPP_IS_BRIEF -OPTIMIZE_FOR_FORTRAN -OPTIMIZE_OUTPUT_FOR_C -OPTIMIZE_OUTPUT_JAVA -OPTIMIZE_OUTPUT_VHDL -OUTPUT_DIRECTORY -OUTPUT_LANGUAGE -PAPER_TYPE -PDF_HYPERLINKS -PERLMOD_LATEX -PERLMOD_MAKEVAR_PREFIX -PERLMOD_PRETTY -PERL_PATH -PLANTUML_CFG_FILE -PLANTUML_INCLUDE_PATH -PLANTUML_JAR_PATH -PREDEFINED -PROJECT_BRIEF -PROJECT_LOGO -PROJECT_NAME -PROJECT_NUMBER -QCH_FILE -QHG_LOCATION -QHP_CUST_FILTER_ATTRS -QHP_CUST_FILTER_NAME -QHP_NAMESPACE -QHP_SECT_FILTER_ATTRS -QHP_VIRTUAL_FOLDER -QT_AUTOBRIEF -QUIET -RECURSIVE -REFERENCED_BY_RELATION -REFERENCES_LINK_SOURCE -REFERENCES_RELATION -REPEAT_BRIEF -RTF_EXTENSIONS_FILE -RTF_HYPERLINKS -RTF_OUTPUT -RTF_SOURCE_CODE -RTF_STYLESHEET_FILE -SEARCHDATA_FILE -SEARCHENGINE -SEARCHENGINE_URL -SEARCH_INCLUDES -SEPARATE_MEMBER_PAGES -SERVER_BASED_SEARCH -SHORT_NAMES -SHOW_FILES -SHOW_GROUPED_MEMB_INC -SHOW_INCLUDE_FILES -SHOW_NAMESPACES -SHOW_USED_FILES -SIP_SUPPORT -SKIP_FUNCTION_MACROS -SORT_BRIEF_DOCS -SORT_BY_SCOPE_NAME -SORT_GROUP_NAMES -SORT_MEMBERS_CTORS_1ST -SORT_MEMBER_DOCS -SOURCE_BROWSER -SOURCE_TOOLTIPS -STRICT_PROTO_MATCHING -STRIP_CODE_COMMENTS -STRIP_FROM_INC_PATH -STRIP_FROM_PATH -SUBGROUPING -TAB_SIZE -TAGFILES -TCL_SUBST -TEMPLATE_RELATIONS -TOC_EXPAND -TOC_INCLUDE_HEADINGS -TREEVIEW_WIDTH -TYPEDEF_HIDES_STRUCT -UML_LIMIT_NUM_FIELDS -UML_LOOK -USE_HTAGS -USE_MATHJAX -USE_MDFILE_AS_MAINPAGE -USE_PDFLATEX -VERBATIM_HEADERS -WARNINGS -WARN_AS_ERROR -WARN_FORMAT -WARN_IF_DOC_ERROR -WARN_IF_UNDOCUMENTED -WARN_LOGFILE -WARN_NO_PARAMDOC -XML_OUTPUT -XML_PROGRAMLISTING -) - -set(DOXYGEN_CONFIG_FILE "${CMAKE_CURRENT_BINARY_DIR}/doxygen/doxygen.conf" CACHE PATH "Path to generated doxygen configuration file") - -function(add_doxygen_doc) - set(options) - set(oneValueArgs) - set(multiValueArgs DEPENDS ${DOXYGEN_ARGS}) - - cmake_parse_arguments(PARSE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - file(WRITE ${DOXYGEN_CONFIG_FILE} "# Auto-generated doxygen configuration file\n") - - if(NOT PARSE_STRIP_FROM_PATH) - set(PARSE_STRIP_FROM_PATH ${CMAKE_SOURCE_DIR}) - endif() - - foreach(ARG ${DOXYGEN_ARGS}) - if(PARSE_${ARG}) - string(REPLACE ";" " " ARG_VALUE "${PARSE_${ARG}}") - file(APPEND ${DOXYGEN_CONFIG_FILE} "\n${ARG} = ${ARG_VALUE}\n") - endif() - endforeach() - - if(PARSE_OUTPUT_DIRECTORY) - if(NOT EXISTS ${PARSE_OUTPUT_DIRECTORY}) - file(MAKE_DIRECTORY ${PARSE_OUTPUT_DIRECTORY}) - endif() - endif() - - if(DOT_EXECUTABLE) - file(APPEND ${DOXYGEN_CONFIG_FILE} "\nDOT_PATH = \"${DOT_EXECUTABLE}\"\n") - file(APPEND ${DOXYGEN_CONFIG_FILE} "\nHAVE_DOT = YES\n") - else() - file(APPEND ${DOXYGEN_CONFIG_FILE} "\nHAVE_DOT = NO\n") - endif() - - add_custom_target(doxygen - ${DOXYGEN_EXECUTABLE} ${DOXYGEN_CONFIG_FILE} - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMENT "Building documentation with doxygen" - ) - if(PARSE_OUTPUT_DIRECTORY) - clean_doc_output(${PARSE_OUTPUT_DIRECTORY}) - endif() - mark_as_doc(doxygen) - if(PARSE_DEPENDS) - add_dependencies(doxygen ${PARSE_DEPENDS}) - endif() -endfunction() diff --git a/cmake/MainDoc.cmake b/cmake/MainDoc.cmake deleted file mode 100644 index 8a6cbe98b2b..00000000000 --- a/cmake/MainDoc.cmake +++ /dev/null @@ -1,37 +0,0 @@ -################################################################################ -# -# MIT License -# -# Copyright (c) 2017 Advanced Micro Devices, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -# -################################################################################ - -if(NOT TARGET doc) - add_custom_target(doc) -endif() - -function(mark_as_doc) - add_dependencies(doc ${ARGN}) -endfunction() - -function(clean_doc_output DIR) - set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${DIR}) -endfunction() diff --git a/cmake/SphinxDoc.cmake b/cmake/SphinxDoc.cmake deleted file mode 100644 index 11aa533b485..00000000000 --- a/cmake/SphinxDoc.cmake +++ /dev/null @@ -1,90 +0,0 @@ -################################################################################ -# -# MIT License -# -# Copyright (c) 2017 Advanced Micro Devices, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -# -################################################################################ -include(CMakeParseArguments) -include(MainDoc) -include(DoxygenDoc) - -find_program(SPHINX_EXECUTABLE NAMES sphinx-build - HINTS - $ENV{SPHINX_DIR} - PATH_SUFFIXES bin - DOC "Sphinx documentation generator" -) - -mark_as_advanced(SPHINX_EXECUTABLE) - -set(BINARY_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/sphinx/_build") - -# Sphinx cache with pickled ReST documents -set(SPHINX_CACHE_DIR "${CMAKE_CURRENT_BINARY_DIR}/sphinx/_doctrees") - -# HTML output directory -set(SPHINX_DEFAULT_HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/sphinx/html") -function(add_sphinx_doc SRC_DIR) - set(options) - set(oneValueArgs BUILDER OUTPUT_DIR) - set(multiValueArgs DEPENDS VARS TEMPLATE_VARS) - - cmake_parse_arguments(PARSE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - string(TOUPPER ${PARSE_BUILDER} BUILDER) - - set(ADDITIONAL_ARGS) - foreach(VAR ${PARSE_VARS}) - list(APPEND ADDITIONAL_ARGS -D ${VAR}) - endforeach() - foreach(VAR ${PARSE_TEMPLATE_VARS}) - list(APPEND ADDITIONAL_ARGS -A ${VAR}) - endforeach() - - if(PARSE_OUTPUT_DIR) - get_filename_component(OUTPUT_DIR ${PARSE_OUTPUT_DIR} ABSOLUTE) - set(SPHINX_${BUILDER}_DIR ${OUTPUT_DIR} CACHE PATH "Path to ${PARSE_BUILDER} output") - else() - set(SPHINX_${BUILDER}_DIR "${CMAKE_CURRENT_BINARY_DIR}/sphinx/${PARSE_BUILDER}" CACHE PATH "Path to ${PARSE_BUILDER} output") - endif() - - add_custom_target(sphinx-${BUILDER} - ${SPHINX_EXECUTABLE} - -b ${PARSE_BUILDER} - -d "${SPHINX_CACHE_DIR}" - ${ADDITIONAL_ARGS} - "${SRC_DIR}" - "${SPHINX_${BUILDER}_DIR}" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMENT "Building ${PARSE_BUILDER} documentation with Sphinx" - ) - clean_doc_output(${SPHINX_${BUILDER}_DIR}) - clean_doc_output(${SPHINX_CACHE_DIR}) - clean_doc_output(${BINARY_BUILD_DIR}) - mark_as_doc(sphinx-${BUILDER}) - if(PARSE_DEPENDS) - add_dependencies(sphinx-${BUILDER} ${PARSE_DEPENDS}) - endif() - -endfunction() - - diff --git a/dev-requirements.txt b/dev-requirements.txt index 2c972af312c..4d266be2a35 100755 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -3,5 +3,5 @@ facebook/zstd@v1.4.5 -X subdir -DCMAKE_DIR=build/cmake ccache@v4.1 pcre,pfultz2/pcre@8.45 -H sha256:d6f7182602a775a7d500a0cedca6449af0400c6493951513046d17615ed0bf11 danmar/cppcheck@2.6 -DHAVE_RULES=1 -RadeonOpenCompute/rocm-cmake@ececd2eccae4d01e7ec154efe90ac43ebf4df317 --build +RadeonOpenCompute/rocm-cmake@1ebf7e7bc61bb5e949c171562b421264065230a7 --build -f requirements.txt diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index d4d3ab777b2..7f19dee7568 100755 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,8 +1,11 @@ -include(DoxygenDoc) +project(migraphx-doc) +find_package(ROCM REQUIRED) + +include(ROCMDoxygenDoc) set(DOXYGEN_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/doxygen/) -add_doxygen_doc( +rocm_add_doxygen_doc( OUTPUT_DIRECTORY ${DOXYGEN_OUTPUT} INPUT ${PROJECT_SOURCE_DIR}/src @@ -39,8 +42,8 @@ add_doxygen_doc( PREDEFINED DOXYGEN ) -include(SphinxDoc) -add_sphinx_doc(src +include(ROCMSphinxDoc) +rocm_add_sphinx_doc(src BUILDER html OUTPUT_DIR html VARS @@ -51,7 +54,7 @@ add_sphinx_doc(src find_package(LATEX) if(LATEX_FOUND) - add_sphinx_doc(src + rocm_add_sphinx_doc(src BUILDER latex OUTPUT_DIR pdf VARS diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0b948171764..0e83e57bae4 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -211,7 +211,6 @@ target_link_libraries(migraphx PRIVATE msgpackc-cxx) target_link_libraries(migraphx INTERFACE $) add_library(migraphx_all_targets INTERFACE) -target_link_libraries(migraphx_all_targets INTERFACE migraphx_ref) set(PACKAGE_DEPENDS) @@ -222,6 +221,7 @@ add_subdirectory(tf) add_subdirectory(py) add_subdirectory(targets/ref) +target_link_libraries(migraphx_all_targets INTERFACE migraphx_ref) if(MIGRAPHX_ENABLE_CPU) add_subdirectory(targets/cpu) target_link_libraries(migraphx_all_targets INTERFACE migraphx_cpu) @@ -239,7 +239,7 @@ if(HAVE_HALF_EXPR) endif() rocm_export_targets( - TARGETS migraphx::migraphx migraphx_all_targets + TARGETS migraphx::migraphx_c NAMESPACE migraphx:: DEPENDS Threads diff --git a/src/onnx/CMakeLists.txt b/src/onnx/CMakeLists.txt index 900af6ffda7..e73f0eeac9b 100755 --- a/src/onnx/CMakeLists.txt +++ b/src/onnx/CMakeLists.txt @@ -7,7 +7,7 @@ target_compile_options(onnx-proto PRIVATE -w) target_link_libraries(onnx-proto PRIVATE ${PROTOBUF_LIBRARY}) set_target_properties(onnx-proto PROPERTIES POSITION_INDEPENDENT_CODE On) -file(GLOB ONNX_SRCS *.cpp) +file(GLOB ONNX_SRCS ${CONFIGURE_DEPENDS} *.cpp) add_library(migraphx_onnx ${ONNX_SRCS}) target_include_directories(migraphx_onnx PRIVATE include) set_target_properties(migraphx_onnx PROPERTIES EXPORT_NAME onnx) diff --git a/src/targets/gpu/CMakeLists.txt b/src/targets/gpu/CMakeLists.txt index 89764ef52a1..5324706cfed 100755 --- a/src/targets/gpu/CMakeLists.txt +++ b/src/targets/gpu/CMakeLists.txt @@ -11,7 +11,7 @@ if(NOT TARGET MIOpen) endif() include(Embed) -file(GLOB KERNEL_FILES +file(GLOB KERNEL_FILES ${CONFIGURE_DEPENDS} ${CMAKE_CURRENT_SOURCE_DIR}/kernels/include/migraphx/kernels/*.hpp) message(STATUS "KERNEL_FILES: ${KERNEL_FILES}") add_embed_library(migraphx_kernels ${KERNEL_FILES}) diff --git a/src/targets/ref/CMakeLists.txt b/src/targets/ref/CMakeLists.txt index 85fdee1a6e0..8b59c3a983b 100644 --- a/src/targets/ref/CMakeLists.txt +++ b/src/targets/ref/CMakeLists.txt @@ -15,8 +15,6 @@ target_link_libraries(migraphx_ref migraphx Threads::Threads) target_include_directories(migraphx_ref PRIVATE ${BLAZE_INCLUDE}) target_compile_definitions(migraphx_ref PRIVATE -DBLAZE_USE_CPP_THREADS) -target_link_libraries(migraphx_all_targets INTERFACE migraphx_ref) - rocm_install_targets( TARGETS migraphx_ref INCLUDE diff --git a/src/tf/CMakeLists.txt b/src/tf/CMakeLists.txt index 1c9387e1635..6d8f577dc78 100644 --- a/src/tf/CMakeLists.txt +++ b/src/tf/CMakeLists.txt @@ -19,7 +19,7 @@ target_compile_options(tf-proto PRIVATE -w) target_link_libraries(tf-proto PRIVATE ${PROTOBUF_LIBRARY}) set_target_properties(tf-proto PROPERTIES POSITION_INDEPENDENT_CODE On) -file(GLOB TF_SRCS *.cpp) +file(GLOB TF_SRCS ${CONFIGURE_DEPENDS} *.cpp) add_library(migraphx_tf ${TF_SRCS}) target_include_directories(migraphx_tf PRIVATE include) set_target_properties(migraphx_tf PROPERTIES EXPORT_NAME tf) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 59702852767..526e53e3f7a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -90,7 +90,7 @@ function(add_test_executable TEST_NAME) target_include_directories(${TEST_NAME} PUBLIC include) endfunction(add_test_executable) -file(GLOB TESTS *.cpp) +file(GLOB TESTS ${CONFIGURE_DEPENDS} *.cpp) foreach(TEST ${TESTS}) get_filename_component(BASE_NAME ${TEST} NAME_WE) @@ -100,7 +100,7 @@ endforeach() if(MIGRAPHX_ENABLE_GPU) # gpu tests - file(GLOB GPU_TESTS gpu/*.cpp) + file(GLOB GPU_TESTS ${CONFIGURE_DEPENDS} gpu/*.cpp) foreach(TEST ${GPU_TESTS}) get_filename_component(BASE_NAME ${TEST} NAME_WE) @@ -120,7 +120,7 @@ file (GLOB ONNX_TESTS ${TEST_ONNX_DIR}/*.cpp) foreach(ONNX_TEST ${ONNX_TESTS}) get_filename_component(BASE_NAME ${ONNX_TEST} NAME_WE) set(TEST_NAME test_${BASE_NAME}) - add_executable(${TEST_NAME} ${TES_ONNX_DIR}/${ONNX_TEST}) + add_executable(${TEST_NAME} ${ONNX_TEST}) rocm_clang_tidy_check(${TEST_NAME}) target_link_libraries(${TEST_NAME} migraphx_onnx migraphx_ref) target_include_directories(${TEST_NAME} PUBLIC include) @@ -160,7 +160,7 @@ function(test_header NAME HEADER) endfunction() function(test_headers PREFIX) - file(GLOB HEADERS ${ARGN}) + file(GLOB HEADERS ${CONFIGURE_DEPENDS} ${ARGN}) foreach(HEADER ${HEADERS}) file(RELATIVE_PATH HEADER_REL ${CMAKE_SOURCE_DIR} ${HEADER}) diff --git a/test/verify/CMakeLists.txt b/test/verify/CMakeLists.txt index bba4d98cedd..6b7341fa66d 100644 --- a/test/verify/CMakeLists.txt +++ b/test/verify/CMakeLists.txt @@ -1,5 +1,5 @@ -file(GLOB VERIFY_TESTS *.cpp) +file(GLOB VERIFY_TESTS ${CONFIGURE_DEPENDS} *.cpp) add_executable(test_verify ${VERIFY_TESTS}) add_dependencies(tests test_verify)