Skip to content

Commit

Permalink
Add MsQuic to Linux server build target, ref #628
Browse files Browse the repository at this point in the history
  • Loading branch information
kaetemi committed Mar 1, 2023
1 parent 907ebb9 commit b58528d
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 24 deletions.
24 changes: 12 additions & 12 deletions CMakeModules/Findmsquic.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@ ENDIF()
FIND_PATH(
msquic_INCLUDE_DIRS
NAMES msquic.h
PATHS /usr/local/include/
PATHS /usr/local/include /usr/include
)

FIND_LIBRARY(
msquic_LIBRARY_RELEASE
NAMES msquic
PATHS /usr/local/lib/
NAMES libmsquic.so.2 msquic libmsquic
PATHS /usr/lib/x86_64-linux-gnu /usr/local/lib /usr/lib /opt/local
)

FIND_LIBRARY(
msquic_LIBRARY_DEBUG
NAMES msquicd
PATHS /usr/local/lib/
NAMES libmsquicd.so.2 msquicd libmsquicd
PATHS /usr/lib/x86_64-linux-gnu /usr/local/lib /usr/lib /opt/local
)

IF (msquic_INCLUDE_DIRS)
IF(msquic_LIBRARY_RELEASE AND msquic_LIBRARY_DEBUG)
SET(msquic_FOUND TRUE)
IF(msquic_LIBRARY_RELEASE AND msquic_LIBRARY_DEBUG)
SET(msquic_LIBRARIES ${msquic_LIBRARIES} optimized ${msquic_LIBRARY_RELEASE})
SET(msquic_LIBRARIES ${msquic_LIBRARIES} debug ${msquic_LIBRARY_DEBUG})
ENDIF()
IF(msquic_LIBRARY_RELEASE)
SET(msquic_LIBRARIES ${msquic_LIBRARIES} ${msquic_LIBRARY_RELEASE})
ENDIF()
SET(msquic_LIBRARIES ${msquic_LIBRARIES} optimized ${msquic_LIBRARY_RELEASE})
SET(msquic_LIBRARIES ${msquic_LIBRARIES} debug ${msquic_LIBRARY_DEBUG})
ELSEIF(msquic_LIBRARY_RELEASE)
SET(msquic_FOUND TRUE)
SET(msquic_LIBRARIES ${msquic_LIBRARIES} ${msquic_LIBRARY_RELEASE})
ENDIF()
ENDIF()

IF (msquic_FOUND)
Expand Down
20 changes: 14 additions & 6 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,20 @@ jobs:
sudo apt install libgsf-1-dev -y
sudo apt install qtbase5-dev qttools5-dev qttools5-dev-tools
sudo apt install libmsquic
wget https://github.com/microsoft/msquic/blob/main/src/inc/msquic.h
wget https://github.com/microsoft/msquic/blob/main/src/inc/msquic_posix.h
wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic.h
wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic_posix.h
wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/quic_sal_stub.h
sudo mv msquic.h /usr/include/msquic.h
sudo mv msquic_posix.h /usr/include/msquic_posix.h
sudo mv quic_sal_stub.h /usr/include/quic_sal_stub.h
displayName: 'Dependencies'
- script: |
mkdir build
cmake --version
cd build
cmake -G "Ninja" -DCMAKE_SUPPRESS_REGENERATION=ON \
-DWITH_STATIC=ON -DWITH_NEL_TESTS=ON -DWITH_NEL_SAMPLES=ON \
-DWITH_MSQUIC=ON \
-DWITH_LUA51=OFF -DWITH_LUA52=ON \
-DWITH_RYZOM=ON -DWITH_RYZOM_SERVER=ON -DWITH_RYZOM_CLIENT=ON -DWITH_RYZOM_TOOLS=ON \
-DWITH_NEL_TOOLS=ON -DWITH_NELNS=ON -DWITH_NELNS_LOGIN_SYSTEM=ON -DWITH_NELNS_SERVER=ON \
Expand Down Expand Up @@ -80,17 +83,20 @@ jobs:
sudo apt install libgsf-1-dev -y
sudo apt install qtbase5-dev qttools5-dev qttools5-dev-tools
sudo apt install libmsquic
wget https://github.com/microsoft/msquic/blob/main/src/inc/msquic.h
wget https://github.com/microsoft/msquic/blob/main/src/inc/msquic_posix.h
wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic.h
wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic_posix.h
wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/quic_sal_stub.h
sudo mv msquic.h /usr/include/msquic.h
sudo mv msquic_posix.h /usr/include/msquic_posix.h
sudo mv quic_sal_stub.h /usr/include/quic_sal_stub.h
displayName: 'Dependencies'
- script: |
mkdir build
cmake --version
cd build
cmake -G "Ninja" -DCMAKE_SUPPRESS_REGENERATION=ON \
-DWITH_STATIC=ON -DWITH_NEL_TESTS=ON -DWITH_NEL_SAMPLES=ON \
-DWITH_MSQUIC=ON \
-DWITH_LUA51=OFF -DWITH_LUA52=ON \
-DWITH_RYZOM=ON -DWITH_RYZOM_SERVER=ON -DWITH_RYZOM_CLIENT=ON -DWITH_RYZOM_TOOLS=ON \
-DWITH_NEL_TOOLS=ON -DWITH_NELNS=ON -DWITH_NELNS_LOGIN_SYSTEM=ON -DWITH_NELNS_SERVER=ON \
Expand Down Expand Up @@ -148,10 +154,12 @@ jobs:
sudo apt update
sudo apt remove -y man-db
sudo apt install -y --no-install-recommends $(aptPackages)
wget https://github.com/microsoft/msquic/blob/main/src/inc/msquic.h
wget https://github.com/microsoft/msquic/blob/main/src/inc/msquic_posix.h
wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic.h
wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic_posix.h
wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/quic_sal_stub.h
sudo mv msquic.h /usr/include/msquic.h
sudo mv msquic_posix.h /usr/include/msquic_posix.h
sudo mv quic_sal_stub.h /usr/include/quic_sal_stub.h
displayName: '(ubuntu) Dependencies'
condition: eq(variables['Agent.JobName'], 'client ubuntu')
- task: Cache@2
Expand Down
4 changes: 4 additions & 0 deletions ryzom/server/src/frontend_service/quic_selfsign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,10 @@ void *FES_findOrCreateSelfSignedCertificate(uint8 *certHash)
return nullptr;
}

