CMakeLists.txt 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. cmake_minimum_required(VERSION 3.4.1)
  2. message( STATUS "A CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
  3. set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Werror" )
  4. set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -Os -fPIC" )
  5. set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti" )
  6. set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGOOGLE_PROTOBUF_NO_RTTI -DHAVE_PTHREAD")
  7. set(ANDROID_GTEST_DIR "../../../external/googletest")
  8. add_subdirectory("${ANDROID_GTEST_DIR}/googletest"
  9. googletest-build
  10. )
  11. include("../../src/protobuf/protobuf.cmake")
  12. # Save the generation dir as it gets overwritten when we add_subdirectory tuningfork
  13. set(PGENS_DIR "${PROTO_GENS_DIR}")
  14. protobuf_generate_full_cpp( ${CMAKE_CURRENT_SOURCE_DIR}/proto
  15. proto/tuningfork.proto
  16. proto/tuningfork_clearcut_log.proto
  17. proto/dev_tuningfork.proto
  18. )
  19. message( STATUS "B CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
  20. add_subdirectory("../../src/tuningfork"
  21. tuningfork-build
  22. )
  23. include_directories(
  24. "${ANDROID_GTEST_DIR}/googletest/include"
  25. ../../src
  26. ../../src/common
  27. ../../include
  28. ../../../external/nanopb-c
  29. ${PGENS_DIR}
  30. ${PROTOBUF_SRC_DIR}
  31. ${PROTOBUF_SRC_DIR}/..
  32. )
  33. add_executable(tuningfork_test
  34. main.cpp
  35. histogram_test.cpp
  36. tuningfork_test.cpp
  37. annotation_test.cpp
  38. ${PGENS_DIR}/full/dev_tuningfork.pb.cc
  39. ${PGENS_DIR}/full/tuningfork.pb.cc
  40. ${PGENS_DIR}/full/tuningfork_clearcut_log.pb.cc
  41. )
  42. add_library( protobuf-static
  43. STATIC ${PROTOBUF_LITE_SRCS} ${PROTOBUF_SRCS}
  44. )
  45. target_compile_options(protobuf-static PUBLIC "-Wno-tautological-constant-compare" "-Wno-enum-compare-switch")
  46. target_link_libraries(tuningfork_test
  47. gtest
  48. tuningfork_static
  49. protobuf-static
  50. log
  51. )