From ccbaef8dbfa49d41907f74510fbde09317c9ad92 Mon Sep 17 00:00:00 2001 From: Putta Khunchalee Date: Tue, 7 Jun 2022 16:38:24 +0700 Subject: [PATCH 1/4] initialize CI for Linux --- .github/workflows/ci.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 435ac64..f189e9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,8 +8,8 @@ on: - '*' concurrency: ci-${{ github.ref }} jobs: - build: - name: Build + build-windows: + name: Build (Windows) runs-on: windows-2022 steps: - name: Checkout source @@ -43,5 +43,17 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v3 with: - name: Kyty + name: Kyty (Windows) path: _Build/_Gcc/_bin + build-linux: + name: Build (Linux) + runs-on: ubuntu-20.04 + steps: + - name: Checkout source + uses: actions/checkout@v3 + with: + lfs: true + - name: Run CMake + run: cmake -B _Build/_Linux -S source -D CMAKE_BUILD_TYPE=Release -D KYTY_FINAL=1 + - name: Build + run: cmake --build _Build/_Linux From c7f5e79037c78042a6cedde431511ad022113455 Mon Sep 17 00:00:00 2001 From: Putta Khunchalee Date: Tue, 7 Jun 2022 16:54:30 +0700 Subject: [PATCH 2/4] add Linux to CMake --- source/CMakeLists.txt | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 56f68f9..465d483 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -2,10 +2,6 @@ cmake_minimum_required(VERSION 3.12) project(Kyty) -if (NOT (WIN32 AND (MINGW OR MSVC))) - message(FATAL_ERROR "only mingw and msvc supported") -endif() - set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) @@ -43,8 +39,7 @@ else() set(KYTY_BUILD KYTY_BUILD_RELEASE) endif() -set(KYTY_PLATFORM KYTY_PLATFORM_WINDOWS) - +# Platform-specific configurations. if(MINGW) if(CMAKE_CXX_COMPILER_ID MATCHES "(C|c?)lang") set(CLANG 1) @@ -57,7 +52,10 @@ if(MINGW) set(KYTY_COMPILER MINGW) set(KYTY_LINKER LD) endif() -else() + + set(KYTY_PLATFORM KYTY_PLATFORM_WINDOWS) +elseif(WIN32) + # Assume it is MSVC if we are on Windows with non-MinGW. if(CMAKE_CXX_COMPILER_ID MATCHES "(C|c?)lang") set(CLANG 1) set(KYTY_COMPILER CLANG) @@ -66,6 +64,14 @@ else() set(KYTY_COMPILER MSVC) set(KYTY_LINKER LINK) endif() + + set(KYTY_PLATFORM KYTY_PLATFORM_WINDOWS) +elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + set(KYTY_COMPILER GCC) + set(KYTY_LINKER LD) + set(KYTY_PLATFORM KYTY_PLATFORM_LINUX) +else() + message(FATAL_ERROR "The target platform is not supported") endif() set(KYTY_PROJECT_NAME "Emulator" CACHE STRING "Project name") From 94a63991e58c41ac7d8e11b965ec7b4c84045c8c Mon Sep 17 00:00:00 2001 From: Putta Khunchalee Date: Tue, 7 Jun 2022 17:29:34 +0700 Subject: [PATCH 3/4] fix Qt error --- .github/workflows/ci.yml | 4 ++++ source/launcher/CMakeLists.txt | 36 +++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f189e9d..6251134 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,6 +53,10 @@ jobs: uses: actions/checkout@v3 with: lfs: true + - name: Install Ubuntu packages + run: | + sudo apt-get update + sudo apt-get install -y qt5-default - name: Run CMake run: cmake -B _Build/_Linux -S source -D CMAKE_BUILD_TYPE=Release -D KYTY_FINAL=1 - name: Build diff --git a/source/launcher/CMakeLists.txt b/source/launcher/CMakeLists.txt index edede99..a600604 100644 --- a/source/launcher/CMakeLists.txt +++ b/source/launcher/CMakeLists.txt @@ -45,28 +45,32 @@ endif() add_dependencies(launcher KytyGitVersion) -find_program(QT_WINDEPLOYQT NAMES windeployqt PATHS "${Qt5_DIR}/../../../bin") -if(NOT QT_WINDEPLOYQT) - message(FATAL_ERROR "Could not find windeployqt") -endif() - set(launcher_name "launcher") set_target_properties(launcher PROPERTIES OUTPUT_NAME ${launcher_name}) install(TARGETS launcher DESTINATION .) -install(CODE " - execute_process( - COMMAND ${QT_WINDEPLOYQT} \"\${CMAKE_INSTALL_PREFIX}/${launcher_name}.exe\" - --no-svg - --no-angle - --no-opengl - --no-opengl-sw - --no-system-d3d-compiler - --no-translations - ) -") +if(WIN32) + find_program(QT_WINDEPLOYQT NAMES windeployqt PATHS "${Qt5_DIR}/../../../bin") + + if(NOT QT_WINDEPLOYQT) + message(FATAL_ERROR "Could not find windeployqt") + endif() + + install(CODE " + execute_process( + COMMAND ${QT_WINDEPLOYQT} \"\${CMAKE_INSTALL_PREFIX}/${launcher_name}.exe\" + --no-svg + --no-angle + --no-opengl + --no-opengl-sw + --no-system-d3d-compiler + --no-translations + ) + ") +endif() + qt5_create_translation(QM_FILES ${launcher_src} ${launcher_forms} ${launcher_ts} OPTIONS -I ${CMAKE_SOURCE_DIR}/launcher/include) From 1fdaa18f390398fa347d8f57984111332cc25036 Mon Sep 17 00:00:00 2001 From: Putta Khunchalee Date: Tue, 7 Jun 2022 17:53:45 +0700 Subject: [PATCH 4/4] fix cannot find Qt5LinguistTools --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6251134..a01f61f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,7 +56,7 @@ jobs: - name: Install Ubuntu packages run: | sudo apt-get update - sudo apt-get install -y qt5-default + sudo apt-get install -y qt5-default qttools5-dev - name: Run CMake run: cmake -B _Build/_Linux -S source -D CMAKE_BUILD_TYPE=Release -D KYTY_FINAL=1 - name: Build