diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index aac36a2..53206e1 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -16,7 +16,11 @@ jobs: # well on Windows or Mac. You can convert this to a matrix build if you need # cross-platform coverage. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest, macos-latest] steps: - uses: actions/checkout@v2 diff --git a/README.md b/README.md index 2742b2a..c334a8d 100644 --- a/README.md +++ b/README.md @@ -155,16 +155,20 @@ What is working: - Calling RPCs (unary + streaming) - Input and output of all protocol buffer types - Security: SSL is supported +- Performance: Caching of reflection queries Some notable things which are not yet working: - Using Proto files instead of Reflection API (currently gWhisper only works with servers which have reflection enabled) -- Performance: Caching of reflection queries ## Supported platforms -Development and testing is done on Fedora Linux 33 and Arch Linux. -We expect no bigger problems with building and running this software on different linux distributions. +We support the following platforms: +- Linux +- MacOS + +Development is done on Fedora Linux and Arch Linux. +CI tests are run on `ubuntu-latest` and `macos-latest` GitHub Action runners. ## Reporting issues diff --git a/cmake/filesystem.cmake b/cmake/filesystem.cmake new file mode 100644 index 0000000..39067c5 --- /dev/null +++ b/cmake/filesystem.cmake @@ -0,0 +1,14 @@ +set(FILESYSTEM_LIB "") + +# Check for the the need to link FS library +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.1) + message(STATUS "Using GCC version less than 9.1, linking with -lstdc++fs") + set(FILESYSTEM_LIB stdc++fs) + endif() +elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0) + message(STATUS "Using Clang version less than 9.0, linking with -lc++fs") + set(FILESYSTEM_LIB c++fs) + endif() +endif() \ No newline at end of file diff --git a/src/libLocalDescriptorCache/CMakeLists.txt b/src/libLocalDescriptorCache/CMakeLists.txt index 1ed82e9..09e71c6 100644 --- a/src/libLocalDescriptorCache/CMakeLists.txt +++ b/src/libLocalDescriptorCache/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. - +include(filesystem) set(TARGET_NAME "DescDbProxy") set(TARGET_SRC @@ -32,6 +32,9 @@ target_link_libraries(${TARGET_NAME} version reflection cli - stdc++fs ) +# Link FS library if required: +if (FILESYSTEM_LIB) + target_link_libraries(${TARGET_NAME} PRIVATE ${MANUAL_FILESYSTEM_LIB}) +endif() \ No newline at end of file diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index 1da3d6e..2122fdd 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +include(filesystem) + set(TARGET_NAME "gwhisperUtils") set(TARGET_SRC ./gwhisperUtils.cpp @@ -21,11 +23,8 @@ target_include_directories(${TARGET_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/.. ) - - -target_link_libraries(${TARGET_NAME} - stdc++fs - ) - - +# Link FS library if required: +if (FILESYSTEM_LIB) + target_link_libraries(${TARGET_NAME} PRIVATE ${MANUAL_FILESYSTEM_LIB}) +endif() \ No newline at end of file diff --git a/tests/functionTests/runFunctionTest.py b/tests/functionTests/runFunctionTest.py index 8f20411..5fb67c6 100755 --- a/tests/functionTests/runFunctionTest.py +++ b/tests/functionTests/runFunctionTest.py @@ -106,7 +106,7 @@ def prGreen(text): print("\033[92m {}\033[00m" .format(text)) for expectedLine in expected: if len(expected)>len(received): fail = True - failtext = "Test '{}' at line {} received not enough lines.".format(testname, testline) + failtext = "Test '{}' at line {} received not enough lines. expected: {}, received: {}".format(testname, testline, expected, received) break if(len(expected) <= idx): if(expectedLine.startswith("?")): diff --git a/tests/testServer/CMakeLists.txt b/tests/testServer/CMakeLists.txt index df7c088..3f73bc7 100644 --- a/tests/testServer/CMakeLists.txt +++ b/tests/testServer/CMakeLists.txt @@ -41,18 +41,32 @@ MakeKeyCert target_link_libraries(${TARGET_NAME} PUBLIC ${TARGET_NAME}_protobuf - - # we need to link the whole reflection lib, even though the compiler might - # think we do not use any symbols. (This is because gRPC dynamically - # checks if reflection is linked and has no hard dependency on any symbols - # there) - # This is done with --no-as-needed in case we link dynamically and - # --whole-archive in case we link statically. - -Wl,--push-state,--no-as-needed,--whole-archive ${LIB_GRPC++_REFLECTION} -Wl,--pop-state - protoDoc gwhisperUtils ) + +if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") + target_link_libraries(${TARGET_NAME} + PUBLIC + ${TARGET_NAME}_protobuf + ${LIB_GRPC++_REFLECTION} + ) +else() + target_link_libraries(${TARGET_NAME} + PUBLIC + ${TARGET_NAME}_protobuf + # on linux we need to link the whole reflection lib, even though the compiler might + # think we do not use any symbols. (This is because gRPC dynamically + # checks if reflection is linked and has no hard dependency on any symbols + # there) + # This is done with --no-as-needed in case we link dynamically and + # --whole-archive in case we link statically. + -Wl,--push-state,--no-as-needed,--whole-archive ${LIB_GRPC++_REFLECTION} -Wl,--pop-state + ) + +endif() + + add_custom_command( OUTPUT cert-key-pair/ca.crt cert-key-pair/ca.key cert-key-pair/ca.srl cert-key-pair/client_crt.pem cert-key-pair/client_csr.pem cert-key-pair/client_key.pem cert-key-pair/server_crt.pem cert-key-pair/server_csr.pem cert-key-pair/server_key.pem