diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..1cab594 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,98 @@ +name: Build + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + BUILD_TYPE: Release + +jobs: + build-ubuntu: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install packages + run: | + sudo apt-get update + sudo apt install -y pkg-config cmake + sudo apt install -y software-properties-common + sudo add-apt-repository -y ppa:ubuntuhandbook1/gimp-3 + sudo apt install -y gimp libgimp-3.0-0 libgimp-3.0-dev libgexiv2-dev + + - name: Configure CMake + run: > + cmake + -DCMAKE_BUILD_TYPE:STRING=${{env.BUILD_TYPE}} + -DCMAKE_C_COMPILER:FILEPATH=clang + -DCMAKE_CXX_COMPILER:FILEPATH=clang++ + -S "${{ github.workspace }}" + -B "${{ github.workspace }}/build/" + + - name: Build + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Upload plugin + uses: actions/upload-artifact@v4 + with: + name: arma-gimp-plugin + path: "${{ github.workspace }}/build/arma-gimp-plugin" + + build-windows: + runs-on: windows-latest + + defaults: + run: + shell: msys2 {0} + + steps: + - uses: msys2/setup-msys2@v2 + id: msys2 + with: + msystem: clang64 + update: true + pacboy: >- + toolchain:p + cmake:p + ninja:p + rustup:p + pkgconf:p + glib2:p + gimp:p + + - name: Set pkg-config sysroot + run: echo "PKG_CONFIG_SYSROOT_DIR=${{ steps.msys2.outputs.msys2-location }}/clang64" >> $GITHUB_ENV + + - name: Check PKG_CONFIG_SYSROOT_DIR + run: echo $PKG_CONFIG_SYSROOT_DIR + + - name: Install x86_64-pc-windows-gnu + run: rustup target add x86_64-pc-windows-gnu + + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Configure CMake + shell: msys2 {0} + run: > + cmake + -DCMAKE_BUILD_TYPE:STRING=${{env.BUILD_TYPE}} + -DRust_CARGO_TARGET:STRING=x86_64-pc-windows-gnu + -S "${{ github.workspace }}" + -B "${{ github.workspace }}/build" + + - name: Build + run: cmake --build "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}} + + - name: Upload plugin + uses: actions/upload-artifact@v4 + with: + name: arma-gimp-plugin.exe + path: "${{ github.workspace }}/build/arma-gimp-plugin.exe" \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 12d8413..42e0b00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ add_subdirectory(arma-file-formats-cxx) find_package(PkgConfig REQUIRED) -pkg_check_modules(GIMP REQUIRED gimp-3.0 gimpui-3.0) +pkg_check_modules(GIMP REQUIRED gimp-3.0 gimpui-3.0 glib-2.0) add_executable(arma-gimp-plugin main.cpp) @@ -17,11 +17,14 @@ target_link_libraries(arma-gimp-plugin ${GIMP_LIBRARIES}) target_link_libraries(arma-gimp-plugin aff_cxx_rust) -target_include_directories(arma-gimp-plugin PRIVATE aff_cxx_rust) +if(WIN32) + target_link_libraries(arma-gimp-plugin Bcrypt.lib "-Wl,-subsystem,windows") +endif() -if(WIN32 AND (NOT "$ENV{appdata}" STREQUAL "")) - file(TO_CMAKE_PATH "$ENV{appdata}/GIMP/2.10/plug-ins/arma-gimp-plugin.exe" GIMP_PLUGIN_DIR) - +if(WIN32) + if(NOT "$ENV{appdata}" STREQUAL "") + file(TO_CMAKE_PATH "$ENV{appdata}/GIMP/2.10/plug-ins/arma-gimp-plugin/arma-gimp-plugin.exe" GIMP_PLUGIN_DIR) + endif() else() file(TO_CMAKE_PATH "$ENV{HOME}/.config/GIMP/3.0/plug-ins/arma-gimp-plugin/arma-gimp-plugin" GIMP_PLUGIN_DIR) endif()