CMakeLists.txt 1.93 KB
Newer Older
Robert Kimball's avatar
Robert Kimball committed
1 2 3 4 5 6 7 8 9 10 11 12 13
# Copyright 2017 Nervana Systems Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

#     http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

14 15
include_directories(
    SYSTEM
16 17 18
    ${GTEST_INCLUDE_DIR}
    ${EIGEN_INCLUDE_DIR}
    )
Robert Kimball's avatar
Robert Kimball committed
19

20 21
include_directories(
    ${NGRAPH_INCLUDE_DIR}
22
    )
Robert Kimball's avatar
Robert Kimball committed
23 24

set (SRC
25
    build_graph.cpp
26
    eigen.cpp
Robert Kimball's avatar
Robert Kimball committed
27
    element_type.cpp
Scott Cyphers's avatar
Scott Cyphers committed
28
    execute.cpp
29
    input_output_assign.cpp
Bob Kimball's avatar
Bob Kimball committed
30 31
    main.cpp
    op.cpp
32
    pass_liveness.cpp
Bob Kimball's avatar
Bob Kimball committed
33
    pass_manager.cpp
34
    pass_memory_layout.cpp
35
    shape.cpp
36
    tensor.cpp
Bob Kimball's avatar
Bob Kimball committed
37
    test_tools.cpp
38
    topological_sort.cpp
39
    type_prop.cpp
40 41
    util.cpp
    uuid.cpp
Robert Kimball's avatar
Robert Kimball committed
42 43
)

44
if(MKLDNN_INCLUDE_DIR)
45
    include_directories(SYSTEM ${MKLDNN_INCLUDE_DIR})
46 47 48 49
    link_directories(${MKLDNN_LIB_DIR})
    set(SRC ${SRC} mkldnn.cpp)
endif()

50
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
Robert Kimball's avatar
Robert Kimball committed
51 52
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCURDIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}\\\"")

53
add_executable(unit-test ${SRC})
54

55 56 57 58 59
if(MKLDNN_INCLUDE_DIR)
    target_link_libraries(unit-test mkldnn)
    add_dependencies(unit-test ext_mkldnn)
endif()

60
target_link_libraries(unit-test ngraph libgtest pthread)
61 62
target_link_libraries(unit-test ${CMAKE_DL_LIBS})

63
add_dependencies(unit-test ngraph libgtest eigen)
64

65 66 67 68 69
add_custom_target(style-check
        COMMAND ${PROJECT_SOURCE_DIR}/maint/check-code-format.sh
        )

add_custom_target(unit-test-check
Bob Kimball's avatar
Bob Kimball committed
70
	COMMAND ${PROJECT_BINARY_DIR}/test/unit-test \${ARGS}
71 72 73 74 75 76 77 78 79
	DEPENDS unit-test
        )

add_custom_target(check
        DEPENDS
        style-check
        unit-test-check
        )