mirror of https://github.com/aminya/setup-cpp
feat: add mingw cross compiler
* add docker mingw tests * add node16 test
This commit is contained in:
parent
ecd2b40e2e
commit
43fd6604a1
|
@ -121,9 +121,14 @@ jobs:
|
||||||
- ubuntu-20.04
|
- ubuntu-20.04
|
||||||
container:
|
container:
|
||||||
- "ubuntu_node.dockerfile"
|
- "ubuntu_node.dockerfile"
|
||||||
|
- "ubuntu_node_16.dockerfile"
|
||||||
|
- "ubuntu_node.mingw.dockerfile"
|
||||||
|
- "ubuntu_22.04_node.dockerfile"
|
||||||
- "ubuntu_20.04_node.dockerfile"
|
- "ubuntu_20.04_node.dockerfile"
|
||||||
- "arch_node.dockerfile"
|
- "arch_node.dockerfile"
|
||||||
|
- "arch_node.mingw.dockerfile"
|
||||||
- "fedora_node.dockerfile"
|
- "fedora_node.dockerfile"
|
||||||
|
- "fedora_node.mingw.dockerfile"
|
||||||
node:
|
node:
|
||||||
- 14
|
- 14
|
||||||
pnpm:
|
pnpm:
|
||||||
|
|
|
@ -83,6 +83,9 @@ words:
|
||||||
- vsversion
|
- vsversion
|
||||||
- xcrun
|
- xcrun
|
||||||
- Yahyaabadi
|
- Yahyaabadi
|
||||||
|
- VCPKG
|
||||||
|
- DVCPKG
|
||||||
|
- SYSROOT
|
||||||
ignoreWords: []
|
ignoreWords: []
|
||||||
import: []
|
import: []
|
||||||
dictionaryDefinitions: []
|
dictionaryDefinitions: []
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
schemaVersion: 2.0.0
|
||||||
|
|
||||||
|
commandTests:
|
||||||
|
- name: mingw c compiler
|
||||||
|
command: $CC
|
||||||
|
args: ["--version"]
|
||||||
|
expectedOutput: [".*x86_64-w64-mingw32-gcc.*"]
|
||||||
|
- name: mingw c++ compiler
|
||||||
|
command: $CXX
|
||||||
|
args: ["--version"]
|
||||||
|
expectedOutput: [".*x86_64-w64-mingw32-g\\+\\+*"]
|
||||||
|
- name: powershell
|
||||||
|
command: pwsh
|
||||||
|
args: ["-Version"]
|
||||||
|
expectedOutput: [".*PowerShell.*"]
|
||||||
|
|
||||||
|
fileExistenceTests:
|
||||||
|
- name: "vcpkg"
|
||||||
|
path: "/root/vcpkg"
|
||||||
|
shouldExist: true
|
||||||
|
- name: "cmake toolchain"
|
||||||
|
path: "/home/cmake/toolchains/x86_64-w64-mingw32.toolchain.cmake"
|
||||||
|
shouldExist: true
|
||||||
|
- name: "cross root"
|
||||||
|
path: "/usr/x86_64-w64-mingw32"
|
||||||
|
shouldExist: true
|
|
@ -29,10 +29,6 @@ commandTests:
|
||||||
command: doxygen
|
command: doxygen
|
||||||
args: ["--version"]
|
args: ["--version"]
|
||||||
expectedOutput: [".*1.*"]
|
expectedOutput: [".*1.*"]
|
||||||
- name: cppcheck
|
|
||||||
command: cppcheck
|
|
||||||
args: ["--version"]
|
|
||||||
expectedOutput: [".*Cppcheck.*"]
|
|
||||||
|
|
||||||
fileExistenceTests:
|
fileExistenceTests:
|
||||||
- name: "vcpkg"
|
- name: "vcpkg"
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
schemaVersion: 2.0.0
|
||||||
|
|
||||||
|
commandTests:
|
||||||
|
- name: mingw c compiler
|
||||||
|
command: $CC
|
||||||
|
args: ["--version"]
|
||||||
|
expectedOutput: [".*x86_64-w64-mingw32-gcc.*"]
|
||||||
|
- name: mingw c++ compiler
|
||||||
|
command: $CXX
|
||||||
|
args: ["--version"]
|
||||||
|
expectedOutput: [".*x86_64-w64-mingw32-cpp.*"]
|
||||||
|
- name: powershell
|
||||||
|
command: pwsh
|
||||||
|
args: ["-Version"]
|
||||||
|
expectedOutput: [".*PowerShell.*"]
|
||||||
|
|
||||||
|
fileExistenceTests:
|
||||||
|
- name: "vcpkg"
|
||||||
|
path: "/root/vcpkg"
|
||||||
|
shouldExist: true
|
||||||
|
- name: "cmake toolchain"
|
||||||
|
path: "/home/cmake/toolchains/x86_64-w64-mingw32.toolchain.cmake"
|
||||||
|
shouldExist: true
|
||||||
|
- name: "cross root"
|
||||||
|
path: "/usr/x86_64-w64-mingw32"
|
||||||
|
shouldExist: true
|
|
@ -0,0 +1,23 @@
|
||||||
|
schemaVersion: 2.0.0
|
||||||
|
|
||||||
|
commandTests:
|
||||||
|
- name: mingw c compiler
|
||||||
|
command: x86_64-w64-mingw32-gcc
|
||||||
|
args: ["--version"]
|
||||||
|
expectedOutput: [".*x86_64-w64-mingw32-gcc.*"]
|
||||||
|
- name: mingw c++ compiler
|
||||||
|
command: x86_64-w64-mingw32-g++
|
||||||
|
args: ["--version"]
|
||||||
|
expectedOutput: [".*x86_64-w64-mingw32-g\\+\\+*"]
|
||||||
|
- name: powershell
|
||||||
|
command: pwsh
|
||||||
|
args: ["-Version"]
|
||||||
|
expectedOutput: [".*PowerShell.*"]
|
||||||
|
|
||||||
|
fileExistenceTests:
|
||||||
|
- name: "vcpkg"
|
||||||
|
path: "/root/vcpkg"
|
||||||
|
shouldExist: true
|
||||||
|
- name: "cross root"
|
||||||
|
path: "/usr/x86_64-w64-mingw32"
|
||||||
|
shouldExist: true
|
|
@ -0,0 +1,51 @@
|
||||||
|
schemaVersion: 2.0.0
|
||||||
|
|
||||||
|
commandTests:
|
||||||
|
- name: gcc compiler
|
||||||
|
command: gcc
|
||||||
|
args: ["--version"]
|
||||||
|
expectedOutput: [".*gcc.*"]
|
||||||
|
- name: g++ compiler
|
||||||
|
command: g++
|
||||||
|
args: ["--version"]
|
||||||
|
expectedOutput: [".*g\\+\\+.*"]
|
||||||
|
- name: make
|
||||||
|
command: make
|
||||||
|
args: ["--version"]
|
||||||
|
expectedOutput: [".*GNU Make.*"]
|
||||||
|
- name: ninja
|
||||||
|
command: /root/ninja/ninja
|
||||||
|
args: ["--version"]
|
||||||
|
expectedOutput: [".*1.*"]
|
||||||
|
- name: gcovr
|
||||||
|
command: gcovr
|
||||||
|
args: ["--version"]
|
||||||
|
expectedOutput: [".*gcovr.*"]
|
||||||
|
- name: ccache
|
||||||
|
command: ccache
|
||||||
|
args: ["--version"]
|
||||||
|
expectedOutput: [".*ccache.*"]
|
||||||
|
- name: doxygen
|
||||||
|
command: doxygen
|
||||||
|
args: ["--version"]
|
||||||
|
expectedOutput: [".*1.*"]
|
||||||
|
- name: cppcheck
|
||||||
|
command: cppcheck
|
||||||
|
args: ["--version"]
|
||||||
|
expectedOutput: [".*Cppcheck.*"]
|
||||||
|
- name: clang
|
||||||
|
command: /root/llvm/bin/clang
|
||||||
|
args: ["--version"]
|
||||||
|
expectedOutput: [".*clang.*"]
|
||||||
|
- name: node
|
||||||
|
command: node
|
||||||
|
args: ["-v"]
|
||||||
|
expectedOutput: [".*v16.*"]
|
||||||
|
|
||||||
|
fileExistenceTests:
|
||||||
|
- name: "vcpkg"
|
||||||
|
path: "/root/vcpkg"
|
||||||
|
shouldExist: true
|
||||||
|
- name: "llvm"
|
||||||
|
path: "/root/llvm"
|
||||||
|
shouldExist: true
|
|
@ -37,6 +37,10 @@ commandTests:
|
||||||
command: /root/llvm/bin/clang
|
command: /root/llvm/bin/clang
|
||||||
args: ["--version"]
|
args: ["--version"]
|
||||||
expectedOutput: [".*clang.*"]
|
expectedOutput: [".*clang.*"]
|
||||||
|
- name: node
|
||||||
|
command: node
|
||||||
|
args: ["-v"]
|
||||||
|
expectedOutput: [".*v12.*"]
|
||||||
|
|
||||||
fileExistenceTests:
|
fileExistenceTests:
|
||||||
- name: "vcpkg"
|
- name: "vcpkg"
|
||||||
|
@ -45,3 +49,9 @@ fileExistenceTests:
|
||||||
- name: "llvm"
|
- name: "llvm"
|
||||||
path: "/root/llvm"
|
path: "/root/llvm"
|
||||||
shouldExist: true
|
shouldExist: true
|
||||||
|
- name: "ninja"
|
||||||
|
path: "/root/ninja"
|
||||||
|
shouldExist: true
|
||||||
|
- name: "cmake"
|
||||||
|
path: "/root/cmake"
|
||||||
|
shouldExist: true
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 467e5baf5e5caff2a6462581f7c2b0ca62d9af8c
|
Subproject commit b10f2e841835b93cee67dff1eb70d6fa5c0ac0cd
|
|
@ -0,0 +1,61 @@
|
||||||
|
## base image
|
||||||
|
FROM archlinux as base
|
||||||
|
|
||||||
|
RUN pacman -Syuu --noconfirm
|
||||||
|
RUN pacman-db-upgrade
|
||||||
|
|
||||||
|
# yay for AUR installs
|
||||||
|
RUN pacman -S --noconfirm --needed git base-devel
|
||||||
|
## can't run makepkg as root, "ERROR: Running makepkg as root is not allowed as it can cause permanent, catastrophic damage to your system."
|
||||||
|
## add new user
|
||||||
|
RUN useradd -m -G nobody -s /bin/bash yay && passwd -d yay && echo "yay ALL=(ALL) ALL" >> /etc/sudoers
|
||||||
|
RUN git clone --depth 1 https://aur.archlinux.org/yay.git /opt/yay && \
|
||||||
|
chown -R yay:root /opt/yay && chmod -R 775 /opt/yay
|
||||||
|
USER yay
|
||||||
|
RUN cd /opt/yay && makepkg -si --noprogressbar --noconfirm
|
||||||
|
USER root
|
||||||
|
RUN rm -rf /tmp/yay
|
||||||
|
|
||||||
|
# nodejs
|
||||||
|
RUN pacman -S --noconfirm --needed nodejs
|
||||||
|
|
||||||
|
# curl for downloading setup-cpp
|
||||||
|
RUN pacman -S --noconfirm --needed curl
|
||||||
|
|
||||||
|
# add setup_cpp.js
|
||||||
|
COPY "./dist/node12" "/"
|
||||||
|
WORKDIR "/"
|
||||||
|
|
||||||
|
# run installation
|
||||||
|
RUN node ./setup_cpp.js --cmake true --ninja true --ccache true --vcpkg true --doxygen true --gcovr true --task true
|
||||||
|
## ERROR: Running makepkg as root is not allowed as it can cause permanent,
|
||||||
|
## Error: Command failed with exit code 1: sudo 'yay' '-S' '--noconfirm' 'powershell-bin'
|
||||||
|
## need to run this as yay-user so I can install powershell and mingw
|
||||||
|
USER yay
|
||||||
|
RUN node ./setup_cpp.js --compiler mingw --powershell true
|
||||||
|
USER root
|
||||||
|
|
||||||
|
# clean up
|
||||||
|
RUN pacman -Scc --noconfirm
|
||||||
|
RUN rm -rf /tmp/*
|
||||||
|
|
||||||
|
CMD source ~/.cpprc
|
||||||
|
ENTRYPOINT [ "/bin/bash" ]
|
||||||
|
|
||||||
|
## setup vcpkg env. (triplets)
|
||||||
|
## https://github.com/microsoft/vcpkg/blob/master/docs/users/mingw.md
|
||||||
|
ENV VCPKG_DEFAULT_HOST_TRIPLET "x64-linux"
|
||||||
|
ENV VCPKG_DEFAULT_TRIPLET "x64-mingw-dynamic"
|
||||||
|
ENV CC "x86_64-w64-mingw32-gcc"
|
||||||
|
ENV CXX "x86_64-w64-mingw32-g++"
|
||||||
|
|
||||||
|
# TODO: better setup for cmake toolchains ?
|
||||||
|
COPY ./dev/cmake/x86_64-w64-mingw32.toolchain.cmake /home/cmake/toolchains/x86_64-w64-mingw32.toolchain.cmake
|
||||||
|
|
||||||
|
#### Building
|
||||||
|
FROM base AS builder
|
||||||
|
COPY ./dev/cpp_vcpkg_project /home/app
|
||||||
|
WORKDIR /home/app
|
||||||
|
RUN bash -c 'source ~/.cpprc \
|
||||||
|
&& task cross_build_mingw'
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
## base image
|
||||||
|
FROM fedora as base
|
||||||
|
|
||||||
|
# nodejs
|
||||||
|
RUN dnf -y install nodejs
|
||||||
|
|
||||||
|
# curl for downloading setup-cpp
|
||||||
|
RUN dnf -y install curl
|
||||||
|
|
||||||
|
# add setup_cpp.js
|
||||||
|
COPY "./dist/node12" "/"
|
||||||
|
WORKDIR "/"
|
||||||
|
|
||||||
|
# run installation
|
||||||
|
RUN node ./setup_cpp.js --compiler mingw --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true --powershell true
|
||||||
|
|
||||||
|
# clean up
|
||||||
|
RUN rm -rf /tmp/*
|
||||||
|
|
||||||
|
CMD source ~/.cpprc
|
||||||
|
ENTRYPOINT [ "/bin/bash" ]
|
||||||
|
|
||||||
|
## setup vcpkg env. (triplets)
|
||||||
|
## https://github.com/microsoft/vcpkg/blob/master/docs/users/mingw.md
|
||||||
|
ENV VCPKG_DEFAULT_HOST_TRIPLET "x64-linux"
|
||||||
|
ENV VCPKG_DEFAULT_TRIPLET "x64-mingw-dynamic"
|
||||||
|
ENV CC "x86_64-w64-mingw32-gcc"
|
||||||
|
ENV CXX "x86_64-w64-mingw32-cpp"
|
||||||
|
|
||||||
|
# TODO: better setup for cmake toolchains ?
|
||||||
|
COPY ./dev/cmake/x86_64-w64-mingw32.toolchain.cmake /home/cmake/toolchains/x86_64-w64-mingw32.toolchain.cmake
|
||||||
|
|
||||||
|
#### Building
|
||||||
|
FROM base AS builder
|
||||||
|
COPY ./dev/cpp_vcpkg_project /home/app
|
||||||
|
WORKDIR /home/app
|
||||||
|
RUN bash -c 'source ~/.cpprc \
|
||||||
|
&& task cross_build_mingw'
|
|
@ -0,0 +1,37 @@
|
||||||
|
FROM ubuntu:22.04 AS base
|
||||||
|
|
||||||
|
# set time-zone
|
||||||
|
ENV TZ=Canada/Pacific
|
||||||
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||||
|
|
||||||
|
# The nodejs that ships on ubuntu:20.04 servers is too old.
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
RUN apt-get update -qq
|
||||||
|
RUN apt-get install -y --no-install-recommends curl gnupg ca-certificates
|
||||||
|
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
|
||||||
|
RUN apt-get install -y --no-install-recommends nodejs
|
||||||
|
|
||||||
|
# add setup_cpp.js
|
||||||
|
COPY "./dist/node12" "/"
|
||||||
|
WORKDIR "/"
|
||||||
|
|
||||||
|
# run installation
|
||||||
|
RUN node ./setup_cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true
|
||||||
|
|
||||||
|
CMD source ~/.cpprc
|
||||||
|
ENTRYPOINT [ "/bin/bash" ]
|
||||||
|
|
||||||
|
#### Building
|
||||||
|
FROM base AS builder
|
||||||
|
ADD ./dev/cpp_vcpkg_project /home/app
|
||||||
|
WORKDIR /home/app
|
||||||
|
RUN bash -c 'source ~/.cpprc \
|
||||||
|
&& task build'
|
||||||
|
|
||||||
|
### Running environment
|
||||||
|
# use a distroless image or ubuntu:20.04 if you wish
|
||||||
|
FROM gcr.io/distroless/cc
|
||||||
|
# copy the built binaries and their runtime dependencies
|
||||||
|
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
|
||||||
|
WORKDIR /home/app/
|
||||||
|
ENTRYPOINT ["./my_exe"]
|
|
@ -0,0 +1,33 @@
|
||||||
|
FROM ubuntu:22.04 AS base
|
||||||
|
|
||||||
|
RUN apt-get update -qq
|
||||||
|
RUN apt-get install -y --no-install-recommends nodejs
|
||||||
|
|
||||||
|
# add setup_cpp.js
|
||||||
|
COPY "./dist/node12" "/"
|
||||||
|
WORKDIR "/"
|
||||||
|
|
||||||
|
# run installation
|
||||||
|
RUN node ./setup_cpp.js --compiler mingw --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true --powershell true
|
||||||
|
|
||||||
|
# clean up
|
||||||
|
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||||
|
RUN rm -rf /tmp/*
|
||||||
|
|
||||||
|
CMD source ~/.cpprc
|
||||||
|
ENTRYPOINT [ "/bin/bash" ]
|
||||||
|
|
||||||
|
## setup vcpkg env. (triplets)
|
||||||
|
## https://github.com/microsoft/vcpkg/blob/master/docs/users/mingw.md
|
||||||
|
#ENV VCPKG_DEFAULT_HOST_TRIPLET "x64-linux"
|
||||||
|
#ENV VCPKG_DEFAULT_TRIPLET "x64-mingw-dynamic"
|
||||||
|
#ENV CC "x86_64-w64-mingw32-gcc"
|
||||||
|
#ENV CXX "x86_64-w64-mingw32-g++"
|
||||||
|
## use project_options cross-compiling to setup triplets ...
|
||||||
|
|
||||||
|
#### Building
|
||||||
|
FROM base AS builder
|
||||||
|
COPY ./dev/cpp_vcpkg_project /home/app
|
||||||
|
WORKDIR /home/app
|
||||||
|
RUN bash -c 'source ~/.cpprc \
|
||||||
|
&& task build_cross_mingw'
|
|
@ -0,0 +1,38 @@
|
||||||
|
FROM ubuntu:22.04 AS base
|
||||||
|
|
||||||
|
RUN apt-get update -qq && apt-get install -y \
|
||||||
|
curl \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
RUN curl -s https://deb.nodesource.com/setup_16.x | bash
|
||||||
|
|
||||||
|
RUN apt-get update -qq
|
||||||
|
RUN apt-get install -y --no-install-recommends nodejs
|
||||||
|
|
||||||
|
# add setup_cpp.js
|
||||||
|
COPY "./dist/node16" "/"
|
||||||
|
WORKDIR "/"
|
||||||
|
|
||||||
|
# run installation
|
||||||
|
RUN node ./setup_cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true --powershell true
|
||||||
|
|
||||||
|
# clean up
|
||||||
|
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||||
|
RUN rm -rf /tmp/*
|
||||||
|
|
||||||
|
CMD source ~/.cpprc
|
||||||
|
ENTRYPOINT [ "/bin/bash" ]
|
||||||
|
|
||||||
|
#### Building
|
||||||
|
FROM base AS builder
|
||||||
|
COPY ./dev/cpp_vcpkg_project /home/app
|
||||||
|
WORKDIR /home/app
|
||||||
|
RUN bash -c 'source ~/.cpprc \
|
||||||
|
&& task build'
|
||||||
|
|
||||||
|
### Running environment
|
||||||
|
# use a distroless image or ubuntu:22.04 if you wish
|
||||||
|
FROM gcr.io/distroless/cc
|
||||||
|
# copy the built binaries and their runtime dependencies
|
||||||
|
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
|
||||||
|
WORKDIR /home/app/
|
||||||
|
ENTRYPOINT ["./my_exe"]
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
11
package.json
11
package.json
|
@ -19,8 +19,12 @@
|
||||||
"build": "shx rm -rf dist/ && shx mkdir -p ./dist/node12 ./dist/node16 && run-p lint.tsc build.parcel copy.matchers",
|
"build": "shx rm -rf dist/ && shx mkdir -p ./dist/node12 ./dist/node16 && run-p lint.tsc build.parcel copy.matchers",
|
||||||
"build.docker": "pnpm build && docker build -f ./dev/docker/ubuntu_node.dockerfile -t setup_cpp .",
|
"build.docker": "pnpm build && docker build -f ./dev/docker/ubuntu_node.dockerfile -t setup_cpp .",
|
||||||
"build.docker.arch": "pnpm build && docker build -f ./dev/docker/arch_node.dockerfile -t setup_cpp:arch .",
|
"build.docker.arch": "pnpm build && docker build -f ./dev/docker/arch_node.dockerfile -t setup_cpp:arch .",
|
||||||
|
"build.docker.arch.mingw": "pnpm build && docker build -f ./dev/docker/arch_node.mingw.dockerfile -t setup_cpp:arch-mingw .",
|
||||||
"build.docker.fedora": "pnpm build && docker build -f ./dev/docker/fedora_node.dockerfile -t setup_cpp:fedora .",
|
"build.docker.fedora": "pnpm build && docker build -f ./dev/docker/fedora_node.dockerfile -t setup_cpp:fedora .",
|
||||||
|
"build.docker.fedora.mingw": "pnpm build && docker build -f ./dev/docker/fedora_node.mingw.dockerfile -t setup_cpp:fedora-mingw .",
|
||||||
"build.docker.ubuntu": "pnpm build && docker build -f ./dev/docker/ubuntu_node.dockerfile -t setup_cpp:ubuntu .",
|
"build.docker.ubuntu": "pnpm build && docker build -f ./dev/docker/ubuntu_node.dockerfile -t setup_cpp:ubuntu .",
|
||||||
|
"build.docker.ubuntu.mingw": "pnpm build && docker build -f ./dev/docker/ubuntu_node.mingw.dockerfile -t setup_cpp:ubuntu-mingw .",
|
||||||
|
"build.docker.ubuntu.node16": "pnpm build && docker build -f ./dev/docker/ubuntu_node_16.dockerfile -t setup_cpp:ubuntu-node16 .",
|
||||||
"build.parcel": "cross-env NODE_ENV=production parcel build",
|
"build.parcel": "cross-env NODE_ENV=production parcel build",
|
||||||
"bump": "ncu -u -x execa,numerous,path-exists && pnpm update",
|
"bump": "ncu -u -x execa,numerous,path-exists && pnpm update",
|
||||||
"clean": "shx rm -rf .parcel-cache dist exe",
|
"clean": "shx rm -rf .parcel-cache dist exe",
|
||||||
|
@ -37,12 +41,19 @@
|
||||||
"prepare": "pnpm run -r build && pnpm run -w build",
|
"prepare": "pnpm run -r build && pnpm run -w build",
|
||||||
"start.docker": "docker run -t setup_cpp .",
|
"start.docker": "docker run -t setup_cpp .",
|
||||||
"start.docker.arch": "docker run -t setup_cpp:arch .",
|
"start.docker.arch": "docker run -t setup_cpp:arch .",
|
||||||
|
"start.docker.arch.mingw": "docker run -t setup_cpp:arch-mingw .",
|
||||||
"start.docker.fedora": "docker run -t setup_cpp:fedora .",
|
"start.docker.fedora": "docker run -t setup_cpp:fedora .",
|
||||||
|
"start.docker.fedora.mingw": "docker run -t setup_cpp:fedora-mingw .",
|
||||||
"start.docker.ubuntu": "docker run -t setup_cpp:ubuntu .",
|
"start.docker.ubuntu": "docker run -t setup_cpp:ubuntu .",
|
||||||
|
"start.docker.ubuntu.mingw": "docker run -t setup_cpp:ubuntu-mingw .",
|
||||||
"test": "run-p --continue-on-error test.lint test.unit",
|
"test": "run-p --continue-on-error test.lint test.unit",
|
||||||
"test.docker.arch": "docker build -f ./dev/docker/arch_node.dockerfile --target base -t setup_cpp:arch-base . && container-structure-test test --image setup_cpp:arch-base --config ./dev/container-tests/arch.yml",
|
"test.docker.arch": "docker build -f ./dev/docker/arch_node.dockerfile --target base -t setup_cpp:arch-base . && container-structure-test test --image setup_cpp:arch-base --config ./dev/container-tests/arch.yml",
|
||||||
|
"test.docker.arch.mingw": "docker build -f ./dev/docker/arch_node.mingw.dockerfile --target base -t setup_cpp:arch-mingw . && container-structure-test test --image setup_cpp:arch-mingw --config ./dev/container-tests/arch.mingw.yml",
|
||||||
"test.docker.fedora": "docker build -f ./dev/docker/fedora_node.dockerfile --target base -t setup_cpp:fedora-base . && container-structure-test test --image setup_cpp:fedora-base --config ./dev/container-tests/fedora.yml",
|
"test.docker.fedora": "docker build -f ./dev/docker/fedora_node.dockerfile --target base -t setup_cpp:fedora-base . && container-structure-test test --image setup_cpp:fedora-base --config ./dev/container-tests/fedora.yml",
|
||||||
|
"test.docker.fedora.mingw": "docker build -f ./dev/docker/fedora_node.mingw.dockerfile --target base -t setup_cpp:fedora-mingw . && container-structure-test test --image setup_cpp:fedora-mingw --config ./dev/container-tests/fedora.mingw.yml",
|
||||||
"test.docker.ubuntu": "docker build -f ./dev/docker/ubuntu_node.dockerfile --target base -t setup_cpp:ubuntu-base . && container-structure-test test --image setup_cpp:ubuntu-base --config ./dev/container-tests/ubuntu.yml",
|
"test.docker.ubuntu": "docker build -f ./dev/docker/ubuntu_node.dockerfile --target base -t setup_cpp:ubuntu-base . && container-structure-test test --image setup_cpp:ubuntu-base --config ./dev/container-tests/ubuntu.yml",
|
||||||
|
"test.docker.ubuntu.mingw": "docker build -f ./dev/docker/ubuntu_node.mingw.dockerfile --target base -t setup_cpp:ubuntu-mingw . && container-structure-test test --image setup_cpp:ubuntu-mingw --config ./dev/container-tests/ubuntu.mingw.yml",
|
||||||
|
"test.docker.ubuntu.node16": "docker build -f ./dev/docker/ubuntu_node_16.dockerfile --target base -t setup_cpp:ubuntu-node16 . && container-structure-test test --image setup_cpp:ubuntu-node16 --config ./dev/container-tests/ubuntu.node16.yml",
|
||||||
"test.lint": "run-p --aggregate-output --continue-on-error lint.cspell test.lint.eslint test.lint.prettier lint.tsc",
|
"test.lint": "run-p --aggregate-output --continue-on-error lint.cspell test.lint.eslint test.lint.prettier lint.tsc",
|
||||||
"test.lint.eslint": "eslint **/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml} --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/",
|
"test.lint.eslint": "eslint **/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml} --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/",
|
||||||
"test.lint.prettier": "prettier . --check",
|
"test.lint.prettier": "prettier . --check",
|
||||||
|
|
|
@ -133,6 +133,52 @@ export async function setupGcc(version: string, setupDir: string, arch: string)
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
export async function setupMingw(version: string, setupDir: string, arch: string) {
|
||||||
|
let installationInfo: InstallationInfo | undefined
|
||||||
|
switch (process.platform) {
|
||||||
|
case "win32": {
|
||||||
|
if (arch === "arm" || arch === "arm64") {
|
||||||
|
await setupChocoPack("gcc-arm-embedded", version)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
installationInfo = await setupBin("g++", version, getGccPackageInfo, setupDir, arch)
|
||||||
|
} catch (err) {
|
||||||
|
info(`Failed to download g++ binary. ${err}. Falling back to chocolatey.`)
|
||||||
|
installationInfo = await setupChocoMingw(version, arch)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
case "linux": {
|
||||||
|
if (arch === "x64" || arch === "x32") {
|
||||||
|
if (isArch()) {
|
||||||
|
return setupPacmanPack("mingw-w64", version, "yay")
|
||||||
|
} else if (hasDnf()) {
|
||||||
|
return setupDnfPack("mingw64-gcc", version)
|
||||||
|
} else if (isUbuntu()) {
|
||||||
|
installationInfo = await setupAptPack([
|
||||||
|
{ name: "mingw-w64", version, repositories: ["ppa:ubuntu-toolchain-r/test"] },
|
||||||
|
])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
throw new Error(`Unsupported platform for ${arch}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (installationInfo !== undefined) {
|
||||||
|
// TODO: setup alternatives and update CC/CXX env. ?
|
||||||
|
//Setting up g++-mingw-w64-i686-win32 (10.3.0-14ubuntu1+24.3) ...
|
||||||
|
// update-alternatives: using /usr/bin/i686-w64-mingw32-g++-win32 to provide /usr/bin/i686-w64-mingw32-g++ (i686-w64-mingw32-g++) in auto mode
|
||||||
|
//Setting up g++-mingw-w64-x86-64-win32 (10.3.0-14ubuntu1+24.3) ...
|
||||||
|
// update-alternatives: using /usr/bin/x86_64-w64-mingw32-g++-win32 to provide /usr/bin/x86_64-w64-mingw32-g++ (x86_64-w64-mingw32-g++) in auto mode
|
||||||
|
//await activateGcc(version, installationInfo.binDir)
|
||||||
|
return installationInfo
|
||||||
|
}
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
async function setupChocoMingw(version: string, arch: string): Promise<InstallationInfo | undefined> {
|
async function setupChocoMingw(version: string, arch: string): Promise<InstallationInfo | undefined> {
|
||||||
await setupChocoPack("mingw", version)
|
await setupChocoPack("mingw", version)
|
||||||
let binDir: string | undefined
|
let binDir: string | undefined
|
||||||
|
|
10
src/main.ts
10
src/main.ts
|
@ -32,7 +32,7 @@ import { ubuntuVersion } from "./utils/env/ubuntu_version"
|
||||||
|
|
||||||
import semverValid from "semver/functions/valid"
|
import semverValid from "semver/functions/valid"
|
||||||
import { getVersion, syncVersions } from "./versions/versions"
|
import { getVersion, syncVersions } from "./versions/versions"
|
||||||
import { setupGcc } from "./gcc/gcc"
|
import { setupGcc, setupMingw } from "./gcc/gcc"
|
||||||
import { InstallationInfo } from "./utils/setup/setupBin"
|
import { InstallationInfo } from "./utils/setup/setupBin"
|
||||||
import { error, info, success, warning } from "ci-log"
|
import { error, info, success, warning } from "ci-log"
|
||||||
import { setupVcpkg } from "./vcpkg/vcpkg"
|
import { setupVcpkg } from "./vcpkg/vcpkg"
|
||||||
|
@ -63,6 +63,7 @@ const setups = {
|
||||||
opencppcoverage: setupOpencppcoverage,
|
opencppcoverage: setupOpencppcoverage,
|
||||||
llvm: setupLLVM,
|
llvm: setupLLVM,
|
||||||
gcc: setupGcc,
|
gcc: setupGcc,
|
||||||
|
mingw: setupMingw,
|
||||||
choco: setupChocolatey,
|
choco: setupChocolatey,
|
||||||
brew: setupBrew,
|
brew: setupBrew,
|
||||||
powershell: setupPowershell,
|
powershell: setupPowershell,
|
||||||
|
@ -210,7 +211,6 @@ export async function main(args: string[]): Promise<number> {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case "gcc":
|
case "gcc":
|
||||||
case "mingw":
|
|
||||||
case "cygwin":
|
case "cygwin":
|
||||||
case "msys": {
|
case "msys": {
|
||||||
const gccVersion = getVersion("gcc", version, osVersion)
|
const gccVersion = getVersion("gcc", version, osVersion)
|
||||||
|
@ -226,6 +226,12 @@ export async function main(args: string[]): Promise<number> {
|
||||||
successMessages.push(getSuccessMessage("gcc", installationInfo))
|
successMessages.push(getSuccessMessage("gcc", installationInfo))
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
case "mingw": {
|
||||||
|
const mingwVersion = getVersion("mingw", version, osVersion)
|
||||||
|
const installationInfo = await setupMingw(mingwVersion, join(setupCppDir, "gcc"), arch)
|
||||||
|
successMessages.push(getSuccessMessage("mingw", installationInfo))
|
||||||
|
break
|
||||||
|
}
|
||||||
case "cl":
|
case "cl":
|
||||||
case "msvc":
|
case "msvc":
|
||||||
case "msbuild":
|
case "msbuild":
|
||||||
|
|
|
@ -18,7 +18,7 @@ export function setupPacmanPack(name: string, version?: string, aur?: string): I
|
||||||
didUpdate = true
|
didUpdate = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!didInit) {
|
if (!didInit && aur != "yay") {
|
||||||
// install base-devel
|
// install base-devel
|
||||||
execRootSync(pacman, ["-S", "--noconfirm", "base-devel"])
|
execRootSync(pacman, ["-S", "--noconfirm", "base-devel"])
|
||||||
didInit = true
|
didInit = true
|
||||||
|
|
Loading…
Reference in New Issue