CMakeLists.txt 1.41 KB
Newer Older
Paul's avatar
Paul committed
1

Paul's avatar
Paul committed
2
add_library(migraphx_cpu
3
4
5
6
7
8
9
10
11
12
13
    allocation_model.cpp
    allocate.cpp
    add.cpp
    contiguous.cpp
    concat.cpp
    convolution.cpp
    copy.cpp
    mul.cpp
    pooling.cpp
    relu.cpp
    gemm.cpp
Shucai Xiao's avatar
Shucai Xiao committed
14
15
    target.cpp
    lowering.cpp
16
    migemm.cpp
Paul's avatar
Paul committed
17
)
Paul's avatar
Paul committed
18
set_target_properties(migraphx_cpu PROPERTIES EXPORT_NAME cpu)
Paul's avatar
Paul committed
19
rocm_set_soversion(migraphx_cpu ${MIGRAPHX_SO_VERSION})
Paul's avatar
Paul committed
20

Paul's avatar
Paul committed
21
find_path(BLAZE_INCLUDE blaze/Blaze.h)
Paul's avatar
Paul committed
22
find_package(Threads)
23
find_package(dnnl REQUIRED)
Paul's avatar
Paul committed
24

Paul's avatar
Paul committed
25
rocm_clang_tidy_check(migraphx_cpu)
26
target_link_libraries(migraphx_cpu PRIVATE migraphx Threads::Threads)
Paul's avatar
Paul committed
27
28
target_include_directories(migraphx_cpu PRIVATE ${BLAZE_INCLUDE})
target_compile_definitions(migraphx_cpu PRIVATE -DBLAZE_USE_CPP_THREADS)
29
30
31
32
33
34
35
36
37
38
39
40
41
if(dnnl_FOUND)
target_link_libraries(migraphx_cpu PRIVATE DNNL::dnnl)
target_compile_definitions(migraphx_cpu PRIVATE -DUSE_DNNL)
find_package(OpenMP)
target_link_libraries(migraphx_cpu PUBLIC OpenMP::OpenMP_CXX)
# Add library path to rpath to workaround issues with our broken packages
foreach(LIBRARY ${OpenMP_CXX_LIBRARIES})
    if(LIBRARY MATCHES "libomp")
        get_filename_component(LIBRARY_PATH "${LIBRARY}" PATH)
        target_link_libraries(migraphx_cpu PUBLIC -Wl,-rpath=${LIBRARY_PATH} -Wl,-rpath-link=${LIBRARY_PATH})
    endif()
endforeach()
endif()
mei-ye's avatar
mei-ye committed
42

43
44
target_link_libraries(migraphx_all_targets INTERFACE migraphx_cpu)

Paul's avatar
Paul committed
45
rocm_install_targets(
Paul's avatar
Paul committed
46
  TARGETS migraphx_cpu
Paul's avatar
Paul committed
47
48
49
  INCLUDE
    ${CMAKE_CURRENT_SOURCE_DIR}/include
)
mei-ye's avatar
mei-ye committed
50