From 8a3b3adb753abb49d746e43868c2059ae84493f2 Mon Sep 17 00:00:00 2001 From: Dylan Brasseur Date: Wed, 13 Sep 2023 16:40:04 +0200 Subject: [PATCH] Better build/dependencies documentation --- .../cpp/ArmoniK.Api.Common/CMakeLists.txt | 2 +- packages/cpp/ArmoniK.Api.Tests/CMakeLists.txt | 2 +- packages/cpp/README.md | 17 +++++++++ packages/cpp/cmake/downloader.cmake | 38 ------------------- packages/cpp/cmake/downloader.ps1 | 13 ------- 5 files changed, 19 insertions(+), 53 deletions(-) create mode 100644 packages/cpp/README.md delete mode 100644 packages/cpp/cmake/downloader.cmake delete mode 100644 packages/cpp/cmake/downloader.ps1 diff --git a/packages/cpp/ArmoniK.Api.Common/CMakeLists.txt b/packages/cpp/ArmoniK.Api.Common/CMakeLists.txt index 7df317bc9..d639e543b 100644 --- a/packages/cpp/ArmoniK.Api.Common/CMakeLists.txt +++ b/packages/cpp/ArmoniK.Api.Common/CMakeLists.txt @@ -39,7 +39,7 @@ include(FetchContent) FETCHCONTENT_DECLARE( fmt - URL ${SRC_FMT} + URL "${SRC_FMT}" TIMEOUT 180 ) diff --git a/packages/cpp/ArmoniK.Api.Tests/CMakeLists.txt b/packages/cpp/ArmoniK.Api.Tests/CMakeLists.txt index ef6ad2dc3..9fa363c76 100644 --- a/packages/cpp/ArmoniK.Api.Tests/CMakeLists.txt +++ b/packages/cpp/ArmoniK.Api.Tests/CMakeLists.txt @@ -45,7 +45,7 @@ set_property(TARGET ${PROJECT_NAME} APPEND PROPERTY include(FetchContent) FetchContent_Declare( googletest - URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip + URL "${SRC_GTEST}" ) # For Windows: Prevent overriding the parent project's compiler/linker settings set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) diff --git a/packages/cpp/README.md b/packages/cpp/README.md new file mode 100644 index 000000000..ac34e1f34 --- /dev/null +++ b/packages/cpp/README.md @@ -0,0 +1,17 @@ +# ArmoniK Api Cpp + +## Build requirements +- cmake 3.22+ +- C++ compiler with C++17 support +- grpc 1.54 - 1.56.2 +- protobuf +- fmt 10.1.0 (https://github.com/fmtlib/fmt/archive/refs/tags/10.1.0.tar.gz) +- simdjson 3.2.2 (https://github.com/simdjson/simdjson/archive/refs/tags/v3.2.2.tar.gz) +- gtest (https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip) (if BUILD_TEST=ON) + +## How to build +```shell +cmake -S . -B out +cmake --build out +cmake --install out +``` diff --git a/packages/cpp/cmake/downloader.cmake b/packages/cpp/cmake/downloader.cmake deleted file mode 100644 index 8a01f18af..000000000 --- a/packages/cpp/cmake/downloader.cmake +++ /dev/null @@ -1,38 +0,0 @@ -# Downloads a file from a URL. The URL may be https, and things will still work. -# URL - the URL to dowload the file from -# DESTFILE - the location to save the download to. The file there will be overwritten if it exists. -# FAIL_ON_ERROR - whether or not to print a FATAL_ERROR if the download fails. -function(download_windows_file_https URL DESTFILE FAIL_ON_ERROR) - - #Fixe issue with PROXY on windows to avoid env variable HTTP_PROXY with pwd - find_program(POWERSHELL NAMES powershell DOC "Path to the Windows Powershell executable. Used to download files") - set(HAVE_DOWNLOADER_PROGRAM TRUE) - - set(DOWNLOADER_PROGRAM ${POWERSHELL}) - - # from http://superuser.com/questions/25538/how-to-download-files-from-command-line-in-windows-like-wget-is-doing - - set(DOWNLOAD_COMMAND "") - if(NOT HAVE_DOWNLOADER_PROGRAM) - message(FATAL_ERROR "A downloader program, either curl, wget, or powershell, is required to download files. Please set CURL, WGET, or POWERSHELL to the location of the respective program.") - endif() - - SET(SCRIPT_DOWNLOAD "${CMAKE_SOURCE_DIR}/cmake/downloader.ps1") - - cmake_path(NATIVE_PATH SCRIPT_DOWNLOAD script_download) - cmake_path(NATIVE_PATH DESTFILE dest_win_file) - #${URL} ${dest_win_file} - SET(CONFIGURED_DOWNLOAD_COMMAND "${script_download}") - - #message("Executing command: ${DOWNLOADER_PROGRAM} ${CONFIGURED_DOWNLOAD_COMMAND}") - - execute_process(COMMAND "${DOWNLOADER_PROGRAM}" -ExecutionPolicy Bypass -File "${CONFIGURED_DOWNLOAD_COMMAND}" ${URL} ${dest_win_file} RESULT_VARIABLE DOWNLOAD_RESULT OUTPUT_VARIABLE out_var ERROR_VARIABLE err_var) - - - if((NOT ${DOWNLOAD_RESULT} EQUAL 0 OR NOT "${err_var}" STREQUAL "") AND FAIL_ON_ERROR) - message(STATUS "Unable to download file ${URL} msg ${DOWNLOAD_RESULT} : ${out_var} error : ${err_var}") - message(FATAL_ERROR "${DOWNLOADER_PROGRAM} ${CONFIGURED_DOWNLOAD_COMMAND}") - else() - message(STATUS "Info sucess to download file ${URL} msg ${DOWNLOAD_RESULT} : [${out_var}] error : [${err_var}]") - endif() -endfunction(download_windows_file_https URL DESTFILE FAIL_ON_ERROR) diff --git a/packages/cpp/cmake/downloader.ps1 b/packages/cpp/cmake/downloader.ps1 deleted file mode 100644 index f64b6447b..000000000 --- a/packages/cpp/cmake/downloader.ps1 +++ /dev/null @@ -1,13 +0,0 @@ -[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 - -$browser = New-Object System.Net.WebClient - -$browser.Proxy.Credentials =[System.Net.CredentialCache]::DefaultNetworkCredentials; - -$url=$args[0] - -$dest=$args[1] - -write-output "Download file [$url] to [$dest]" - -Invoke-WebRequest $url -OutFile $dest