Skip to content
Snippets Groups Projects
Commit b7cace3b authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Merge branch 'feature/windows-arm64' into 'main'

Build for Windows ARM64

See merge request beyondaka/beyond-protocol!48
parents b5e68774 5a56ee9e
Branches
Tags
No related merge requests found
...@@ -6,3 +6,6 @@ build ...@@ -6,3 +6,6 @@ build
_CPack_Packages _CPack_Packages
.env .env
docs/html docs/html
/build*
/.vs
/CMakeSettings.json
...@@ -195,6 +195,33 @@ windows:build_debug: ...@@ -195,6 +195,33 @@ windows:build_debug:
- cmake -DCMAKE_GENERATOR_PLATFORM=x64 "-DFTL_VERSION=$CI_COMMIT_TAG" -DWITH_GNUTLS=TRUE -DGNUTLS_INCLUDE_DIR="C:/Build/bin/gnutls/lib/includes/" -DGNUTLS_LIBRARY="C:/Build/bin/gnutls/lib/libgnutls.dll.a" .. - cmake -DCMAKE_GENERATOR_PLATFORM=x64 "-DFTL_VERSION=$CI_COMMIT_TAG" -DWITH_GNUTLS=TRUE -DGNUTLS_INCLUDE_DIR="C:/Build/bin/gnutls/lib/includes/" -DGNUTLS_LIBRARY="C:/Build/bin/gnutls/lib/libgnutls.dll.a" ..
- '& MSBuild.exe beyond-protocol.sln -property:Configuration=RelWithDebInfo -nr:false -maxCpuCount' - '& MSBuild.exe beyond-protocol.sln -property:Configuration=RelWithDebInfo -nr:false -maxCpuCount'
windows:build_arm64:
only:
- main
- merge_requests
- tags
stage: build
tags:
- windows
needs: []
dependencies: []
cache: # use artifacts instead if multiple runners available
key: "$CI_COMMIT_SHORT_SHA arm64"
paths:
- build_arm64/
script:
- cd $CI_PROJECT_DIR
- if (Test-Path build_arm64) { Remove-Item build_arm64/ -Recurse }
- mkdir build_arm64
- cd build_arm64
- cmake -DCMAKE_GENERATOR_PLATFORM=arm64 -DWITH_GNUTLS=FALSE -DBUILD_TESTS=FALSE -DURIPARSER_LIBRARY="C:/Build/bin_arm64/uriparser/Release/uriparser.lib" -DBUILD_TESTING=FALSE ..
- cmake --build . --config Release
windows:test: windows:test:
only: only:
- main - main
...@@ -278,6 +305,35 @@ windows:pack_debug: ...@@ -278,6 +305,35 @@ windows:pack_debug:
- ./*.zip - ./*.zip
expire_in: 1 week expire_in: 1 week
windows:pack_arm64:
only:
- tags
stage: pack
tags:
- windows
dependencies: ["windows:build_arm64"]
needs: ["windows:test", "windows:build_arm64"]
cache: # use artifacts instead if multiple runners available
key: "$CI_COMMIT_SHORT_SHA arm64"
paths:
- build_arm64/
script:
- $env:PATH+=";C:/Shared/Deploy"
- cd build_debug
- cpack -C RelWithDebInfo
- Invoke-RestMethod -Headers @{ "JOB-TOKEN"="$CI_JOB_TOKEN" } -InFile "../libftl-protocol-${CI_COMMIT_TAG}-win64.zip" -uri "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/libftl-protocol/${CI_COMMIT_TAG}/libftl-protocol-${CI_COMMIT_TAG}-win64-debug.zip" -Method put
artifacts:
when: always
paths:
- ./*.zip
expire_in: 1 week
# Documentation # Documentation
pages: pages:
......
...@@ -48,7 +48,6 @@ if (WITH_GNUTLS) ...@@ -48,7 +48,6 @@ if (WITH_GNUTLS)
message(STATUS "Gnutls found: ${GNUTLS_FOUND}") message(STATUS "Gnutls found: ${GNUTLS_FOUND}")
set(HAVE_GNUTLS true) set(HAVE_GNUTLS true)
else() else()
add_library(gnutls INTERFACE)
endif() endif()
# ============================================================================== # ==============================================================================
...@@ -104,12 +103,17 @@ include(ftl_paths) ...@@ -104,12 +103,17 @@ include(ftl_paths)
if (WIN32) # TODO(nick) Should do based upon compiler (VS) if (WIN32) # TODO(nick) Should do based upon compiler (VS)
add_definitions(-DWIN32) add_definitions(-DWIN32)
#set(CMAKE_GENERATOR_TOOLSET "host=x64") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /std:c++17 /wd4996 /Zc:__cplusplus")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2 /MP /std:c++17 /wd4996 /Zc:__cplusplus")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /DFTL_DEBUG /Wall") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /DFTL_DEBUG /Wall")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2 /W3") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2 /W3")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /O2 /W3 /Z7") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /O2 /W3 /Z7")
set(OS_LIBS "") set(OS_LIBS "")
if ("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "x64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2")
elseif ("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "ARM64")
endif()
else() else()
add_definitions(-DUNIX) add_definitions(-DUNIX)
# -fdiagnostics-color # -fdiagnostics-color
...@@ -202,7 +206,11 @@ add_library(beyond-protocol STATIC ...@@ -202,7 +206,11 @@ add_library(beyond-protocol STATIC
target_include_directories(beyond-protocol PUBLIC target_include_directories(beyond-protocol PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>) $<INSTALL_INTERFACE:include>)
target_link_libraries(beyond-protocol Threads::Threads ${UUID_LIBRARIES} GnuTLS::GnuTLS) target_link_libraries(beyond-protocol Threads::Threads ${UUID_LIBRARIES})
if (WITH_GNUTLS)
target_link_libraries(beyond-protocol GnuTLS::GnuTLS)
endif()
install(TARGETS beyond-protocol install(TARGETS beyond-protocol
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
......
...@@ -23,12 +23,16 @@ inline uint32_t secure_rnd() { ...@@ -23,12 +23,16 @@ inline uint32_t secure_rnd() {
return rnd; return rnd;
} }
#else #else
// TODO(Seb): Use cryptographically strong RNG. RFC 6455 (WebSicket protocol)
// requires new masking key for every frame and the key must not be
// predictable (use system random number source such as /dev/random
// or another library if GnuTLS is not enabled).
#include <random> #include <random>
static std::random_device rd_; static std::random_device rd_;
static std::uniform_int_distribution<uint32_t> dist_(0); static std::uniform_int_distribution<uint32_t> dist_(0);
inline uint32_t secure_rnd() { inline uint32_t secure_rnd() {
// TODO(Seb)
return dist_(rd_); return dist_(rd_);
} }
#endif #endif
...@@ -36,7 +40,9 @@ inline uint32_t secure_rnd() { ...@@ -36,7 +40,9 @@ inline uint32_t secure_rnd() {
using ftl::URI; using ftl::URI;
using ftl::net::internal::WebSocketBase; using ftl::net::internal::WebSocketBase;
using ftl::net::internal::Connection_TCP; using ftl::net::internal::Connection_TCP;
#ifdef HAVE_GNUTLS
using ftl::net::internal::Connection_TLS; using ftl::net::internal::Connection_TLS;
#endif
/* Taken from easywsclient */ /* Taken from easywsclient */
struct wsheader_type { struct wsheader_type {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment