shithub: m8c

Download patch

ref: 8917f16e1c96c573cf13e2887f61ebd13d8d87e3
parent: 4f1342e94e588f029d0ce3ac7b2e21dab1ca0b3e
parent: 74e51271bc6e3a878543c7cb5b17187e46271255
author: Jonne Kokkonen <jonne.kokkonen@gmail.com>
date: Wed Mar 8 10:10:14 EST 2023

Merge pull request #97 from laamaa/macos_cmake_build

* Update GH actions, remove deprecated syntax
* Fix MacOS build, use CMake

--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -27,7 +27,7 @@
       shell: bash
 
     - name: 'Checkout'
-      uses: actions/checkout@v2
+      uses: actions/checkout@v3
       with:
         fetch-depth: 0
 
@@ -38,9 +38,8 @@
         update: true
         install: mingw-w64-${{ matrix.env }}-toolchain make mingw-w64-${{ matrix.env }}-SDL2 mingw-w64-${{ matrix.env }}-libserialport zip dos2unix
   
-    - name: 'Get current date'
-      id: date
-      run: echo "::set-output name=date::$(date +%Y%m%d)"
+    - name: Set current date as env variable
+      run: echo "NOW=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
 
     - name: 'Build package'
       run: |
@@ -59,9 +58,9 @@
         unix2dos README.md config.ini.sample LICENSE AUDIOGUIDE.md
     - name: 'Upload artifact (win32)'
       if: matrix.win == 'win32'
-      uses: actions/upload-artifact@v2
+      uses: actions/upload-artifact@v3
       with:
-        name: m8c-${{ steps.date.outputs.date }}-${{ matrix.win }}
+        name: m8c-${{ env.NOW }}-${{ matrix.win }}
         path: |
           m8c.exe
           SDL2.dll
@@ -75,9 +74,9 @@
           config.ini.sample
     - name: 'Upload artifact (win64)'
       if: matrix.win == 'win64'
-      uses: actions/upload-artifact@v2
+      uses: actions/upload-artifact@v3
       with:
-        name: m8c-${{ steps.date.outputs.date }}-${{ matrix.win }}
+        name: m8c-${{ env.NOW }}-${{ matrix.win }}
         path: |
           m8c.exe
           SDL2.dll
@@ -97,19 +96,18 @@
           sudo apt-get update
           sudo apt-get install --fix-missing build-essential libsdl2-dev libserialport-dev zip
       - name: 'Checkout'
-        uses: actions/checkout@v2
+        uses: actions/checkout@v3
 
-      - name: 'Get current date'
-        id: date
-        run: echo "::set-output name=date::$(date +%Y%m%d)"
+      - name: Set current date as env variable
+        run: echo "NOW=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
 
       - name: 'Build package'
         run: |
           make
       - name: 'Upload artifact'
-        uses: actions/upload-artifact@v2
+        uses: actions/upload-artifact@v3
         with:
-          name: m8c-${{ steps.date.outputs.date }}-linux
+          name: m8c-${{ env.NOW }}-linux
           path: |
             LICENSE
             README.md
@@ -123,33 +121,27 @@
     
     steps:
       - name: 'Install dependencies'
-        run: brew install sdl2 libserialport pkg-config
+        run: brew install cmake sdl2 libserialport pkg-config
 
       - name: 'Checkout'
-        uses: actions/checkout@v2
+        uses: actions/checkout@v3
 
-      - name: 'Get current date'
-        id: date
-        run: echo "::set-output name=date::$(date +%Y%m%d)"
+      - name: Set current date as env variable
+        run: echo "NOW=$(date +'%Y-%m-%d')" >> $GITHUB_ENV        
 
       - name: 'Build package'
         run: |
-          make
-          chmod 755 m8c
-          cd macos/m8c.app/Contents/
-          mkdir MacOS
-          cd MacOS
-          cp ../../../../m8c .
-          cp /usr/local/opt/sdl2/lib/libSDL2* .
-          cp /usr/local/opt/libserialport/lib/libserialport.* .
-          install_name_tool -change /usr/local/opt/libserialport/lib/libserialport.0.dylib @executable_path/libserialport.0.dylib m8c
-          install_name_tool -change /usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib @executable_path/libSDL2-2.0.0.dylib m8c
-          cd ../../../../
-          cp -r macos/m8c.app .
+          INSTALL_PREFIX=/tmp/
+          mkdir build && cd build
+          cmake ..
+          cmake --build .
+          cmake --install . --prefix=$INSTALL_PREFIX
+          codesign --deep --force --verify --verbose --timestamp --sign - "$INSTALL_PREFIX/m8c.app" "$INSTALL_PREFIX/m8c.app/Contents/Frameworks/libSDL2-2.0.0.dylib" "$INSTALL_PREFIX/m8c.app/Contents/Frameworks/libserialport.0.dylib"
+          cd ..
+          cp -r /tmp/m8c.app .
           zip -r m8c.zip m8c.app LICENSE README.md AUDIOGUIDE.md config.ini.sample gamecontrollerdb.txt
       - name: 'Upload artifact'
-        uses: actions/upload-artifact@v2
+        uses: actions/upload-artifact@v3
         with:
-          name: m8c-${{ steps.date.outputs.date }}-macos
-          path: m8c.zip
-            
+          name: m8c-${{ env.NOW }}-macos
+          path: m8c.zip           
--- a/config.c
+++ b/config.c
@@ -25,7 +25,7 @@
   c.init_fullscreen = 0; // default fullscreen state at load
   c.init_use_gpu = 1;    // default to use hardware acceleration
   c.idle_ms = 10;        // default to high performance
-  c.wait_for_device = 0; // default to exit if device disconnected
+  c.wait_for_device = 1; // default to exit if device disconnected
   c.wait_packets = 1024;   // default zero-byte attempts to disconnect (about 2 sec for default idle_ms)
 
   c.key_up = SDL_SCANCODE_UP;
--