diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..dd84ea7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..bbcbbe7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..1716d18 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,62 @@ +name: CodeQL Advanced + +on: + push: + branches: + - 'develop' + paths: + - 'XEngine_Source/**' + - 'XEngine_Release/**' + - '.github/**' + +jobs: + analyze: + runs-on: ubuntu-24.04 + permissions: + security-events: write + packages: read + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: c-cpp + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: 'develop' + + - name: Checkout dependency repository (xengine) + uses: actions/checkout@v4 + with: + repository: libxengine/libxengine + path: libxengine + + - name: sub module checkout (opensource) + run: | + git submodule init + git submodule update + + - name: Set up Dependency Environment + run: | + cd libxengine + chmod +x ./XEngine_LINEnv.sh + sudo ./XEngine_LINEnv.sh -i 3 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + + - name: make + run: | + cd XEngine_Source + make + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{ matrix.language }}" diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml new file mode 100644 index 0000000..279b03f --- /dev/null +++ b/.github/workflows/cppcheck.yml @@ -0,0 +1,35 @@ +name: cpp check workflows + +on: + push: + branches: + - 'develop' + paths: + - 'XEngine_Source/**' + - 'XEngine_Release/**' + - '.github/**' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout main repository code + uses: actions/checkout@v4 + with: + ref: 'develop' + + - name: Create static_analysis directory + run: mkdir -p static_analysis + + - name: Run Cppcheck + run: | + sudo apt-get install -y cppcheck + cppcheck --enable=all --language=c++ --std=c++20 ./XEngine_Source/ --output-file=static_analysis/log.xml --xml + continue-on-error: true + + - name: Upload Cppcheck Results + uses: actions/upload-artifact@v4 + with: + name: cppcheck_results + path: static_analysis/log.xml \ No newline at end of file diff --git a/.github/workflows/issue-translator.yml b/.github/workflows/issue-translator.yml new file mode 100644 index 0000000..424f3d1 --- /dev/null +++ b/.github/workflows/issue-translator.yml @@ -0,0 +1,15 @@ +name: Issue Translator +on: + issue_comment: + types: [created] + issues: + types: [opened] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: usthe/issues-translate-action@v2.7 + with: + IS_MODIFY_TITLE: true + CUSTOM_BOT_NOTE: Bot detected the issue body's language is not English, translate it automatically. \ No newline at end of file diff --git a/.github/workflows/macbuild.yml b/.github/workflows/macbuild.yml new file mode 100644 index 0000000..cfaf29c --- /dev/null +++ b/.github/workflows/macbuild.yml @@ -0,0 +1,71 @@ +name: macos build workflows + +on: + push: + branches: + - 'master' + - 'actions' + +jobs: + build: + strategy: + matrix: + include: + - os: macos-13 + - os: macos-14 + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout main repository code + uses: actions/checkout@v4 + + # 检出依赖的xengine仓库到指定的xengine目录 + - name: Checkout dependency repository (xengine) + uses: actions/checkout@v4 + with: + repository: libxengine/libxengine + path: libxengine + + - name: brew install + run: | + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + brew install sdl2 + + - name: Set up Dependency x86_64 Environment + if: matrix.os == 'macos-13' + run: | + cd libxengine + chmod 777 * + ./XEngine_LINEnv.sh -i 3 + - name: Set up Dependency Arm64 Environment + if: matrix.os == 'macos-14' + run: | + cd libxengine + chmod 777 * + ./XEngine_LINEnv.sh -i 0 + + latest_tag=$(git ls-remote --tags --sort="v:refname" https://github.com/libxengine/libxengine.git | awk '{print $2}' | sed 's/refs\/tags\///' | tail -n 1) + + wget https://github.com/libxengine/libxengine/releases/download/$latest_tag/XEngine_Mac_Arm64.zip + unzip ./XEngine_Mac_Arm64.zip -d ./XEngine_Mac_Arm64 + cd XEngine_Mac_Arm64 + + sudo mkdir -p /usr/local/include + sudo mkdir -p /usr/local/lib + sudo cp -rf ./XEngine_Include /usr/local/include + sudo find ./XEngine_Mac -name "*.dylib" -exec cp {} /usr/local/lib \; + + - name: make + run: | + cd XEngine_Module + cd jsoncpp + make PLATFORM=mac + cd .. + cd tinyxml2 + make PLATFORM=mac + cd .. + cd XEngine_InfoReport + make PLATFORM=mac + cd .. + cd XEngine_AVPlayer + make PLATFORM=mac \ No newline at end of file diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml new file mode 100644 index 0000000..75d3208 --- /dev/null +++ b/.github/workflows/msbuild.yml @@ -0,0 +1,79 @@ +name: windows build workflows + +on: + push: + branches: + - 'master' + - 'actions' + +jobs: + build: + strategy: + fail-fast: false + matrix: + configuration: [Debug ,Release] + platform: [x86 ,x64] + + runs-on: windows-latest # 最新的 Windows 环境 + + steps: + # 检出您的主仓库代码 + - name: Checkout main repository code + uses: actions/checkout@v4 + + # 检出依赖的xengine仓库到指定的xengine目录 + - name: Checkout dependency repository (xengine) + uses: actions/checkout@v4 + with: + repository: libxengine/libxengine + path: libxengine + + - name: vcpkg dependency repository + uses: actions/checkout@v4 + with: + repository: microsoft/vcpkg + path: vcpkg + + - name: vcpkg install (x86) + if: matrix.platform == 'x86' + run: | + cd vcpkg + ./bootstrap-vcpkg.bat + ./vcpkg.exe install sdl2:x86-windows + ./vcpkg.exe integrate install + shell: pwsh + - name: vcpkg install (x64) + if: matrix.platform == 'x64' + run: | + cd vcpkg + ./bootstrap-vcpkg.bat + ./vcpkg.exe install sdl2:x64-windows + ./vcpkg.exe integrate install + shell: pwsh + + - name: Set up Dependency x86_64 Environment + if: matrix.platform == 'x64' + run: | + echo "XENGINE_INCLUDE=${{ github.workspace }}/libxengine" | Out-File -FilePath $env:GITHUB_ENV -Append + echo "XENGINE_LIB64=${{ github.workspace }}/libxengine/XEngine_Windows" | Out-File -FilePath $env:GITHUB_ENV -Append + shell: pwsh + - name: Set up Dependency x86_32 Environment + if: matrix.platform == 'x86' + run: | + $response = Invoke-RestMethod -Uri "https://api.github.com/repos/libxengine/libxengine/releases/latest" -Headers @{"Accept"="application/vnd.github.v3+json"} + $latest_tag = $response.tag_name + Write-Host "Latest Tag: $latest_tag" + + $url = "https://github.com/libxengine/libxengine/releases/download/$latest_tag/XEngine_Windows_x86-32.zip" + Invoke-WebRequest -Uri $url -OutFile "XEngine_Windows_x86-32.zip" + Expand-Archive -Path ./XEngine_Windows_x86-32.zip -DestinationPath ./XEngine_Windows -Force + + echo "XENGINE_INCLUDE=${{ github.workspace }}/XEngine_Windows" | Out-File -FilePath $env:GITHUB_ENV -Append + echo "XENGINE_LIB32=${{ github.workspace }}/XEngine_Windows/XEngine_Windows" | Out-File -FilePath $env:GITHUB_ENV -Append + shell: pwsh + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v2 + + - name: Build Solution + run: msbuild XEngine.sln /p:Configuration=${{ matrix.configuration }} /p:Platform=${{ matrix.platform }} \ No newline at end of file diff --git a/.github/workflows/ubuntubuild.yml b/.github/workflows/ubuntubuild.yml new file mode 100644 index 0000000..18769f3 --- /dev/null +++ b/.github/workflows/ubuntubuild.yml @@ -0,0 +1,69 @@ +name: ubuntu build workflows + +on: + push: + branches: + - 'master' + - 'actions' + +jobs: + build: + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-22.04 + - os: ubuntu-24.04 + runs-on: ${{ matrix.os }} + + steps: + # 检出您的主仓库代码 + - name: Checkout main repository code + uses: actions/checkout@v4 + + # 检出依赖的xengine仓库到指定的xengine目录 + - name: Checkout dependency repository (xengine) + uses: actions/checkout@v4 + with: + repository: libxengine/libxengine + path: libxengine + + - name: install apt library + run: sudo apt install libsdl2-dev + + - name: Set up Dependency ubuntu24.04 Environment + if: matrix.os == 'ubuntu-24.04' + run: | + cd libxengine + chmod 777 * + sudo ./XEngine_LINEnv.sh -i 3 + - name: Set up Dependency ubuntu22.04 Environment + if: matrix.os == 'ubuntu-22.04' + run: | + cd libxengine + chmod 777 * + sudo ./XEngine_LINEnv.sh -i 0 + + latest_tag=$(curl -s https://api.github.com/repos/libxengine/libxengine/releases/latest | jq -r .tag_name) + wget https://github.com/libxengine/libxengine/releases/download/$latest_tag/XEngine_UBuntu_22.04_x86-64.zip + unzip ./XEngine_UBuntu_22.04_x86-64.zip -d ./XEngine_UBuntu_22.04_x86-64 + cd XEngine_UBuntu_22.04_x86-64 + + sudo cp -rf ./XEngine_Include /usr/local/include + sudo find ./XEngine_Linux -name "*.so" -exec cp {} /usr/local/lib \; + sudo ldconfig + + - name: make + run: | + cd XEngine_Module + cd jsoncpp + make + cd .. + cd tinyxml2 + make + cd .. + cd XEngine_InfoReport + make + cd .. + cd XEngine_AVPlayer + make \ No newline at end of file diff --git a/README.en.md b/README.en.md index 753b876..defa20d 100644 --- a/README.en.md +++ b/README.en.md @@ -36,12 +36,12 @@ support systems:linux,macos,windows #### XEngine environment you have to install xengine before complie,You can refer to its Readme document -GITEE:https://gitee.com/xyry/libxengine -GITHUB:https://github.com/libxengine/xengine +GITEE:https://gitee.com/libxengine/libxengine +GITHUB:https://github.com/libxengine/libxengine ###### fast to deployment -git clone https://gitee.com/xyry/libxengine.git or git clone https://github.com/libxengine/xengine.git +git clone https://gitee.com/libxengine/libxengine.git or git clone https://github.com/libxengine/libxengine.git window Exection XEngine_WINEnv.bat Linux Exection:sudo ./XEngine_LINEnv.sh -i 3 Macos Exection:./XEngine_LINEnv.sh -i 3 @@ -55,7 +55,7 @@ use vs open and complie #### Linux Linux use Makefile complie -UBUNTU22.04 +support ubunut22.04 and rockylinux9 and above version ##### Compile Command diff --git a/README.md b/README.md index e981f75..5f0b4ba 100644 --- a/README.md +++ b/README.md @@ -37,12 +37,12 @@ #### XEngine环境 在编译之前必须安装XEngine,可以参考其Readme文档 -GITEE:https://gitee.com/xyry/libxengine -GITHUB:https://github.com/libxengine/xengine +GITEE:https://gitee.com/libxengine/libxengine +GITHUB:https://github.com/libxengine/libxengine ###### 快速部署 -git clone https://gitee.com/xyry/libxengine.git 或者 git clone https://github.com/libxengine/xengine.git +git clone https://gitee.com/libxengine/libxengine.git 或者 git clone https://github.com/libxengine/libxengine.git window执行XEngine_WINEnv.bat 脚本 Linux执行:sudo ./XEngine_LINEnv.sh -i 3 macos执行:./XEngine_LINEnv.sh -i 3 @@ -56,7 +56,7 @@ XEngine_AVPlayer 需要sdl2支持 #### Linux Linux使用Makefile编译 -UBUNTU24.04 +支持ubuntu22.04以及rockylinux9以及以上系统版本 ###### 编译命令 diff --git a/XEngine_Module/XEngine_AVPlayer/Makefile b/XEngine_Module/XEngine_AVPlayer/Makefile index 9d5e620..4ed2516 100644 --- a/XEngine_Module/XEngine_AVPlayer/Makefile +++ b/XEngine_Module/XEngine_AVPlayer/Makefile @@ -38,6 +38,8 @@ else ifeq ($(PLATFORM),mac) CC += -Wno-deprecated-declarations PLATVER = -D __MACOS__ FILEEXT = dylib + LOADHDR += -I /opt/homebrew/opt/sdl2/include + LOADSO += -L /opt/homebrew/opt/sdl2/lib LIBFLAG = -dynamiclib LIBEX = -lSDL2 -lpthread -ldl LOADBIN = -Wl,-rpath,@loader_path/../XEngine_BaseLib/ diff --git a/XEngine_Module/XEngine_InfoReport/InfoReport_APIMachine/InfoReport_APIMachine.cpp b/XEngine_Module/XEngine_InfoReport/InfoReport_APIMachine/InfoReport_APIMachine.cpp index ae115af..54c672e 100644 --- a/XEngine_Module/XEngine_InfoReport/InfoReport_APIMachine/InfoReport_APIMachine.cpp +++ b/XEngine_Module/XEngine_InfoReport/InfoReport_APIMachine/InfoReport_APIMachine.cpp @@ -35,12 +35,17 @@ CInfoReport_APIMachine::~CInfoReport_APIMachine() 类型:常量字符指针 可空:N 意思:输入上报的服务名称 + 参数.三:pInt_TimeNumber + In/Out:In + 类型:整数型指针 + 可空:N + 意思:输出报告次数 返回值 类型:逻辑型 意思:是否成功 备注:lpszAPIUrl = _X("http://127.0.0.1:5501/api?function=machine"); *********************************************************************/ -bool CInfoReport_APIMachine::InfoReport_APIMachine_Send(LPCXSTR lpszAPIUrl, LPCXSTR lpszServiceName) +bool CInfoReport_APIMachine::InfoReport_APIMachine_Send(LPCXSTR lpszAPIUrl, LPCXSTR lpszServiceName, __int64x* pInt_TimeNumber /* = NULL */) { InfoReport_IsErrorOccur = false; @@ -109,7 +114,12 @@ bool CInfoReport_APIMachine::InfoReport_APIMachine_Send(LPCXSTR lpszAPIUrl, LPCX InfoReport_dwErrorCode = ERROR_XENGINE_THIRDPART_INFOREPORT_CODE; return false; } - + if (!st_JsonRoot["data"].isNull() && (NULL != pInt_TimeNumber)) + { + Json::Value st_JsonArray = st_JsonRoot["data"]; + *pInt_TimeNumber = st_JsonArray[0]["nTimeNumber"].asInt64(); + } + return true; } /******************************************************************** diff --git a/XEngine_Module/XEngine_InfoReport/InfoReport_APIMachine/InfoReport_APIMachine.h b/XEngine_Module/XEngine_InfoReport/InfoReport_APIMachine/InfoReport_APIMachine.h index fb34651..27070d0 100644 --- a/XEngine_Module/XEngine_InfoReport/InfoReport_APIMachine/InfoReport_APIMachine.h +++ b/XEngine_Module/XEngine_InfoReport/InfoReport_APIMachine/InfoReport_APIMachine.h @@ -17,7 +17,7 @@ class CInfoReport_APIMachine CInfoReport_APIMachine(); ~CInfoReport_APIMachine(); public: - bool InfoReport_APIMachine_Send(LPCXSTR lpszAPIUrl, LPCXSTR lpszServiceName); + bool InfoReport_APIMachine_Send(LPCXSTR lpszAPIUrl, LPCXSTR lpszServiceName, __int64x* pInt_TimeNumber = NULL); bool InfoReport_APIMachine_GetTime(LPCXSTR lpszAPIUrl, LPCXSTR lpszServiceName, __int64x* pInt_TimeNumber); bool InfoReport_APIMachine_Delete(LPCXSTR lpszAPIUrl, LPCXSTR lpszServiceName); protected: diff --git a/XEngine_Module/XEngine_InfoReport/InfoReport_Define.h b/XEngine_Module/XEngine_InfoReport/InfoReport_Define.h index ff97242..3a184d5 100644 --- a/XEngine_Module/XEngine_InfoReport/InfoReport_Define.h +++ b/XEngine_Module/XEngine_InfoReport/InfoReport_Define.h @@ -30,12 +30,17 @@ extern "C" XLONG InfoReport_GetLastError(int *pInt_ErrorCode = NULL); 类型:常量字符指针 可空:N 意思:输入上报的服务名称 + 参数.三:pInt_TimeNumber + In/Out:In + 类型:整数型指针 + 可空:N + 意思:输出报告次数 返回值 类型:逻辑型 意思:是否成功 备注:lpszAPIUrl = _X("http://127.0.0.1:5501/api?function=machine¶ms1=0"); *********************************************************************/ -extern "C" bool InfoReport_APIMachine_Send(LPCXSTR lpszAPIUrl, LPCXSTR lpszServiceName); +extern "C" bool InfoReport_APIMachine_Send(LPCXSTR lpszAPIUrl, LPCXSTR lpszServiceName, __int64x* pInt_TimeNumber = NULL); /******************************************************************** 函数名称:InfoReport_APIMachine_GetTime 函数功能:获取报告次数 diff --git a/XEngine_Module/XEngine_InfoReport/pch.cpp b/XEngine_Module/XEngine_InfoReport/pch.cpp index de7ccac..d3d7c9f 100644 --- a/XEngine_Module/XEngine_InfoReport/pch.cpp +++ b/XEngine_Module/XEngine_InfoReport/pch.cpp @@ -29,9 +29,9 @@ extern "C" XLONG InfoReport_GetLastError(int* pInt_ErrorCode) /************************************************************************/ /* APIMachine报告 */ /************************************************************************/ -extern "C" bool InfoReport_APIMachine_Send(LPCXSTR lpszAPIUrl, LPCXSTR lpszServiceName) +extern "C" bool InfoReport_APIMachine_Send(LPCXSTR lpszAPIUrl, LPCXSTR lpszServiceName, __int64x* pInt_TimeNumber) { - return m_APIMachine.InfoReport_APIMachine_Send(lpszAPIUrl, lpszServiceName); + return m_APIMachine.InfoReport_APIMachine_Send(lpszAPIUrl, lpszServiceName, pInt_TimeNumber); } extern "C" bool InfoReport_APIMachine_GetTime(LPCXSTR lpszAPIUrl, LPCXSTR lpszServiceName, __int64x * pInt_TimeNumber) {