Skip to content

Commit cd0a4aa

Browse files
authored
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
1 parent 98dfdf1 commit cd0a4aa

File tree

13 files changed

+31
-514
lines changed

13 files changed

+31
-514
lines changed

CMakeLists.txt

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ if( NOT MSVC_IDE AND NOT CMAKE_BUILD_TYPE )
1010
set( CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." )
1111
endif()
1212

13+
# Setup valid strings for build type
14+
if (NOT CMAKE_CONFIGURATION_TYPES)
15+
set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo;MinSizeRel" CACHE STRING "Configs")
16+
endif()
17+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES})
18+
1319
# Default installation path
1420
if(WIN32)
1521
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})
4147

4248
option( BUILD_SHARED_LIBS "Build as a shared library" ON )
4349

44-
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
45-
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.4")
46-
message(FATAL_ERROR "MIGraph requires at least gcc 5.4")
47-
endif()
48-
endif()
49-
5050
include(CheckCXXCompilerFlag)
5151
check_cxx_compiler_flag("--cuda-host-only -x hip" HAS_HIP)
5252
if(HAS_HIP)
53-
message(STATUS "Enable miopen backend")
53+
message(STATUS "Enable gpu backend")
5454
set(MIGRAPHX_ENABLE_GPU On CACHE BOOL "")
5555
else()
5656
set(MIGRAPHX_ENABLE_GPU Off CACHE BOOL "")
@@ -60,10 +60,12 @@ endif()
6060
set(MIGRAPHX_ENABLE_CPU Off CACHE BOOL "")
6161

6262
set(CMAKE_CXX_STANDARD_DEFAULT "")
63-
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
64-
add_compile_options(-std=c++17)
63+
add_compile_options(-std=c++17)
64+
65+
if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
66+
set(CONFIGURE_DEPENDS)
6567
else()
66-
add_compile_options(-std=c++14)
68+
set(CONFIGURE_DEPENDS CONFIGURE_DEPENDS)
6769
endif()
6870

6971
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

0 commit comments

Comments
 (0)