Update Jenkinsfile, dockerfile, and 6 more files...

This commit is contained in:
Andrea Cavalli 2020-10-08 01:02:27 +02:00
parent b5f8fe0ed2
commit 7451213d78
8 changed files with 449 additions and 42 deletions

76
Jenkinsfile vendored
View File

@ -4,11 +4,9 @@
pipeline {
environment {
MVN_SET = credentials('maven_settings')
JAVA_TOOL_OPTIONS = '-Duser.home=/var/maven'
}
agent { docker { image 'maven:3.6.3' } }
triggers {
pollSCM "* * * * *"
}
agent any
options {
timestamps()
ansiColor("xterm")
@ -19,23 +17,89 @@ pipeline {
defaultValue: false)
}
stages {
stage("Setup workspace") {
agent none
steps {
sh "mkdir -p \"/var/jenkins_cache/.m2\""
sh "chown 1000:1000 -R \"/var/jenkins_cache/.m2\""
sh "mkdir -p \"/var/jenkins_cache/.ccache\""
sh "chown 1000:1000 -R \"/var/jenkins_cache/.ccache\""
sh "mkdir -p \"/var/jenkins_cache/.ccache_arm64\""
sh "chown 1000:1000 -R \"/var/jenkins_cache/.ccache_arm64\""
sh "mkdir -p \"${workspace}/tdlight-java/src/main\""
//sh "chown 1000:1000 -R \"${workspace}\""
//sh "chmod 771 -R \"${workspace}\""
}
}
stage("Prepare native C++") {
agent {
dockerfile {
dir 'jenkins/docker/native'
filename 'dockerfile'
additionalBuildArgs '--build-arg version=1.0.0 --build-arg UID=1000 --build-arg GID=1000 --build-arg UNAME=jenkins'
args "-v \"${workspace}/src/main:/home/jenkins/output:rw\" -v \"/var/jenkins_cache/.m2:/home/jenkins/.m2:rw\" -v \"/var/jenkins_cache/.ccache:/home/jenkins/.ccache:rw\" -v \"${workspace}:/home/jenkins/work:rw\""
reuseNode true
}
}
steps {
sh "./jenkins/scripts/prepare_cross.sh"
}
}
stage("Cross compile C++") {
agent {
dockerfile {
dir 'jenkins/docker/win64'
filename 'dockerfile'
additionalBuildArgs '--build-arg version=1.0.0 --build-arg UID=1000 --build-arg GID=1000 --build-arg UNAME=jenkins'
args "-v \"${workspace}/src/main:/home/jenkins/output:rw\" -v \"/var/jenkins_cache/.m2:/home/jenkins/.m2:rw\" -v \"/var/jenkins_cache/.ccache_arm64:/home/jenkins/.ccache:rw\" -v \"${workspace}:/home/jenkins/work:rw\""
reuseNode true
}
}
steps {
sh "./jenkins/scripts/cross_compile.sh"
}
}
stage("Build & Deploy SNAPSHOT") {
agent {
docker {
image 'maven:3.6.3-openjdk-11'
args '-v $HOME:/var/maven'
reuseNode true
}
}
steps {
sh "mvn -s $MVN_SET -B deploy"
}
}
stage("Release") {
agent {
docker {
image 'maven:3.6.3-openjdk-11'
args '-v $HOME:/var/maven'
reuseNode true
}
}
when {
expression { params.RELEASE }
}
steps {
sh "mvn -s $MVN_SET -B release:prepare"
sh "mvn -s $MVN_SET -B release:perform"
sh "git config user.email \"jenkins@mchv.eu\""
sh "git config user.name \"Jenkins\""
sh "git add --all; git commit -m \"Add generated files\""
sh "mvn -s $MVN_SET -DpushChanges=false -DlocalCheckout=true -DpreparationGoals=initialize release:prepare release:perform -B"
}
}
stage('Deliver') {
agent {
docker {
image 'maven:3.6.3-openjdk-11'
args '-v $HOME:/var/maven'
reuseNode true
}
}
steps {
sh './jenkins/scripts/deliver.sh'
}

View File

@ -0,0 +1,58 @@
FROM debian:stable-slim
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get upgrade -y
RUN apt-get install wget -y
RUN wget https://cdn.azul.com/zulu/bin/zulu11.41.23-ca-jdk11.0.8-linux_amd64.deb -O /tmp/install.deb 2>/dev/null
RUN mkdir -p /usr/share/man/man1
RUN apt-get install /tmp/install.deb -y
RUN apt-get install sudo -y
RUN apt-get install maven -y
RUN apt-get install gcc gperf make cmake ccache -y
#RUN apt-get install clang libc++-dev libc++abi-dev -y
RUN apt-get install libssl-dev:amd64 zlib1g-dev:amd64 -y
RUN apt-get install build-essential -y
RUN apt-get install php-fpm php-cli -y
RUN apt-get install libreadline-dev git -y
ARG UNAME=debian
ARG UID=1000
ARG GID=1000
RUN groupadd -g $GID -o $UNAME
RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME
RUN usermod -a -G sudo $UNAME
RUN echo "$UNAME ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
USER $UNAME
RUN mkdir /home/$UNAME/work
RUN mkdir /home/$UNAME/output
WORKDIR /home/$UNAME/work
ENV CCACHE_DIR=/home/$UNAME/.ccache
ENV JAVA_HOME=/usr/lib/jvm/zulu-11-amd64
ENV JAVA_INCLUDE_PATH=/usr/lib/jvm/zulu-11-amd64/include
ENV JAVA_INCLUDE_PATH2=/usr/lib/jvm/zulu-11-amd64/include/linux
ENV JAVA_AWT_INCLUDE_PATH=/usr/lib/jvm/zulu-11-amd64/include
ENV JAVA_AWT_LIBRARY=/usr/lib/jvm/zulu-11-amd64/lib
ENV JAVA_JVM_LIBRARY=/usr/lib/jvm/zulu-11-amd64/lib
ENV TRAVIS_CPU_ARCH=amd64
ENV TRAVIS_OS_NAME=linux
ENV TRAVIS_BUILD_DIR=/home/$UNAME/work
ENV TRAVIS_OUTPUT_DIR=/home/$UNAME/output
CMD ["bash"]

View File

@ -0,0 +1,72 @@
FROM debian:stable-slim
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get upgrade -y
RUN apt-get install wget -y
RUN wget https://cdn.azul.com/zulu/bin/zulu11.41.23-ca-jdk11.0.8-linux_amd64.deb -O /tmp/install.deb 2>/dev/null
RUN mkdir -p /usr/share/man/man1
RUN apt-get install /tmp/install.deb -y
RUN apt-get install sudo -y
RUN apt-get install maven -y
RUN apt-get install gcc gperf make cmake ccache -y
RUN sudo apt-get install mingw-w64 -y
RUN apt-get install libssl-dev:amd64 zlib1g-dev:amd64 -y
RUN apt-get install python3 -y
RUN apt-get install php-fpm php-cli -y
RUN apt-get install libreadline-dev git -y
RUN apt install unzip -y
ARG UNAME=debian
ARG UID=1000
ARG GID=1000
RUN groupadd -g $GID -o $UNAME
RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME
RUN usermod -a -G sudo $UNAME
RUN echo "$UNAME ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
USER $UNAME
RUN mkdir /home/$UNAME/work
RUN mkdir /home/$UNAME/output
WORKDIR /home/$UNAME/work
ENV CCACHE_DIR=/home/$UNAME/.ccache
ENV JAVA_HOME=/usr/lib/jvm/zulu-11-amd64
ENV JAVA_INCLUDE_PATH=/usr/lib/jvm/zulu-11-amd64/include
ENV JAVA_INCLUDE_PATH2=/usr/lib/jvm/zulu-11-amd64/include/linux
ENV JAVA_AWT_INCLUDE_PATH=/usr/lib/jvm/zulu-11-amd64/include
ENV JAVA_AWT_LIBRARY=/usr/lib/jvm/zulu-11-amd64/lib
ENV JAVA_JVM_LIBRARY=/usr/lib/jvm/zulu-11-amd64/lib
ENV TRAVIS_CPU_ARCH=amd64
ENV TRAVIS_OS_NAME=windows
ENV TRAVIS_BUILD_DIR=/home/$UNAME/work
ENV TRAVIS_OUTPUT_DIR=/home/$UNAME/output
RUN git clone --depth 1 https://github.com/openssl/openssl.git /tmp/openssl_cross
RUN git clone --depth 1 https://github.com/madler/zlib.git /tmp/zlib_cross
RUN mkdir /tmp/java11_cross
RUN cd /tmp/java11_cross
RUN wget https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.8%2B10/OpenJDK11U-jdk_x64_windows_hotspot_11.0.8_10.zip -O /tmp/java11_cross/jdk.zip
RUN unzip jdk.zip -d /tmp/java11_cross/
RUN mv jdk-11.0.8+10/ jdk
RUN cd /home/$UNAME/work
CMD ["bash"]

107
jenkins/scripts/cross_compile.sh Executable file
View File

@ -0,0 +1,107 @@
#!/bin/bash -e
# ====== Setup workspace
cd $TRAVIS_BUILD_DIR
source ./jenkins/scripts/setup_workspace.sh
export JAVA_HOME=/usr/lib/jvm/zulu-11-amd64
export JAVA_AWT_LIBRARY=/tmp/java11_cross/jdk/lib/jawt.lib
export JAVA_JVM_LIBRARY=/tmp/java11_cross/jdk/lib/jvm.lib
export JAVA_INCLUDE_PATH=/tmp/java11_cross/jdk/include
export JAVA_INCLUDE_PATH2=/tmp/java11_cross/jdk/include/win32
export JAVA_AWT_INCLUDE_PATH=/tmp/java11_cross/jdk/include
TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/toolchain-win64.cmake
# ====== Prepare dependencies
## Install zlib for windows
cd /tmp/zlib_cross
export CC=x86_64-w64-mingw32-gcc-posix
./configure --prefix=/tmp/zlib_cross
make -f win32/Makefile.gcc BINARY_PATH=/tmp/zlib_cross/bin INCLUDE_PATH=/tmp/zlib_cross/include LIBRARY_PATH=/tmp/zlib_cross/lib PREFIX=x86_64-w64-mingw32- install
## Install openssl for windows
cd /tmp/openssl_cross
export CC=
./Configure --cross-compile-prefix=x86_64-w64-mingw32- --prefix=/tmp/openssl_cross mingw64 shared
sudo make install -j${TRAVIS_CPU_CORES}
# ====== Prepare TdLib
# Cross compilation preparation (also needed for split sources)
cd $TD_BUILD_DIR
nice -n 5 chrt -b 0 \
cmake \
-DCMAKE_CROSSCOMPILING=ON \
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \
-DJNI_FOUND=True \
-DJNI_LIBRARIES="${JAVA_AWT_LIBRARY} ${JAVA_JVM_LIBRARY}" \
-DJNI_INCLUDE_DIRS="${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2} ${JAVA_AWT_INCLUDE_PATH}" \
-DJAVA_JVM_LIBRARY=${JAVA_JVM_LIBRARY} \
-DJAVA_INCLUDE_PATH=${JAVA_INCLUDE_PATH} \
-DJAVA_INCLUDE_PATH2=${JAVA_INCLUDE_PATH2} \
-DOPENSSL_ROOT_DIR=/tmp/openssl_cross \
-DOPENSSL_LIBRARIES_DIR=/tmp/openssl_cross/lib \
-DOPENSSL_INCLUDE_DIR=/tmp/openssl_cross/include \
-DOPENSSL_CRYPTO_LIBRARY=/tmp/openssl_cross/libcrypto-3-x64.dll \
-DOPENSSL_SSL_LIBRARY=/tmp/openssl_cross/libssl-3-x64.dll \
-DZLIB_ROOT=/tmp/zlib_cross \
-DZLIB_LIBRARY=/tmp/zlib_cross/zlib1.dll \
-DZLIB_LIBRARIES_DIR=/tmp/zlib_cross \
-DZLIB_INCLUDE_DIR=/tmp/zlib_cross/include \
\
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} \
-DTD_ENABLE_JNI=ON \
${TD_SRC_DIR}
# Split sources
cd $TD_SRC_DIR
nice -n 5 chrt -b 0 php SplitSource.php
# Build
cd $TD_BUILD_DIR
nice -n 5 chrt -b 0 cmake --build $TD_BUILD_DIR --target install --parallel ${TRAVIS_CPU_CORES}
# Undo split-sources
cd $TD_SRC_DIR
nice -n 5 chrt -b 0 php SplitSource.php --undo
# ====== Build TdNatives
cd $TDNATIVES_CPP_BUILD_DIR
nice -n 5 chrt -b 0 \
cmake \
-DCMAKE_CROSSCOMPILING=ON \
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \
-DJNI_FOUND=True \
-DJNI_LIBRARIES="${JAVA_AWT_LIBRARY} ${JAVA_JVM_LIBRARY}" \
-DJNI_INCLUDE_DIRS="${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2} ${JAVA_AWT_INCLUDE_PATH}" \
-DJAVA_JVM_LIBRARY=${JAVA_JVM_LIBRARY} \
-DJAVA_INCLUDE_PATH=${JAVA_INCLUDE_PATH} \
-DJAVA_INCLUDE_PATH2=${JAVA_INCLUDE_PATH2} \
-DOPENSSL_ROOT_DIR=/tmp/openssl_cross \
-DOPENSSL_LIBRARIES_DIR=/tmp/openssl_cross/lib \
-DOPENSSL_INCLUDE_DIR=/tmp/openssl_cross/include \
-DOPENSSL_CRYPTO_LIBRARY=/tmp/openssl_cross/libcrypto-3-x64.dll \
-DOPENSSL_SSL_LIBRARY=/tmp/openssl_cross/libssl-3-x64.dll \
-DZLIB_ROOT=/tmp/zlib_cross \
-DZLIB_LIBRARY=/tmp/zlib_cross/zlib1.dll \
-DZLIB_LIBRARIES_DIR=/tmp/zlib_cross \
-DZLIB_INCLUDE_DIR=/tmp/zlib_cross/include \
\
-DCMAKE_BUILD_TYPE=Release \
-DTD_GENERATED_BINARIES_DIR=${TD_CROSS_BIN_DIR}/td/generate \
-DTD_SRC_DIR=${TD_SRC_DIR} \
-DTDNATIVES_BIN_DIR=${TDNATIVES_BIN_DIR} \
-DTDNATIVES_DOCS_BIN_DIR=${TDNATIVES_DOCS_BIN_DIR} \
-DTd_DIR=${TD_BIN_DIR}/lib/cmake/Td \
-DJAVA_SRC_DIR=${JAVA_SRC_DIR} \
-DTDNATIVES_CPP_SRC_DIR:PATH=$TDNATIVES_CPP_SRC_DIR \
$TDNATIVES_CPP_SRC_DIR
nice -n 5 chrt -b 0 cmake --build $TDNATIVES_CPP_BUILD_DIR --target install --parallel ${TRAVIS_CPU_CORES}
# ====== Print results stats
echo "CCACHE statistics:"
ccache -s
# ====== Copy output
cd $TDNATIVES_CPP_BUILD_DIR
mkdir -p $TDLIB_RESOURCES_OUTPUT_DIR
mv $TDNATIVES_BIN_DIR/$SRC_TDJNI_LIBNAME $TDLIB_RESOURCES_OUTPUT_DIR/$DEST_TDJNI_LIBNAME

View File

@ -0,0 +1,14 @@
#!/bin/bash -e
# ====== Setup workspace
cd $TRAVIS_BUILD_DIR
source ./jenkins/scripts/setup_workspace.sh
cd $TD_CROSS_BIN_DIR
nice -n 5 chrt -b 0 cmake \
-DTD_ENABLE_JNI=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} \
-DCMAKE_INSTALL_BINDIR:PATH=${TD_BIN_DIR}/bin \
$TD_SRC_DIR
nice -n 5 chrt -b 0 cmake --build . --target prepare_cross_compiling --parallel ${TRAVIS_CPU_CORES}
nice -n 5 chrt -b 0 cmake --build . --target td_generate_java_api --parallel ${TRAVIS_CPU_CORES}

View File

@ -0,0 +1,58 @@
#!/bin/bash -e
# ====== Variables
export TD_SRC_DIR=$TRAVIS_BUILD_DIR/tdlight-java/dependencies/tdlight
export TD_BIN_DIR=$TRAVIS_BUILD_DIR/tdlight-java/bin-td
export TDNATIVES_BIN_DIR=$TRAVIS_BUILD_DIR/tdlight-java/bin-tdlight
export TDNATIVES_CPP_SRC_DIR=$TRAVIS_BUILD_DIR/tdlight-java/src/tdlib-cpp
export TDNATIVES_DOCS_BIN_DIR=$TRAVIS_BUILD_DIR/tdlight-java/bin-docs
export TD_BUILD_DIR=$TRAVIS_BUILD_DIR/tdlight-java/build-td
export TD_CROSS_BIN_DIR=$TD_SRC_DIR/bin-td-cross
export TDNATIVES_CPP_BUILD_DIR=$TRAVIS_BUILD_DIR/tdlight-java/build-tdlight
export JAVA_SRC_DIR=$TRAVIS_BUILD_DIR/tdlight-java/src/tdlib-java
export TDLIB_SERIALIZER_DIR=$TRAVIS_BUILD_DIR/tdlight-java/dependencies/tdlib-serializer
export MAVEN_OPTS="--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/javax.crypto=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED"
export TRAVIS_CPU_ARCH_STANDARD="$(tr '[:upper:]' '[:lower:]'<<<"${TRAVIS_CPU_ARCH}")"
export TRAVIS_CPU_CORES="2"
TRAVIS_OS_NAME_STANDARD="$(tr '[:upper:]' '[:lower:]'<<<"${TRAVIS_OS_NAME}")"
export TRAVIS_OS_NAME_STANDARD
export TRAVIS_OS_NAME_SHORT="win"
export SRC_TDJNI_LIBNAME="libtdjni.dll"
export DEST_TDJNI_LIBNAME="tdjni.dll"
# ====== OS Variables
TRAVIS_CPU_ARCH_JAVA="$(tr '[:upper:]' '[:lower:]'<<<"${TRAVIS_CPU_ARCH}")"
export TRAVIS_CPU_ARCH_JAVA
export TDLIB_RESOURCES_OUTPUT_DIR="$TRAVIS_OUTPUT_DIR/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD"
# ====== Print variables
echo "TD_SRC_DIR=${TD_SRC_DIR}"
echo "TD_BIN_DIR=${TD_BIN_DIR}"
echo "TDNATIVES_BIN_DIR=${TDNATIVES_BIN_DIR}"
echo "TDNATIVES_CPP_SRC_DIR=${TDNATIVES_CPP_SRC_DIR}"
echo "TDNATIVES_DOCS_BIN_DIR=${TDNATIVES_DOCS_BIN_DIR}"
echo "TD_BUILD_DIR=${TD_BUILD_DIR}"
echo "TD_CROSS_BIN_DIR=${TD_CROSS_BIN_DIR}"
echo "TDNATIVES_CPP_BUILD_DIR=${TDNATIVES_CPP_BUILD_DIR}"
echo "JAVA_SRC_DIR=${JAVA_SRC_DIR}"
echo "TDLIB_SERIALIZER_DIR=${TDLIB_SERIALIZER_DIR}"
echo "PATH=${PATH}"
echo "JAVA_HOME=${JAVA_HOME}"
echo "JAVA_INCLUDE_PATH=${JAVA_INCLUDE_PATH}"
echo "JAVA_INCLUDE_PATH2=${JAVA_INCLUDE_PATH2}"
echo "JAVA_AWT_INCLUDE_PATH=${JAVA_AWT_INCLUDE_PATH}"
echo "VCPKG_DIR=${VCPKG_DIR}"
echo "MAVEN_OPTS=${MAVEN_OPTS}"
echo "TRAVIS_CPU_ARCH=${TRAVIS_CPU_ARCH}"
echo "TRAVIS_CPU_ARCH_JAVA=${TRAVIS_CPU_ARCH_JAVA}"
echo "TRAVIS_CPU_ARCH_STANDARD=${TRAVIS_CPU_ARCH_STANDARD}"
echo "TRAVIS_OS_NAME=${TRAVIS_OS_NAME}"
echo "TRAVIS_OS_NAME_STANDARD=${TRAVIS_OS_NAME_STANDARD}"
echo "TRAVIS_OS_NAME_SHORT=${TRAVIS_OS_NAME_SHORT}"
echo "SRC_TDJNI_LIBNAME=${SRC_TDJNI_LIBNAME}"
echo "DEST_TDJNI_LIBNAME=${DEST_TDJNI_LIBNAME}"
echo "TDLIB_RESOURCES_OUTPUT_DIR=${TDLIB_RESOURCES_OUTPUT_DIR}"
echo "CURRENT DIRECTORY* ($(pwd)):"
ls -alch "$(pwd)"
echo "WORK DIRECTORY CONTENT* (${TRAVIS_BUILD_DIR}):"
ls -alch "$TRAVIS_BUILD_DIR"

View File

@ -0,0 +1,28 @@
#!/bin/bash -e
# ====== Setup environment variables
source ./jenkins/scripts/setup_variables.sh
# ====== Environment setup
[ -d $TD_BUILD_DIR ] || mkdir -p $TD_BUILD_DIR
[ -d $TD_BIN_DIR ] || mkdir -p $TD_BIN_DIR
[ -d $TD_NATIVE_BIN_DIR ] || mkdir -p $TD_NATIVE_BIN_DIR
[ -d $TD_CROSS_BIN_DIR ] || mkdir -p $TD_CROSS_BIN_DIR
[ -d $TDNATIVES_CPP_BUILD_DIR ] || mkdir -p $TDNATIVES_CPP_BUILD_DIR
echo "CCACHE statistics:"
ccache -s
## Fix openssl path
cd $TD_SRC_DIR
#sed -i -e '2i\cmake_policy(SET CMP0074 NEW)\' tdutils/CMakeLists.txt
#sed -i -e '2i\cmake_policy(SET CMP0074 NEW)\' CMakeLists.txt
#sed -i -e '3i\set(OPENSSL_ROOT_DIR /usr/lib/openssl_cross/usr/lib)\' CMakeLists.txt
#sed -i -e '4i\set(OPENSSL_LIBRARIES_DIR /usr/lib/openssl_cross/usr/lib)\' CMakeLists.txt
#sed -i -e '5i\set(OPENSSL_INCLUDE_DIR /usr/lib/openssl_cross/usr/include/openssl)\' CMakeLists.txt
#sed -i -e '6i\set(OPENSSL_CRYPTO_LIBRARY /usr/lib/openssl_cross/usr/lib/libcrypto.so)\' CMakeLists.txt
#sed -i -e '7i\set(OPENSSL_SSL_LIBRARY /usr/lib/openssl_cross/usr/lib/libssl.so)\' CMakeLists.txt
#sed -i -e '8i\set(ZLIB_ROOT /usr/lib/zlib_cross/usr/lib)\' CMakeLists.txt
#sed -i -e '9i\set(ZLIB_LIBRARIES_DIR /usr/lib/zlib_cross/usr/lib)\' CMakeLists.txt
#sed -i -e '10i\set(ZLIB_LIBRARY /usr/lib/zlib_cross/usr/lib/libz.so)\' CMakeLists.txt
#sed -i -e '11i\set(ZLIB_INCLUDE_DIR /usr/lib/zlib_cross/usr/include)\' CMakeLists.txt
#sed -i -e '12i\link_libraries(atomic)\' CMakeLists.txt

6
toolchain-win64.cmake Normal file
View File

@ -0,0 +1,6 @@
SET(CMAKE_SYSTEM_NAME Windows)
SET(CMAKE_CROSSCOMPILING 1)
SET(CMAKE_C_COMPILER /usr/bin/x86_64-w64-mingw32-gcc-posix)
SET(CMAKE_CXX_COMPILER /usr/bin/x86_64-w64-mingw32-g++-posix)
SET(CMAKE_LINKER /usr/bin/x86_64-w64-mingw32-ld-posix)
set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES /usr/lib/gcc/x86_64-w64-mingw32/8.3-posix)