void FES_freeSelfSignedCertificate(void *cert)
{
}

#endif

/* end of file */
6 changes: 4 additions & 2 deletions ryzom/server/src/frontend_service/quic_transceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include "config.h"
#include "quic_selfsign.h"

#include <condition_variable>

#ifdef NL_MSQUIC_AVAILABLE
#include <msquic.h>

Expand Down Expand Up @@ -217,7 +219,7 @@ void CQuicTransceiver::start(uint16 port)
// Programmatically create a self signed certificate, only valid in Windows
// This is very useful for development servers
uint8 certHash[20];
PCCERT_CONTEXT schannelCert = (PCCERT_CONTEXT)FES_findOrCreateSelfSignedCertificate(certHash);
void *schannelCert = FES_findOrCreateSelfSignedCertificate(certHash); // PCCERT_CONTEXT
if (schannelCert)
{
// Server credentials
Expand Down Expand Up @@ -369,7 +371,7 @@ _Function_class_(QUIC_LISTENER_CALLBACK)
user->Connection = ev->NEW_CONNECTION.Connection;
user->increaseRef();
// They're in.
MsQuic->SetCallbackHandler(ev->NEW_CONNECTION.Connection, CQuicTransceiverImpl::connectionCallback, (void *)user);
MsQuic->SetCallbackHandler(ev->NEW_CONNECTION.Connection, (void *)CQuicTransceiverImpl::connectionCallback, (void *)user);
status = MsQuic->ConnectionSetConfiguration(ev->NEW_CONNECTION.Connection, m->Configuration);
nlwarning("New QUIC connection");
break;
Expand Down
15 changes: 13 additions & 2 deletions tool/quick_start/docker/ryzombuild_focal_amd64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ MAINTAINER Ryzom Core <https://wiki.ryzom.dev/>
RUN sed -i -e 's/archive\.ubuntu\.com/mirrors\.digitalocean\.com/' /etc/apt/sources.list

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
software-properties-common \
cmake ninja-build curl wget build-essential ccache \
software-properties-common aria2 wget \
&& aria2c https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb \
&& dpkg -i packages-microsoft-prod.deb \
&& rm packages-microsoft-prod.deb \
&& apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
cmake ninja-build curl build-essential ccache \
bison autoconf automake \
libpng-dev \
libjpeg-dev \
Expand All @@ -21,6 +25,13 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
liblzma-dev \
libgsf-1-dev \
qtbase5-dev qttools5-dev qttools5-dev-tools \
libmsquic \
&& aria2c https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic.h \
&& aria2c https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic_posix.h \
&& aria2c https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/quic_sal_stub.h \
&& mv msquic.h /usr/include/msquic.h \
&& mv msquic_posix.h /usr/include/msquic_posix.h \
&& mv quic_sal_stub.h /usr/include/quic_sal_stub.h \
&& rm -rf /var/lib/apt/lists/*

ENV CC=/usr/lib/ccache/gcc
Expand Down
15 changes: 13 additions & 2 deletions tool/quick_start/docker/ryzombuild_jammy_amd64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ MAINTAINER Ryzom Core <https://wiki.ryzom.dev/>
RUN sed -i -e 's/archive\.ubuntu\.com/mirrors\.digitalocean\.com/' /etc/apt/sources.list

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
software-properties-common \
cmake ninja-build curl wget build-essential ccache \
software-properties-common aria2 wget \
&& aria2c https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb \
&& dpkg -i packages-microsoft-prod.deb \
&& rm packages-microsoft-prod.deb \
&& apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
cmake ninja-build curl build-essential ccache \
bison autoconf automake \
libpng-dev \
libjpeg-dev \
Expand All @@ -21,6 +25,13 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
liblzma-dev \
libgsf-1-dev \
qtbase5-dev qttools5-dev qttools5-dev-tools \
libmsquic \
&& aria2c https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic.h \
&& aria2c https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic_posix.h \
&& aria2c https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/quic_sal_stub.h \
&& mv msquic.h /usr/include/msquic.h \
&& mv msquic_posix.h /usr/include/msquic_posix.h \
&& mv quic_sal_stub.h /usr/include/quic_sal_stub.h \
&& rm -rf /var/lib/apt/lists/*

ENV CC=/usr/lib/ccache/gcc
Expand Down

0 comments on commit b58528d

Please sign in to comment.