pok3r-custom / pok3rtool

Command line tool and library for keyboards using qmk-pok3r
BSD 3-Clause "New" or "Revised" License
41 stars 7 forks source link

[MSYS2/MinGW] Statically link libgcc and libstdc++ #11

Open hansemro opened 1 year ago

hansemro commented 1 year ago

This commit fixes a build step for MSYS2/QMK_MSYS with MinGW-w64 toolchain by statically linking libgcc and libstdc++ (instead of copying from invalid path).

The previous method of locating libraries in reference to CMAKE_CXX_COMPILER does not work in MSYS2 environments (with mingw-w64-x86_64-toolchain toolchain package installed).

Previous method expected to find libraries in: /path_with_cxx_compiler/../x86_64-w64-mingw32/lib/

For reference, required libraries in MSYS2 (MinGW-w64) are located in: /mingw64/bin/

Install guide for Windows (with this commit):

  1. Install MSYS2 from https://www.msys2.org/
  2. Launch MSYS2 MINGW64 console and run the following:
    pacman -Syu
    pacman -S cmake \
        base-devel \
        mingw-w64-x86_64-toolchain \
        mingw-w64-x86_64-cmake \
        git
  3. Clone repo and build pok3rtool as normal
    git clone --recursive <pok3rtool_repo>
    cd pok3rtool
    mkdir build
    cd build
    cmake ..
    # build pok3rtool executable
    cmake --build .
    # optionally install to C:\Program Files (x86)\Pok3rtool\
    cmake --install .