12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- PROJECT ( YUV C CXX )
- CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
- OPTION( BUILD_TEST "Built unit tests" OFF )
- SET ( ly_base_dir ${PROJECT_SOURCE_DIR} )
- SET ( ly_src_dir ${ly_base_dir}/source )
- SET ( ly_inc_dir ${ly_base_dir}/include )
- SET ( ly_tst_dir ${ly_base_dir}/unit_test )
- SET ( ly_lib_name yuv )
- SET ( ly_lib_static ${ly_lib_name} )
- FILE ( GLOB_RECURSE ly_source_files ${ly_src_dir}/*.cc )
- LIST ( SORT ly_source_files )
- FILE ( GLOB_RECURSE ly_unittest_sources ${ly_tst_dir}/*.cc )
- LIST ( SORT ly_unittest_sources )
- INCLUDE_DIRECTORIES( BEFORE ${ly_inc_dir} )
- ADD_LIBRARY ( ${ly_lib_static} STATIC ${ly_source_files} )
- if(BUILD_TEST)
- find_library(GTEST_LIBRARY gtest)
- if(GTEST_LIBRARY STREQUAL "GTEST_LIBRARY-NOTFOUND")
- set(GTEST_SRC_DIR /usr/src/gtest CACHE STRING "Location of gtest sources")
- if(EXISTS ${GTEST_SRC_DIR}/src/gtest-all.cc)
- message(STATUS "building gtest from sources in ${GTEST_SRC_DIR}")
- set(gtest_sources ${GTEST_SRC_DIR}/src/gtest-all.cc)
- add_library(gtest STATIC ${gtest_sources})
- include_directories(${GTEST_SRC_DIR})
- include_directories(${GTEST_SRC_DIR}/include)
- set(GTEST_LIBRARY gtest)
- else()
- message(FATAL_ERROR "TEST is set but unable to find gtest library")
- endif()
- endif()
- add_executable(libyuv_unittest ${ly_unittest_sources})
- target_link_libraries(libyuv_unittest ${ly_lib_name} ${GTEST_LIBRARY})
- find_library(PTHREAD_LIBRARY pthread)
- if(NOT PTHREAD_LIBRARY STREQUAL "PTHREAD_LIBRARY-NOTFOUND")
- target_link_libraries(libyuv_unittest pthread)
- endif()
- if (JPEG_FOUND)
- target_link_libraries(libyuv_unittest ${JPEG_LIBRARY})
- endif()
- if(NACL AND NACL_LIBC STREQUAL "newlib")
- target_link_libraries(libyuv_unittest glibc-compat)
- endif()
- find_library(GFLAGS_LIBRARY gflags)
- if(NOT GFLAGS_LIBRARY STREQUAL "GFLAGS_LIBRARY-NOTFOUND")
- target_link_libraries(libyuv_unittest gflags)
- add_definitions(-DLIBYUV_USE_GFLAGS)
- endif()
- endif()
|