feature add mingw

This commit is contained in:
tqcq 2023-12-03 08:09:34 +08:00
parent 41663e1c2f
commit 07b150c166
5 changed files with 36 additions and 7 deletions

View File

@ -10,11 +10,7 @@ jobs:
- Debug - Debug
- Release - Release
toolchain: toolchain:
- hisiv500.toolchain.cmake - mingw-w64-x86_64.toolchain.cmake
- himix200.toolchain.cmake
- mips64el-linux-gnuabi64.toolchain.cmake
- mipsel-openwrt-linux-musl.toolchain.cmake
- mipsel-openwrt-linux.toolchain.cmake
- host.toolchain.cmake - host.toolchain.cmake
steps: steps:
- name: Install Dependencies - name: Install Dependencies
@ -29,3 +25,17 @@ jobs:
cd ${{ github.workspace }}/src/grammar cd ${{ github.workspace }}/src/grammar
java -jar antlr.jar -Dlanguage=Cpp -o ./ ProtoLexer.g4 java -jar antlr.jar -Dlanguage=Cpp -o ./ ProtoLexer.g4
java -jar antlr.jar -Dlanguage=Cpp -o ./ ProtoParser.g4 java -jar antlr.jar -Dlanguage=Cpp -o ./ ProtoParser.g4
- name: Configure CRPC
run: |
cd ${{ github.workspace }}
cmake . -Bbuild -DCMAKE_TOOLCHAIN_FILE=toolchains/${{ matrix.toolchain }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_VERBOSE_MAKEFILE=ON
- name: Build CRPC
run: |
cmake --build build --config ${{ matrix.build_type }} --target all -- -j `nproc`
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: crpc-${{ matrix.toolchain }}-${{ matrix.build_type }}
path: ${{ github.workspace }}/build/crpc

View File

@ -30,6 +30,9 @@ FILE(GLOB_RECURSE TEST_SRC_LIST ${CMAKE_CURRENT_BINARY_DIR}/grammar/*.c)
add_executable(test ${TEST_SRC_LIST} add_executable(test ${TEST_SRC_LIST}
test/test.c test/test.c
) )
target_include_directories(test PRIVATE target_include_directories(test PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/3party/tpl ${CMAKE_CURRENT_SOURCE_DIR}/3party/tpl
) )
INSTALL(TARGETS crpc DESTINATION bin)

View File

@ -2,7 +2,6 @@
#include <ostream> #include <ostream>
#include "antlr4-runtime.h" #include "antlr4-runtime.h"
#include "ProtoParserBaseListener.h" #include "ProtoParserBaseListener.h"
#include "ProtoParserBaseVisitor.h"
#include "ProtoLexer.h" #include "ProtoLexer.h"
#include "ProtoParser.h" #include "ProtoParser.h"
#include "message.h" #include "message.h"

View File

View File

@ -0,0 +1,17 @@
set(CMAKE_SYSTEM_NAME Windows)
set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)
set(CMAKE_CROSSCOMPILING TRUE)
# cross compilers to use for C, C++ and Fortran
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran)
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
# target environment on the build host system
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
# modify default behavior of FIND_XXX() commands
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)