mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fix tabs in CMakefiles
This commit is contained in:
parent
8b5b15c3d2
commit
4aad1e61d1
@ -6,15 +6,15 @@ project (ApplicationCode)
|
||||
find_package( OpenGL )
|
||||
|
||||
if (RESINSIGHT_BUILD_WITH_QT5)
|
||||
find_package(Qt5 COMPONENTS Core QUIET)
|
||||
find_package(Qt5 COMPONENTS Core QUIET)
|
||||
endif(RESINSIGHT_BUILD_WITH_QT5)
|
||||
|
||||
if (Qt5Core_FOUND)
|
||||
find_package(Qt5 CONFIG REQUIRED Core Gui OpenGL Network Script Widgets)
|
||||
find_package(Qt5 CONFIG REQUIRED Core Gui OpenGL Network Script Widgets)
|
||||
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Network Qt5::OpenGL Qt5::Script Qt5::Widgets)
|
||||
else()
|
||||
set (QT_COMPONENTS_REQUIRED QtCore QtGui QtMain QtOpenGl QtNetwork QtScript)
|
||||
find_package(Qt4 COMPONENTS ${QT_COMPONENTS_REQUIRED} REQUIRED)
|
||||
find_package(Qt4 COMPONENTS ${QT_COMPONENTS_REQUIRED} REQUIRED)
|
||||
include(${QT_USE_FILE})
|
||||
endif(Qt5Core_FOUND)
|
||||
|
||||
@ -47,7 +47,7 @@ include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Commands
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Commands/EclipseCommands
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/FileInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/GrpcInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/GrpcInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/SocketInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Measurement
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization
|
||||
@ -61,7 +61,7 @@ include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Annotations
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Completions
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Flow
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/GridCrossPlots
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/GridCrossPlots
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Measurement
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Summary
|
||||
|
||||
@ -102,9 +102,9 @@ list( APPEND CPP_SOURCES
|
||||
)
|
||||
|
||||
if (RESINSIGHT_ENABLE_GRPC)
|
||||
list( APPEND REFERENCED_CMAKE_FILES
|
||||
GrpcInterface/CMakeLists.cmake
|
||||
)
|
||||
list( APPEND REFERENCED_CMAKE_FILES
|
||||
GrpcInterface/CMakeLists.cmake
|
||||
)
|
||||
endif(RESINSIGHT_ENABLE_GRPC)
|
||||
|
||||
list( APPEND REFERENCED_CMAKE_FILES
|
||||
@ -118,8 +118,8 @@ list( APPEND REFERENCED_CMAKE_FILES
|
||||
FileInterface/CMakeLists_files.cmake
|
||||
|
||||
ProjectDataModel/CMakeLists_files.cmake
|
||||
ProjectDataModel/GridCrossPlots/CMakeLists_files.cmake
|
||||
ProjectDataModel/GridCrossPlots/CellFilters/CMakeLists_files.cmake
|
||||
ProjectDataModel/GridCrossPlots/CMakeLists_files.cmake
|
||||
ProjectDataModel/GridCrossPlots/CellFilters/CMakeLists_files.cmake
|
||||
ProjectDataModel/Summary/CMakeLists_files.cmake
|
||||
ProjectDataModel/Flow/CMakeLists_files.cmake
|
||||
ProjectDataModel/Annotations/CMakeLists_files.cmake
|
||||
@ -145,7 +145,7 @@ list( APPEND REFERENCED_CMAKE_FILES
|
||||
Commands/EclipseCommands/EclipseWell/CMakeLists_files.cmake
|
||||
Commands/ExportCommands/CMakeLists_files.cmake
|
||||
Commands/FlowCommands/CMakeLists_files.cmake
|
||||
Commands/GridCrossPlotCommands/CMakeLists_files.cmake
|
||||
Commands/GridCrossPlotCommands/CMakeLists_files.cmake
|
||||
Commands/HoloLensCommands/CMakeLists_files.cmake
|
||||
Commands/IntersectionBoxCommands/CMakeLists_files.cmake
|
||||
Commands/IntersectionViewCommands/CMakeLists_files.cmake
|
||||
@ -162,7 +162,7 @@ list( APPEND REFERENCED_CMAKE_FILES
|
||||
CommandFileInterface/Core/CMakeLists_files.cmake
|
||||
Commands/FractureCommands/CMakeLists_files.cmake
|
||||
)
|
||||
|
||||
|
||||
option (RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS "Include ApplicationCode Unit Tests" OFF)
|
||||
if (RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS)
|
||||
add_definitions(-DUSE_UNIT_TESTS)
|
||||
@ -254,10 +254,10 @@ set ( QT_MOC_HEADERS
|
||||
)
|
||||
|
||||
if (Qt5Core_FOUND)
|
||||
qt5_wrap_cpp(MOC_SOURCE_FILES ${QT_MOC_HEADERS} )
|
||||
qt5_wrap_cpp(MOC_SOURCE_FILES ${QT_MOC_HEADERS} )
|
||||
qt5_wrap_ui( FORM_FILES_CPP ${QT_UI_FILES} )
|
||||
else()
|
||||
qt4_wrap_cpp(MOC_SOURCE_FILES ${QT_MOC_HEADERS} )
|
||||
qt4_wrap_cpp(MOC_SOURCE_FILES ${QT_MOC_HEADERS} )
|
||||
qt4_wrap_ui( FORM_FILES_CPP ${QT_UI_FILES} )
|
||||
endif()
|
||||
|
||||
@ -276,15 +276,15 @@ set( QRC_FILES
|
||||
|
||||
# Runs RCC on specified files
|
||||
if ( NOT CMAKE_AUTOMOC)
|
||||
if (Qt5Core_FOUND)
|
||||
qt5_add_resources( QRC_FILES_CPP
|
||||
${QRC_FILES}
|
||||
)
|
||||
else()
|
||||
qt4_add_resources( QRC_FILES_CPP
|
||||
${QRC_FILES}
|
||||
)
|
||||
endif(Qt5Core_FOUND)
|
||||
if (Qt5Core_FOUND)
|
||||
qt5_add_resources( QRC_FILES_CPP
|
||||
${QRC_FILES}
|
||||
)
|
||||
else()
|
||||
qt4_add_resources( QRC_FILES_CPP
|
||||
${QRC_FILES}
|
||||
)
|
||||
endif(Qt5Core_FOUND)
|
||||
endif(NOT CMAKE_AUTOMOC)
|
||||
|
||||
# Adding resource (RC) files for Windows
|
||||
@ -315,16 +315,16 @@ source_group( "UnitTests" FILES ${UNIT_TEST_FILES} )
|
||||
|
||||
if (MSVC)
|
||||
set( EXE_FILES WIN32)
|
||||
if (RESINSIGHT_ENABLE_GRPC)
|
||||
# GRPC generates a lot of harmless warnings on MSVC
|
||||
set_source_files_properties(${GRPC_CPP_SOURCES} PROPERTIES COMPILE_FLAGS "/wd4251 /wd4702 /wd4005 /wd4244 /wd4125")
|
||||
endif(RESINSIGHT_ENABLE_GRPC)
|
||||
if (RESINSIGHT_ENABLE_GRPC)
|
||||
# GRPC generates a lot of harmless warnings on MSVC
|
||||
set_source_files_properties(${GRPC_CPP_SOURCES} PROPERTIES COMPILE_FLAGS "/wd4251 /wd4702 /wd4005 /wd4244 /wd4125")
|
||||
endif(RESINSIGHT_ENABLE_GRPC)
|
||||
elseif (APPLE)
|
||||
set( EXE_FILES MACOSX_BUNDLE)
|
||||
endif()
|
||||
set( EXE_FILES
|
||||
${EXE_FILES}
|
||||
${GRPC_HEADER_FILES}
|
||||
${GRPC_HEADER_FILES}
|
||||
${CPP_SOURCES}
|
||||
${MOC_SOURCE_FILES}
|
||||
${FORM_FILES_CPP}
|
||||
@ -335,20 +335,20 @@ set( EXE_FILES
|
||||
../ResInsightVersion.cmake
|
||||
.clang-format
|
||||
.clang-tidy
|
||||
Adm/RiaVersionInfo.h.cmake
|
||||
Adm/RiaVersionInfo.h.cmake
|
||||
)
|
||||
|
||||
if (RESINSIGHT_ENABLE_GRPC)
|
||||
list(APPEND EXE_FILES
|
||||
${GRPC_CPP_SOURCES}
|
||||
${GRPC_HEADER_FILES}
|
||||
${GRPC_PYTHON_SOURCES_FULL_PATH}
|
||||
Adm/RiaVersionInfo.py.cmake
|
||||
)
|
||||
if (DEFINED GRPC_LIBRARY_DIRS)
|
||||
message(STATUS "Using GRPC Library Dir: ${GRPC_LIBRARY_DIRS}")
|
||||
link_directories("${GRPC_LIBRARY_DIRS}")
|
||||
endif(DEFINED GRPC_LIBRARY_DIRS)
|
||||
list(APPEND EXE_FILES
|
||||
${GRPC_CPP_SOURCES}
|
||||
${GRPC_HEADER_FILES}
|
||||
${GRPC_PYTHON_SOURCES_FULL_PATH}
|
||||
Adm/RiaVersionInfo.py.cmake
|
||||
)
|
||||
if (DEFINED GRPC_LIBRARY_DIRS)
|
||||
message(STATUS "Using GRPC Library Dir: ${GRPC_LIBRARY_DIRS}")
|
||||
link_directories("${GRPC_LIBRARY_DIRS}")
|
||||
endif(DEFINED GRPC_LIBRARY_DIRS)
|
||||
endif(RESINSIGHT_ENABLE_GRPC)
|
||||
|
||||
add_executable( ResInsight ${EXE_FILES})
|
||||
@ -362,9 +362,9 @@ if (MSVC)
|
||||
|
||||
set_target_properties(ResInsight PROPERTIES COMPILE_FLAGS "/W4 /wd4190 /wd4100 /wd4127 /wd4245")
|
||||
if (CMAKE_CXX_COMPILER_VERSION LESS_EQUAL 19.14)
|
||||
# The following warning is generated over 800 times from a qwt header only using VS2015
|
||||
# Disabling temporarily
|
||||
# warning C4505 'function' : unreferenced local function has been removed
|
||||
# The following warning is generated over 800 times from a qwt header only using VS2015
|
||||
# Disabling temporarily
|
||||
# warning C4505 'function' : unreferenced local function has been removed
|
||||
set_target_properties(ResInsight PROPERTIES COMPILE_FLAGS "/wd4505")
|
||||
endif()
|
||||
|
||||
@ -405,7 +405,7 @@ set( LINK_LIBRARIES
|
||||
)
|
||||
|
||||
if (RESINSIGHT_ENABLE_GRPC)
|
||||
list(APPEND LINK_LIBRARIES ${GRPC_LIBRARIES})
|
||||
list(APPEND LINK_LIBRARIES ${GRPC_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# According to ivarun this is needed on OpenSuse, and Fedora. See: https://github.com/OPM/ResInsight/pull/7
|
||||
@ -481,19 +481,19 @@ endif()
|
||||
if (MSVC)
|
||||
|
||||
# Qt DLLs
|
||||
if (Qt5Core_FOUND)
|
||||
if (Qt5Core_FOUND)
|
||||
message(STATUS "Creating post build step for copying Qt DLLs")
|
||||
foreach (qtlib ${QT_LIBRARIES})
|
||||
add_custom_command(TARGET ResInsight POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${qtlib}> $<TARGET_FILE_DIR:ResInsight>
|
||||
)
|
||||
endforeach(qtlib)
|
||||
else()
|
||||
set (QTLIBLIST QtCore4 QtCored4 QtGui4 QtGuid4 QtOpenGl4 QtOpenGld4 QtNetwork4 QtNetworkd4 QtScript4 QtScriptd4 QtScriptTools4 QtScriptToolsd4)
|
||||
foreach (qtlib ${QTLIBLIST})
|
||||
list(APPEND RI_DLL_FILENAMES ${QT_BINARY_DIR}/${qtlib}.dll)
|
||||
endforeach( qtlib )
|
||||
endif()
|
||||
foreach (qtlib ${QT_LIBRARIES})
|
||||
add_custom_command(TARGET ResInsight POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${qtlib}> $<TARGET_FILE_DIR:ResInsight>
|
||||
)
|
||||
endforeach(qtlib)
|
||||
else()
|
||||
set (QTLIBLIST QtCore4 QtCored4 QtGui4 QtGuid4 QtOpenGl4 QtOpenGld4 QtNetwork4 QtNetworkd4 QtScript4 QtScriptd4 QtScriptTools4 QtScriptToolsd4)
|
||||
foreach (qtlib ${QTLIBLIST})
|
||||
list(APPEND RI_DLL_FILENAMES ${QT_BINARY_DIR}/${qtlib}.dll)
|
||||
endforeach( qtlib )
|
||||
endif()
|
||||
# Odb Dlls
|
||||
if (RESINSIGHT_USE_ODB_API)
|
||||
# Find all the dlls
|
||||
@ -536,28 +536,28 @@ endforeach()
|
||||
|
||||
# Copy all grpc libraries and python files
|
||||
if (RESINSIGHT_ENABLE_GRPC)
|
||||
if(UNIX)
|
||||
foreach (GRPC_LIBRARY ${GRPC_LIBRARIES})
|
||||
add_custom_command(TARGET ResInsight POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${GRPC_INSTALL_PREFIX}/lib/lib${GRPC_LIBRARY}.so"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>"
|
||||
)
|
||||
endforeach(GRPC_LIBRARY ${GRPC_LIBRARIES})
|
||||
endif(UNIX)
|
||||
if(UNIX)
|
||||
foreach (GRPC_LIBRARY ${GRPC_LIBRARIES})
|
||||
add_custom_command(TARGET ResInsight POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${GRPC_INSTALL_PREFIX}/lib/lib${GRPC_LIBRARY}.so"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>"
|
||||
)
|
||||
endforeach(GRPC_LIBRARY ${GRPC_LIBRARIES})
|
||||
endif(UNIX)
|
||||
|
||||
if (PYTHON_EXECUTABLE AND EXISTS ${PYTHON_EXECUTABLE})
|
||||
add_custom_target(GeneratedPythonSources DEPENDS ${GRPC_GENERATED_PYTHON_SOURCES})
|
||||
add_dependencies(ResInsight GeneratedPythonSources)
|
||||
if (PYTHON_EXECUTABLE AND EXISTS ${PYTHON_EXECUTABLE})
|
||||
add_custom_target(GeneratedPythonSources DEPENDS ${GRPC_GENERATED_PYTHON_SOURCES})
|
||||
add_dependencies(ResInsight GeneratedPythonSources)
|
||||
|
||||
foreach (PYTHON_SCRIPT ${GRPC_PYTHON_SOURCES})
|
||||
if (EXISTS "${GRPC_PYTHON_SOURCE_PATH}/${PYTHON_SCRIPT}")
|
||||
configure_file("${GRPC_PYTHON_SOURCE_PATH}/${PYTHON_SCRIPT}"
|
||||
"${GRPC_PYTHON_DEST_PATH}/${PYTHON_SCRIPT}"
|
||||
COPYONLY)
|
||||
endif(EXISTS "${GRPC_PYTHON_SOURCE_PATH}/${PYTHON_SCRIPT}")
|
||||
endforeach(PYTHON_SCRIPT ${GRPC_PYTHON_SOURCES})
|
||||
endif(PYTHON_EXECUTABLE AND EXISTS ${PYTHON_EXECUTABLE})
|
||||
foreach (PYTHON_SCRIPT ${GRPC_PYTHON_SOURCES})
|
||||
if (EXISTS "${GRPC_PYTHON_SOURCE_PATH}/${PYTHON_SCRIPT}")
|
||||
configure_file("${GRPC_PYTHON_SOURCE_PATH}/${PYTHON_SCRIPT}"
|
||||
"${GRPC_PYTHON_DEST_PATH}/${PYTHON_SCRIPT}"
|
||||
COPYONLY)
|
||||
endif(EXISTS "${GRPC_PYTHON_SOURCE_PATH}/${PYTHON_SCRIPT}")
|
||||
endforeach(PYTHON_SCRIPT ${GRPC_PYTHON_SOURCES})
|
||||
endif(PYTHON_EXECUTABLE AND EXISTS ${PYTHON_EXECUTABLE})
|
||||
endif(RESINSIGHT_ENABLE_GRPC)
|
||||
|
||||
#############################################################################
|
||||
@ -633,12 +633,12 @@ if (RESINSIGHT_PRIVATE_INSTALL)
|
||||
COMMAND set PATH=%PATH%$<SEMICOLON>${qt5_install_prefix}/bin
|
||||
COMMAND
|
||||
Qt5::windeployqt
|
||||
--no-compiler-runtime
|
||||
--no-system-d3d-compiler
|
||||
--no-quick-import
|
||||
--no-translations
|
||||
--no-compiler-runtime
|
||||
--no-system-d3d-compiler
|
||||
--no-quick-import
|
||||
--no-translations
|
||||
--verbose 0
|
||||
--dir "${CMAKE_CURRENT_BINARY_DIR}/windeployqt"
|
||||
--dir "${CMAKE_CURRENT_BINARY_DIR}/windeployqt"
|
||||
"$<TARGET_FILE_DIR:ResInsight>/$<TARGET_FILE_NAME:ResInsight>"
|
||||
)
|
||||
|
||||
|
@ -1,154 +1,154 @@
|
||||
set ( SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcServer.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcCallbacks.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcCallbacks.inl
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcServiceInterface.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcGridInfoService.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcProjectInfoService.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcCommandService.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcResInfoService.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcServer.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcCallbacks.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcCallbacks.inl
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcServiceInterface.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcGridInfoService.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcProjectInfoService.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcCommandService.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcResInfoService.h
|
||||
)
|
||||
|
||||
set ( SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcServer.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcServiceInterface.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcGridInfoService.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcProjectInfoService.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcCommandService.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcResInfoService.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcServer.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcServiceInterface.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcGridInfoService.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcProjectInfoService.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcCommandService.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcResInfoService.cpp
|
||||
)
|
||||
|
||||
add_definitions(-DENABLE_GRPC)
|
||||
|
||||
if (MSVC)
|
||||
add_definitions(-D_WIN32_WINNT=0x600)
|
||||
add_definitions(-D_WIN32_WINNT=0x600)
|
||||
|
||||
# Find Protobuf installation
|
||||
# Looks for protobuf-config.cmake file installed by Protobuf's cmake installation.
|
||||
set(protobuf_MODULE_COMPATIBLE ON CACHE BOOL "")
|
||||
find_package(Protobuf CONFIG 3.0 REQUIRED)
|
||||
message(STATUS "Using protobuf ${protobuf_VERSION}")
|
||||
# Find Protobuf installation
|
||||
# Looks for protobuf-config.cmake file installed by Protobuf's cmake installation.
|
||||
set(protobuf_MODULE_COMPATIBLE ON CACHE BOOL "")
|
||||
find_package(Protobuf CONFIG 3.0 REQUIRED)
|
||||
message(STATUS "Using protobuf ${protobuf_VERSION}")
|
||||
|
||||
# Find gRPC installation
|
||||
# Looks for gRPCConfig.cmake file installed by gRPC's cmake installation.
|
||||
find_package(gRPC CONFIG REQUIRED NO_MODULE)
|
||||
message(STATUS "Using gRPC ${gRPC_VERSION}")
|
||||
# Find gRPC installation
|
||||
# Looks for gRPCConfig.cmake file installed by gRPC's cmake installation.
|
||||
find_package(gRPC CONFIG REQUIRED NO_MODULE)
|
||||
message(STATUS "Using gRPC ${gRPC_VERSION}")
|
||||
|
||||
set(_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf)
|
||||
set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>)
|
||||
set(_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf)
|
||||
set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>)
|
||||
|
||||
set(_GRPC_GRPCPP_UNSECURE gRPC::grpc++_unsecure gRPC::grpc_unsecure gRPC::gpr)
|
||||
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
|
||||
set(GRPC_LIBRARIES ${_GRPC_GRPCPP_UNSECURE} ${_PROTOBUF_LIBPROTOBUF})
|
||||
set(_GRPC_GRPCPP_UNSECURE gRPC::grpc++_unsecure gRPC::grpc_unsecure gRPC::gpr)
|
||||
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
|
||||
set(GRPC_LIBRARIES ${_GRPC_GRPCPP_UNSECURE} ${_PROTOBUF_LIBPROTOBUF})
|
||||
|
||||
if (MSVC)
|
||||
set_target_properties(${GRPC_LIBRARIES} PROPERTIES
|
||||
MAP_IMPORTED_CONFIG_MINSIZEREL RELEASE
|
||||
MAP_IMPORTED_CONFIG_RELWITHDEBINFO RELEASE
|
||||
)
|
||||
endif(MSVC)
|
||||
if (MSVC)
|
||||
set_target_properties(${GRPC_LIBRARIES} PROPERTIES
|
||||
MAP_IMPORTED_CONFIG_MINSIZEREL RELEASE
|
||||
MAP_IMPORTED_CONFIG_RELWITHDEBINFO RELEASE
|
||||
)
|
||||
endif(MSVC)
|
||||
else()
|
||||
if (NOT DEFINED GRPC_INSTALL_PREFIX OR NOT EXISTS ${GRPC_INSTALL_PREFIX})
|
||||
message(FATAL_ERROR "You need a valid GRPC_INSTALL_PREFIX set to build with GRPC")
|
||||
endif()
|
||||
set(ENV{PKG_CONFIG_PATH} "${GRPC_INSTALL_PREFIX}/lib/pkgconfig")
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(GRPC REQUIRED grpc++_unsecure>=1.20 grpc_unsecure gpr protobuf)
|
||||
set(_PROTOBUF_PROTOC "${GRPC_INSTALL_PREFIX}/bin/protoc")
|
||||
set(_GRPC_CPP_PLUGIN_EXECUTABLE "${GRPC_INSTALL_PREFIX}/bin/grpc_cpp_plugin")
|
||||
include_directories(AFTER ${GRPC_INCLUDE_DIRS})
|
||||
if (NOT DEFINED GRPC_INSTALL_PREFIX OR NOT EXISTS ${GRPC_INSTALL_PREFIX})
|
||||
message(FATAL_ERROR "You need a valid GRPC_INSTALL_PREFIX set to build with GRPC")
|
||||
endif()
|
||||
set(ENV{PKG_CONFIG_PATH} "${GRPC_INSTALL_PREFIX}/lib/pkgconfig")
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(GRPC REQUIRED grpc++_unsecure>=1.20 grpc_unsecure gpr protobuf)
|
||||
set(_PROTOBUF_PROTOC "${GRPC_INSTALL_PREFIX}/bin/protoc")
|
||||
set(_GRPC_CPP_PLUGIN_EXECUTABLE "${GRPC_INSTALL_PREFIX}/bin/grpc_cpp_plugin")
|
||||
include_directories(AFTER ${GRPC_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
# Cannot use the nice new FindPackage modules for python since that is CMake 3.12+
|
||||
if(PYTHON_EXECUTABLE AND EXISTS ${PYTHON_EXECUTABLE})
|
||||
message(STATUS "Using Python ${PYTHON_EXECUTABLE}")
|
||||
message(STATUS "Using Python ${PYTHON_EXECUTABLE}")
|
||||
endif(PYTHON_EXECUTABLE AND EXISTS ${PYTHON_EXECUTABLE})
|
||||
|
||||
# Proto files
|
||||
set(PROTO_FILES
|
||||
"Empty"
|
||||
"CaseInfo"
|
||||
"GridInfo"
|
||||
"ProjectInfo"
|
||||
"Commands"
|
||||
"ResInfo"
|
||||
"Empty"
|
||||
"CaseInfo"
|
||||
"GridInfo"
|
||||
"ProjectInfo"
|
||||
"Commands"
|
||||
"ResInfo"
|
||||
)
|
||||
|
||||
set(GRPC_PYTHON_SOURCE_PATH "${CMAKE_SOURCE_DIR}/Python")
|
||||
set(GRPC_PYTHON_DEST_PATH "${CMAKE_BINARY_DIR}/Python")
|
||||
|
||||
foreach(proto_file ${PROTO_FILES})
|
||||
get_filename_component(rips_proto "${CMAKE_CURRENT_LIST_DIR}/GrpcProtos/${proto_file}.proto" ABSOLUTE)
|
||||
get_filename_component(rips_proto_path "${rips_proto}" PATH)
|
||||
get_filename_component(rips_proto "${CMAKE_CURRENT_LIST_DIR}/GrpcProtos/${proto_file}.proto" ABSOLUTE)
|
||||
get_filename_component(rips_proto_path "${rips_proto}" PATH)
|
||||
|
||||
set(rips_proto_srcs "${CMAKE_BINARY_DIR}/Generated/${proto_file}.pb.cc")
|
||||
set(rips_proto_hdrs "${CMAKE_BINARY_DIR}/Generated/${proto_file}.pb.h")
|
||||
set(rips_grpc_srcs "${CMAKE_BINARY_DIR}/Generated/${proto_file}.grpc.pb.cc")
|
||||
set(rips_grpc_hdrs "${CMAKE_BINARY_DIR}/Generated/${proto_file}.grpc.pb.h")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${rips_proto_srcs}" "${rips_proto_hdrs}" "${rips_grpc_srcs}" "${rips_grpc_hdrs}"
|
||||
COMMAND ${_PROTOBUF_PROTOC}
|
||||
ARGS --grpc_out "${CMAKE_BINARY_DIR}/Generated"
|
||||
--cpp_out "${CMAKE_BINARY_DIR}/Generated"
|
||||
-I "${rips_proto_path}"
|
||||
--plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}"
|
||||
"${rips_proto}"
|
||||
DEPENDS "${rips_proto}"
|
||||
)
|
||||
|
||||
if (PYTHON_EXECUTABLE AND EXISTS ${PYTHON_EXECUTABLE})
|
||||
set(rips_proto_python "generated/${proto_file}_pb2.py")
|
||||
set(rips_grpc_python "generated/${proto_file}_pb2_grpc.py")
|
||||
set(rips_proto_srcs "${CMAKE_BINARY_DIR}/Generated/${proto_file}.pb.cc")
|
||||
set(rips_proto_hdrs "${CMAKE_BINARY_DIR}/Generated/${proto_file}.pb.h")
|
||||
set(rips_grpc_srcs "${CMAKE_BINARY_DIR}/Generated/${proto_file}.grpc.pb.cc")
|
||||
set(rips_grpc_hdrs "${CMAKE_BINARY_DIR}/Generated/${proto_file}.grpc.pb.h")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${rips_proto_srcs}" "${rips_proto_hdrs}" "${rips_grpc_srcs}" "${rips_grpc_hdrs}"
|
||||
COMMAND ${_PROTOBUF_PROTOC}
|
||||
ARGS --grpc_out "${CMAKE_BINARY_DIR}/Generated"
|
||||
--cpp_out "${CMAKE_BINARY_DIR}/Generated"
|
||||
-I "${rips_proto_path}"
|
||||
--plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}"
|
||||
"${rips_proto}"
|
||||
DEPENDS "${rips_proto}"
|
||||
)
|
||||
|
||||
if (PYTHON_EXECUTABLE AND EXISTS ${PYTHON_EXECUTABLE})
|
||||
set(rips_proto_python "generated/${proto_file}_pb2.py")
|
||||
set(rips_grpc_python "generated/${proto_file}_pb2_grpc.py")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${GRPC_PYTHON_SOURCE_PATH}/${rips_proto_python}" "${GRPC_PYTHON_SOURCE_PATH}/${rips_grpc_python}"
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
ARGS -m grpc_tools.protoc
|
||||
-I "${rips_proto_path}"
|
||||
--python_out "${GRPC_PYTHON_SOURCE_PATH}/generated"
|
||||
--grpc_python_out "${GRPC_PYTHON_SOURCE_PATH}/generated"
|
||||
"${rips_proto}"
|
||||
DEPENDS "${rips_proto}"
|
||||
COMMENT "Generating ${rips_proto_python} and ${rips_grpc_python}"
|
||||
VERBATIM
|
||||
)
|
||||
list (APPEND GRPC_PYTHON_GENERATED_SOURCES
|
||||
${rips_proto_python}
|
||||
${rips_grpc_python}
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT "${GRPC_PYTHON_SOURCE_PATH}/${rips_proto_python}" "${GRPC_PYTHON_SOURCE_PATH}/${rips_grpc_python}"
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
ARGS -m grpc_tools.protoc
|
||||
-I "${rips_proto_path}"
|
||||
--python_out "${GRPC_PYTHON_SOURCE_PATH}/generated"
|
||||
--grpc_python_out "${GRPC_PYTHON_SOURCE_PATH}/generated"
|
||||
"${rips_proto}"
|
||||
DEPENDS "${rips_proto}"
|
||||
COMMENT "Generating ${rips_proto_python} and ${rips_grpc_python}"
|
||||
VERBATIM
|
||||
)
|
||||
list (APPEND GRPC_PYTHON_GENERATED_SOURCES
|
||||
${rips_proto_python}
|
||||
${rips_grpc_python}
|
||||
)
|
||||
|
||||
endif(PYTHON_EXECUTABLE AND EXISTS ${PYTHON_EXECUTABLE})
|
||||
endif(PYTHON_EXECUTABLE AND EXISTS ${PYTHON_EXECUTABLE})
|
||||
|
||||
list( APPEND GRPC_HEADER_FILES
|
||||
${rips_proto_hdrs}
|
||||
${rips_grpc_hdrs}
|
||||
)
|
||||
|
||||
list( APPEND GRPC_CPP_SOURCES
|
||||
${rips_proto_srcs}
|
||||
${rips_grpc_srcs}
|
||||
)
|
||||
list( APPEND GRPC_HEADER_FILES
|
||||
${rips_proto_hdrs}
|
||||
${rips_grpc_hdrs}
|
||||
)
|
||||
|
||||
list( APPEND GRPC_CPP_SOURCES
|
||||
${rips_proto_srcs}
|
||||
${rips_grpc_srcs}
|
||||
)
|
||||
|
||||
endforeach(proto_file)
|
||||
|
||||
if (PYTHON_EXECUTABLE AND EXISTS ${PYTHON_EXECUTABLE})
|
||||
list(APPEND GRPC_PYTHON_SOURCES
|
||||
${GRPC_PYTHON_GENERATED_SOURCES}
|
||||
"api/__init__.py"
|
||||
"api/ResInsight.py"
|
||||
"examples/CommandExample.py"
|
||||
"examples/GridInfoStreamingExample.py"
|
||||
"examples/ResultValues.py"
|
||||
"examples/SelectedCases.py"
|
||||
"examples/AllCases.py"
|
||||
"tests/test_sample.py"
|
||||
)
|
||||
list(APPEND GRPC_PYTHON_SOURCES
|
||||
${GRPC_PYTHON_GENERATED_SOURCES}
|
||||
"api/__init__.py"
|
||||
"api/ResInsight.py"
|
||||
"examples/CommandExample.py"
|
||||
"examples/GridInfoStreamingExample.py"
|
||||
"examples/ResultValues.py"
|
||||
"examples/SelectedCases.py"
|
||||
"examples/AllCases.py"
|
||||
"tests/test_sample.py"
|
||||
)
|
||||
|
||||
foreach(PYTHON_SCRIPT ${GRPC_PYTHON_SOURCES})
|
||||
list(APPEND GRPC_PYTHON_SOURCES_FULL_PATH "${GRPC_PYTHON_SOURCE_PATH}/${PYTHON_SCRIPT}")
|
||||
endforeach()
|
||||
source_group(TREE ${GRPC_PYTHON_SOURCE_PATH} FILES ${GRPC_PYTHON_SOURCES_FULL_PATH} PREFIX "Python")
|
||||
foreach(PYTHON_SCRIPT ${GRPC_PYTHON_SOURCES})
|
||||
list(APPEND GRPC_PYTHON_SOURCES_FULL_PATH "${GRPC_PYTHON_SOURCE_PATH}/${PYTHON_SCRIPT}")
|
||||
endforeach()
|
||||
source_group(TREE ${GRPC_PYTHON_SOURCE_PATH} FILES ${GRPC_PYTHON_SOURCES_FULL_PATH} PREFIX "Python")
|
||||
|
||||
endif(PYTHON_EXECUTABLE AND EXISTS ${PYTHON_EXECUTABLE})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user