Skip to content

Commit

Permalink
Update action
Browse files Browse the repository at this point in the history
  • Loading branch information
bbbbx committed Aug 28, 2022
1 parent cee33bd commit a837f2e
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 39 deletions.
37 changes: 7 additions & 30 deletions .github/workflows/build_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: Build macOS

on:
push:
tags:
- '*'
branches: [main]
pull_request:
branches: [main]

Expand All @@ -14,38 +13,16 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
configuration: [Release]
configuration: [Debug, Release]
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Install Package
uses: ConorMacBride/install[email protected]
with:
brew: ffmpeg
- name: Install nasm
run: brew install nasm
- name: Compile FFmpeg
run: cd ${{github.workspace}}/extern/FFmpeg && mkdir build && ./configure --prefix=$(pwd)/build --disable-doc --disable-programs --disable-static --enable-shared && make -j8 && make install
- name: Configure CMake
run: cmake . -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DFFmpeg_INCLUDE=$(brew --prefix)/include -DFFmpeg_LIB=$(brew --prefix)/lib
run: cmake . -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.configuration}} -DFFmpeg_INCLUDE=${{github.workspace}}/extern/FFmpeg/build/include -DFFmpeg_LIB=${{github.workspace}}/extern/FFmpeg/build/lib
- name: Build
run: cmake --build ${{github.workspace}}/build -j 8 --config ${{matrix.configuration}}
- name: Release
uses: actions/create-release@v1
id: create-release
with:
draft: false
prerelease: false
release_name: ${{ github.ref }}
tag_name: ${{ github.ref }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: pack into zip
run: zip --junk-paths ShadeYourDesktop bin/ShadeYourDesktop
- name: Upload artifacts to release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ./ShadeYourDesktop.zip
asset_name: ShadeYourDesktop.zip
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ github.token }}

13 changes: 7 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ endif()

project( ShadeYourDesktop )

set( TARGET_NAME ${PROJECT_NAME} )

set( CMAKE_CXX_STANDARD 17 )

set( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin" )
Expand Down Expand Up @@ -61,10 +63,9 @@ elseif( MSVC )
list( APPEND SHADE_YOUR_DESKTOP_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/put_window_behind_desktop_icons_win.cpp" )
endif()

add_executable( ShadeYourDesktop ${SHADE_YOUR_DESKTOP_SRC} )
target_link_directories( ShadeYourDesktop PRIVATE
${FFmpeg_LIB} )
target_link_libraries( ShadeYourDesktop
add_executable( ${TARGET_NAME} ${SHADE_YOUR_DESKTOP_SRC} )
target_link_directories( ${TARGET_NAME} PRIVATE ${FFmpeg_LIB} )
target_link_libraries( ${TARGET_NAME}
glfw
avformat
avcodec
Expand All @@ -74,8 +75,8 @@ target_link_libraries( ShadeYourDesktop

if ( MSCV )
if ( ${CMAKE_VERSION} VERSION_LESS "3.6.0" )
message( "\n\t[ WARNING ]\n\n\tCMake version is less then 3.6\n\n\t - Please update CMake and rerun; OR\n\t - Manually set 'ShadeYourDesktop' as StartUp Project in Visual Studio.\n")
message( "\n\t[ WARNING ]\n\n\tCMake version is less then 3.6\n\n\t - Please update CMake and rerun; OR\n\t - Manually set '${TARGET_NAME}' as StartUp Project in Visual Studio.\n")
else()
set_property( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PERPROTY VS_STARTUP_PROJECT ShadeYourDesktop)
set_property( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PERPROTY VS_STARTUP_PROJECT ${TARGET_NAME})
endif()
endif()
39 changes: 36 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Shade Your Desktop
# Shade Your Desktop [![Build macOS](https://github.com/bbbbx/ShadeYourDesktop/actions/workflows/build_macos.yml/badge.svg)](https://github.com/bbbbx/ShadeYourDesktop/actions/workflows/build_macos.yml)

<p align="center">
<a href="https://vimeo.com/723791479"><img src="./preview.gif" /></a> <br />
Expand All @@ -11,25 +11,58 @@

- [FFmpeg](https://ffmpeg.org/download.html)

### Install FFmpeg with Homebrew

Use [Homebrew](https://brew.sh/) to install them:

```sh
$ brew install ffmpeg
```

### Install FFmpeg from source code

Make sure the git submodules was updated:

```sh
git submodule update --init --recursive
```

Compile shared libraries and install:

```sh
$ cd extern/FFmpeg && \
mkdir build && \
./configure --prefix=$(pwd)/build --disable-doc --disable-programs --disable-static --enable-shared && \
make -j8 && \
make install
```

The installation directory should be `extern/FFmpeg/build`.

If compilation complains `nasm/yasm not found or too old.`, you can use brew to install `nasm` or `yasm`, and try again.

## Compile

In order to include and link FFmpeg correctly, there are two options you need to specify, or just use the defaults:

- `FFmpeg_INCLUDE`: default is `/opt/homebrew/include`
- `FFmpeg_LIB`: default is `/opt/homebrew/lib`

and make sure FFmpeg shared libraries(.ddl for Windows, .dylib for macOS) are included your path.
and make sure FFmpeg shared libraries(.ddl for Windows, .dylib for macOS, .so for Linux) are included your path.

Use [CMake](https://cmake.org/) to control compilation process:
Config CMake from project root directory:

```sh
$ cmake . -B build -DFFmpeg_INCLUDE=<ffmpeg_include_path> -DFFmpeg_LIB=<ffmpeg_lib_path>
```

For example:
1. if you install FFmpeg with Homebrew, `<ffmpeg_include_path>` could be `$(brew --prefix)/include`, and `<ffmpeg_lib_path>` could be `$(brew --prefix)/lib`;
2. if you install FFmpeg from source code, `<ffmpeg_include_path>` could be `$(pwd)/extern/FFmpeg/build/include`, and `<ffmpeg_lib_path>` could be `$(pwd)/extern/FFmpeg/build/lib`.

Then compile:

```sh
$ cmake --build build -j 8 --config Release
```

Expand Down

0 comments on commit a837f2e

Please sign in to comment.