1
2#include(${TOP_DIR}/src/CMakeLists.txt)
3
4set(GTEST_DIRS ${THIRD_PARTY_DIR}/gtest)
5set(MOCKCPP_DIR ${THIRD_PARTY_DIR}/mockcpp)
6
7include_directories(
8        ${GTEST_ROOT_DIR}/include
9        ${MOCKCPP_DIR}/include
10)
11
12set(sdl_inc_path ${THIRD_PARTY_DIR}/SDL2.0/include)
13
14if (MINGW)
15set(sdl_lib_path ${THIRD_PARTY_DIR}/SDL2.0/windows/lib/x64)
16set(gtest_lib_path ${GTEST_ROOT_DIR}/mingw64/lib/)
17else()
18    set(sdl_lib_path ${THIRD_PARTY_DIR}/SDL2.0/linux/lib)
19    set(sdl_inc_path ${THIRD_PARTY_DIR}/SDL2.0/linux/include)
20    set(gtest_lib_path ${THIRD_PARTY_DIR}/gtest/linux/lib)
21    set(curl_lib_path ${THIRD_PARTY_DIR}/curl/lib/linux)
22endif()
23
24include_directories(
25        ${sdl_inc_path}
26)
27link_directories(
28        ${sdl_lib_path}
29        ${gtest_lib_path}
30        ${curl_lib_path}
31)
32
33file(GLOB_RECURSE FOUNDATION_SRCS
34        ${TOP_DIR}/src/meta/*.cpp
35        ${TOP_DIR}/../3rdparty/gtest/mingw64/src/gtest/src/hwext/*.cpp
36        ${TOP_DIR}/../3rdparty/gtest/mingw64/src/gtest/src/hwext/*.cc
37        )
38ADD_DEFINITIONS(
39        -DHST_ANY_WITH_NO_RTTI
40        -DMEDIA_NO_OHOS
41)
42#message(STATUS "ut ----------------")
43#message(${FOUNDATION_SRCS})
44#message(STATUS "ut ut ----------------")
45
46file(GLOB NEW_UT_TEST_SRCS ./meta/*.cpp)
47
48set(METATEST_SRCS
49        ${FOUNDATION_SRCS}
50        ${NEW_UT_TEST_SRCS}
51        ${3RDPARTY_SRCS}
52        ../main.cpp
53        )
54
55add_executable(histreamer_new_unittest ${METATEST_SRCS})
56
57link_directories(
58        ${MOCKCPP_DIR}/lib/
59        /usr/local/lib
60)
61
62target_compile_definitions(histreamer_new_unittest PRIVATE NEW_UNIT_TEST)
63
64if (MSVC)
65    target_link_libraries(histreamer_new_unittest
66            ${GTEST_ROOT_DIR}/lib/gtestd.lib
67            ${MOCKCPP_DIR}/lib/mockcpp.lib
68            pthreadVC2.lib
69            )
70elseif (MINGW)
71    set(sdl_path ${THIRD_PARTY_DIR}/SDL2.0/windows)
72    target_link_libraries(histreamer_new_unittest
73            ${sdl_path}/lib/x64/SDL2.lib
74            gtest
75            ${MOCKCPP_DIR}/lib/libmockcpp_mingw8.a
76            )
77    message(STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}")
78    file(GLOB sdl_shared_libraries ${sdl_path}/lib/x64/*.dll)
79    file(COPY ${sdl_shared_libraries} DESTINATION ${CMAKE_BINARY_DIR}/_deps/media_foundation-build/tests/unittest)
80else ()
81    target_link_libraries(media_foundation_unit_test
82            dl
83            m
84            /usr/lib/x86_64-linux-gnu/libz.so.1
85            SDL2-2.0
86            gtest
87            gtest_main
88            pthread
89            ${MOCKCPP_DIR}/lib/libmockcpp.a
90            curl
91            )
92endif ()
93add_test(Test histreamer_new_ut)
94enable_testing()
95