|
@@ -34,33 +34,30 @@ elseif(WIN32)
|
|
set(PROTOBUF_INSTALATION_PATH "")
|
|
set(PROTOBUF_INSTALATION_PATH "")
|
|
endif()
|
|
endif()
|
|
|
|
|
|
|
|
+add_subdirectory("src/protobuf")
|
|
|
|
+add_subdirectory("src/grpc")
|
|
|
|
+add_subdirectory("src/generator")
|
|
|
|
+
|
|
if(DEFINED $ENV{MAKE_TESTS})
|
|
if(DEFINED $ENV{MAKE_TESTS})
|
|
set(MAKE_TESTS ${MAKE_TESTS})
|
|
set(MAKE_TESTS ${MAKE_TESTS})
|
|
elseif(NOT DEFINED MAKE_TESTS)
|
|
elseif(NOT DEFINED MAKE_TESTS)
|
|
set(MAKE_TESTS ON)
|
|
set(MAKE_TESTS ON)
|
|
endif()
|
|
endif()
|
|
-
|
|
|
|
-add_subdirectory("src/protobuf")
|
|
|
|
-add_subdirectory("src/grpc")
|
|
|
|
-add_subdirectory("src/generator")
|
|
|
|
-
|
|
|
|
if(MAKE_TESTS)
|
|
if(MAKE_TESTS)
|
|
- set(testgeneration "test_generation")
|
|
|
|
- set(TESTS_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/tests)
|
|
|
|
- file(MAKE_DIRECTORY ${TESTS_OUT_DIR})
|
|
|
|
- file(GLOB PROTO_FILES ABSOLUTE ${CMAKE_CURRENT_SOURCE_DIR}/tests/proto/*.proto)
|
|
|
|
- if(WIN32)
|
|
|
|
- set(Protobuf_PROTOC_EXECUTABLE ${PROTOBUF_INSTALATION_PATH}/bin/protoc.exe)
|
|
|
|
- endif()
|
|
|
|
-
|
|
|
|
- add_custom_target(${testgeneration})
|
|
|
|
- add_custom_command(TARGET ${testgeneration}
|
|
|
|
- COMMAND ${Protobuf_PROTOC_EXECUTABLE} --plugin=protoc-gen-${PROJECT_NAME}=$<TARGET_FILE:${PROJECT_NAME}> --qtprotobuf_out=${TESTS_OUT_DIR} -I=${CMAKE_CURRENT_SOURCE_DIR}/tests/proto/ ${PROTO_FILES}
|
|
|
|
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests/proto/
|
|
|
|
- DEPENDS ${PROJECT_NAME} ${PROTO_FILES}
|
|
|
|
- COMMENT "Generating test headers"
|
|
|
|
|
|
+ find_package(GTest)
|
|
|
|
+ if (UNIX AND NOT GTest_FOUND)
|
|
|
|
+ if (NOT Protobuf_FOUND)
|
|
|
|
+ # if prebuilt found protobuf then functionality to download GTEST is needed
|
|
|
|
+ include(cmake/DownloadProject.cmake)
|
|
|
|
+ endif()
|
|
|
|
+ download_project(PROJ GTest
|
|
|
|
+ GIT_REPOSITORY https://github.com/google/googletest.git
|
|
|
|
+ GIT_TAG v1.8.x
|
|
)
|
|
)
|
|
|
|
+ # uncomment if gmock is going to be needed
|
|
|
|
+ set(BUILD_GMOCK OFF CACHE BOOL "Disable gmock build functionality" FORCE)
|
|
|
|
+ add_subdirectory(${GTest_SOURCE_DIR} ${GTest_BINARY_DIR})
|
|
|
|
+ endif()
|
|
|
|
|
|
- add_dependencies(${testgeneration} ${PROJECT_NAME})
|
|
|
|
add_subdirectory("tests")
|
|
add_subdirectory("tests")
|
|
endif()
|
|
endif()
|