Skip to content

Commit

Permalink
Some cmake fixes and updates (#1088)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
pfultz2 authored Feb 24, 2022
1 parent 98dfdf1 commit cd0a4aa
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 514 deletions.
22 changes: 12 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 "")
Expand Down Expand Up @@ -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 "")
Expand All @@ -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)
Expand Down
Loading

0 comments on commit cd0a4aa

Please sign in to comment.