From bb40d9b182cd9c976cc23c9e5c2f12924ea3d614 Mon Sep 17 00:00:00 2001 From: Jean Fauquenot Date: Sun, 26 Jul 2020 20:29:50 +0200 Subject: [PATCH] Add libslipr dependency to CMakeLists and pipelines --- .github/workflows/build-ubuntu.yml | 18 ++-- .github/workflows/build-windows.yml | 12 +-- src/frontend/qt_sdl/CMakeLists.txt | 122 ++++++++++++---------------- 3 files changed, 62 insertions(+), 90 deletions(-) diff --git a/.github/workflows/build-ubuntu.yml b/.github/workflows/build-ubuntu.yml index efb96048b7..49e83ac92b 100644 --- a/.github/workflows/build-ubuntu.yml +++ b/.github/workflows/build-ubuntu.yml @@ -1,12 +1,7 @@ name: CMake Build (Ubuntu x86-64) on: - push: - branches: - - master - pull_request: - branches: - - master + [push, pull_request] env: BUILD_TYPE: Release @@ -15,7 +10,7 @@ env: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v1 @@ -23,17 +18,14 @@ jobs: shell: bash working-directory: ${{runner.workspace}} run: | # Fetch a new version of CMake, because the default is too old. - wget -nv https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-Linux-x86_64.tar.gz \ - && tar -zxf cmake-$CMAKE_VERSION-Linux-x86_64.tar.gz \ - && sudo rm -f /etc/apt/sources.list.d/dotnetdev.list /etc/apt/sources.list.d/microsoft-prod.list \ - && sudo apt-get update \ - && sudo apt-get install gtk+-3.0 libcurl4-gnutls-dev libpcap0.8-dev libsdl2-dev qt5-default + sudo apt-get update \ + && sudo apt-get install cmake libgtk2.0-dev libglib2.0-dev libcurl4-gnutls-dev libpcap0.8-dev libsdl2-dev qt5-default libslirp-dev libc6-dev - name: Create build environment run: mkdir ${{runner.workspace}}/build - name: Configure shell: bash working-directory: ${{runner.workspace}}/build - run: ${{runner.workspace}}/cmake-$CMAKE_VERSION-Linux-x86_64/bin/cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE - name: Make shell: bash working-directory: ${{runner.workspace}}/build diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index b8e8b04fa2..54d0fedde7 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -1,12 +1,7 @@ name: CMake Build (Windows x86-64) on: - push: - branches: - - master - pull_request: - branches: - - master + [push, pull_request] env: BUILD_TYPE: Release @@ -21,11 +16,10 @@ jobs: - name: Install MSYS2 working-directory: ${{runner.workspace}} run: | # Fetch MSYS2 build from XQEmu. Official distribution causes a CI failure due to permission errors. - Invoke-WebRequest -Uri "https://github.com/xqemu/ci-environment-msys2/releases/latest/download/msys64.7z" -OutFile "msys64.7z" - 7z x -y msys64.7z "-oC:\tools\" + choco install msys2 C:\tools\msys64\usr\bin\bash.exe -lc "pacman -Syuq --noconfirm" - name: Install dependencies - run: C:\tools\msys64\usr\bin\bash.exe -lc "pacman -Sq --noconfirm git make mingw-w64-x86_64-{cmake,mesa,SDL2,qt5-static,toolchain}" + run: C:\tools\msys64\usr\bin\bash.exe -lc "pacman -Sq --noconfirm git make mingw-w64-x86_64-{cmake,SDL2,qt5-static,toolchain,libslirp}" - name: Create build environment run: | New-Item -ItemType directory -Path ${{runner.workspace}}\melonDS\build diff --git a/src/frontend/qt_sdl/CMakeLists.txt b/src/frontend/qt_sdl/CMakeLists.txt index 4f9eae0e8e..7faea15740 100644 --- a/src/frontend/qt_sdl/CMakeLists.txt +++ b/src/frontend/qt_sdl/CMakeLists.txt @@ -1,41 +1,41 @@ project(qt_sdl) SET(SOURCES_QT_SDL - main.cpp - main_shaders.h - EmuSettingsDialog.cpp - InputConfigDialog.cpp - VideoSettingsDialog.cpp - AudioSettingsDialog.cpp - WifiSettingsDialog.cpp - Input.cpp - LAN_PCap.cpp - LAN_Socket.cpp - OSD.cpp - OSD_shaders.h - font.h - Platform.cpp - PlatformConfig.cpp - - ../Util_ROM.cpp - ../Util_Video.cpp - ../Util_Audio.cpp - ../FrontendUtil.h - ../mic_blow.h - - ../../../melon.qrc + main.cpp + main_shaders.h + EmuSettingsDialog.cpp + InputConfigDialog.cpp + VideoSettingsDialog.cpp + AudioSettingsDialog.cpp + WifiSettingsDialog.cpp + Input.cpp + LAN_PCap.cpp + LAN_Socket.cpp + OSD.cpp + OSD_shaders.h + font.h + Platform.cpp + PlatformConfig.cpp + + ../Util_ROM.cpp + ../Util_Video.cpp + ../Util_Audio.cpp + ../FrontendUtil.h + ../mic_blow.h + + ../../../melon.qrc ) if (WIN32) - set(CMAKE_RC_COMPILE_OBJECT " -i -o ") + set(CMAKE_RC_COMPILE_OBJECT " -i -o ") endif() if (BUILD_STATIC AND QT5_STATIC_DIR) - set(QT5_STATIC_BASE ${QT5_STATIC_DIR}/lib/cmake/Qt5) - set(Qt5_DIR ${QT5_STATIC_BASE}) - set(Qt5Core_DIR ${QT5_STATIC_BASE}Core) - set(Qt5Gui_DIR ${QT5_STATIC_BASE}Gui) - set(Qt5Widgets_DIR ${QT5_STATIC_BASE}Widgets) + set(QT5_STATIC_BASE ${QT5_STATIC_DIR}/lib/cmake/Qt5) + set(Qt5_DIR ${QT5_STATIC_BASE}) + set(Qt5Core_DIR ${QT5_STATIC_BASE}Core) + set(Qt5Gui_DIR ${QT5_STATIC_BASE}Gui) + set(Qt5Widgets_DIR ${QT5_STATIC_BASE}Widgets) endif() find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED) @@ -44,15 +44,20 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) +find_package(Threads REQUIRED) +find_package(Iconv REQUIRED) find_package(PkgConfig REQUIRED) pkg_check_modules(SDL2 REQUIRED sdl2) +pkg_check_modules(SLIRP REQUIRED slirp) if (WIN32 AND (CMAKE_BUILD_TYPE STREQUAL Release)) - add_executable(melonDS WIN32 ${SOURCES_QT_SDL}) + add_executable(melonDS WIN32 ${SOURCES_QT_SDL}) else() - add_executable(melonDS ${SOURCES_QT_SDL}) + add_executable(melonDS ${SOURCES_QT_SDL}) endif() +target_link_libraries(melonDS ${CMAKE_THREAD_LIBS_INIT}) + target_include_directories(melonDS PRIVATE ${SDL2_INCLUDE_DIRS}) target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..") @@ -60,48 +65,29 @@ target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../..") target_link_libraries(melonDS core) if (BUILD_STATIC) - target_link_libraries(melonDS -static ${SDL2_LIBRARIES}) + target_link_libraries(melonDS -static ${SDL2_LIBRARIES} ${SLIRP_LIBRARIES}) else() - target_link_libraries(melonDS ${SDL2_LIBRARIES}) + target_link_libraries(melonDS ${SDL2_LIBRARIES} ${SLIRP_LIBRARIES}) endif() if (UNIX) - option(UNIX_PORTABLE "Make a portable build that looks for its configuration in the current directory" OFF) - if (UNIX_PORTABLE) - add_definitions(-DUNIX_PORTABLE) - endif() - - find_package(PkgConfig REQUIRED) - pkg_check_modules(GTK3 REQUIRED gtk+-3.0) - - target_include_directories(melonDS PRIVATE ${GTK3_INCLUDE_DIRS}) - target_link_libraries(melonDS ${GTK3_LIBRARIES}) - - ADD_DEFINITIONS(${GTK3_CFLAGS_OTHER}) - - add_custom_command(OUTPUT melon_grc.c - COMMAND glib-compile-resources --sourcedir=${CMAKE_SOURCE_DIR} - --target=${CMAKE_CURRENT_BINARY_DIR}/melon_grc.c - --generate-source "${CMAKE_SOURCE_DIR}/melon_grc.xml" - COMMAND glib-compile-resources --sourcedir=${CMAKE_SOURCE_DIR} - --target=${CMAKE_CURRENT_BINARY_DIR}/melon_grc.h - --generate-header "${CMAKE_SOURCE_DIR}/melon_grc.xml") - - if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - target_link_libraries(melonDS dl slirp Qt5::Core Qt5::Gui Qt5::Widgets) - endif () - - target_sources(melonDS PUBLIC melon_grc.c) + option(PORTABLE "Make a portable build that looks for its configuration in the current directory" OFF) + target_link_libraries(melonDS dl Qt5::Core Qt5::Gui Qt5::Widgets) elseif (WIN32) - target_sources(melonDS PUBLIC "${CMAKE_SOURCE_DIR}/melon.rc") - - target_link_libraries(melonDS slirp comctl32 d2d1 dwrite uxtheme ws2_32 iphlpapi gdi32) - if (BUILD_STATIC) - target_link_libraries(melonDS imm32 winmm version setupapi -static Qt5::Core Qt5::Gui Qt5::Widgets z zstd glib-2.0 intl iconv) - else() - target_link_libraries(melonDS Qt5::Core Qt5::Gui Qt5::Widgets) - endif() -endif () + option(PORTABLE "Make a portable build that looks for its configuration in the current directory" ON) + target_sources(melonDS PUBLIC "${CMAKE_SOURCE_DIR}/melon.rc") + + target_link_libraries(melonDS comctl32 d2d1 dwrite uxtheme ws2_32 iphlpapi gdi32) + if (BUILD_STATIC) + target_link_libraries(melonDS imm32 winmm version setupapi -static Qt5::Core Qt5::Gui Qt5::Widgets z zstd glib-2.0 intl iconv) + else() + target_link_libraries(melonDS Qt5::Core Qt5::Gui Qt5::Widgets) + endif() +endif() + +if (PORTABLE) + add_definitions(-DPORTABLE) +endif() install(FILES ../../../net.kuribo64.melonDS.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications) install(FILES ../../../icon/melon_16x16.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/16x16/apps RENAME net.kuribo64.melonDS.png)