Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .envrc.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
set -a
use flake
36 changes: 36 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: main
on:
pull_request:
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
jobs:
build-linux:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@main
- name: build tileconv
run: |
sudo apt-get update -yqqq
sudo apt-get install -yqqq libsquish-dev zlib1g-dev libimagequant0 libjpeg-turbo
make -j$(npoc) -C tileconv
- uses: actions/upload-artifact@v4
with:
name: ubuntu-22.04
path: tileconv/tileconv
if-no-files-found: error
build-nix:
strategy:
matrix:
include:
- os: macos-latest
- os: macos-15-intel
- os: ubuntu-24.04
- os: ubuntu-24.04-arm
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@main
- uses: cachix/install-nix-action@master
with:
nix_path: nixpkgs=channel:nixos-25.11
- run: |
nix-build
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@
/Debug
/Release
/.settings

.direnv
.envrc
result
30 changes: 30 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
let
nixpkgs_unstable = import (fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-unstable-small") { };
in
{ pkgs ? nixpkgs_unstable, ... }:
pkgs.stdenv.mkDerivation rec {
name = "tileconv";
src = ./tileconv;
nativeBuildInputs = with pkgs; [
gnumake
libjpeg8
libsquish
libimagequant
zlib
];
buildInputs = with pkgs; [
git
];
configurePhase = ''
make clean
mkdir -p $out/bin
'';
buildPhase = ''
make -j$(nproc) all
cp tileconv $out/bin/tileconv
'';
installPhase = ''
ls $out
'';
enableParallelBuilding = true;
}
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
};
outputs = { self, nixpkgs }:
let
systems = [
"x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"
];
forEachSystem = f: nixpkgs.lib.genAttrs systems (system: f system);
pkgsFor = nixpkgs.legacyPackages;
in {
devShells = forEachSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in {
default = pkgs.stdenv.mkDerivation {
name = "tileconv";
src = ./tileconv;
# Libs
buildInputs = with pkgs; [
gnumake
libjpeg8
libsquish
libimagequant
zlib
];
# Tools
nativeBuildInputs = with pkgs; [
direnv
git
];
# Env
shellHook = ''
'';
};
});
packages = forEachSystem (system: {
default = pkgsFor.${system}.callPackage ./default.nix { pkgs = import nixpkgs { inherit system; }; };
});
};
}
4 changes: 1 addition & 3 deletions tileconv/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ include config.mk

CXX ?= g++
CXXFLAGS = -c -Wall -O2 -std=c++11 -msse -mfpmath=sse -I$(ZLIB_INCLUDE) -I$(PNGQUANT_INCLUDE) -I$(SQUISH_INCLUDE) -I$(JPEG_INCLUDE)
LDFLAGS = -L$(ZLIB_LIB) -L$(PNGQUANT_LIB) -L$(SQUISH_LIB) -L$(JPEG_LIB)
LIBS = -lz -limagequant -lsquish -ljpeg
EXECUTABLE = tileconv

Expand Down Expand Up @@ -78,5 +77,4 @@ $(EXECUTABLE): $(OBJECTS)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $< -o $@

clean:
$(RM) $(OBJECTS)
# $(RM) *.o
$(RM) -f *.o
2 changes: 1 addition & 1 deletion tileconv/colorquant.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ THE SOFTWARE.
#ifndef _COLORQUANT_H_
#define _COLORQUANT_H_

#include <lib/libimagequant.h>
#include <libimagequant.h>

namespace tc {

Expand Down
12 changes: 0 additions & 12 deletions tileconv/config.mk
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
# Where to install (Linux/Mac only)
INSTALL_DIR ?= /usr/local

# Include paths of the external libraries
ZLIB_INCLUDE ?= ./zlib
SQUISH_INCLUDE ?= ./squish
PNGQUANT_INCLUDE ?= ./pngquant
JPEG_INCLUDE ?= ./jpeg-turbo

# Paths to the libraries
ZLIB_LIB ?= ./zlib
SQUISH_LIB ?= ./squish
PNGQUANT_LIB ?= ./pngquant/lib
JPEG_LIB ?= ./jpeg-turbo

# Set to 1 when compiling on Windows using Win32 threads
USE_WINTHREADS ?= 0
1 change: 0 additions & 1 deletion tileconv/jpeg-turbo/remove.me

This file was deleted.

1 change: 0 additions & 1 deletion tileconv/pngquant/lib/remove.me

This file was deleted.

1 change: 0 additions & 1 deletion tileconv/squish/remove.me

This file was deleted.

2 changes: 1 addition & 1 deletion tileconv/tileconv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ bool TileConv::showInfo(const std::string &fileName) noexcept
} else if (std::strncmp(sig, Graphics::HEADER_MOS_SIGNATURE, 4) == 0 ||
std::strncmp(sig, Graphics::HEADER_MOSC_SIGNATURE, 4) == 0) {
// Parsing MOS or MOSC file
BytePtr mosData(nullptr, std::default_delete<uint8_t[]>());
BytePtr mosData(nullptr);
bool isMosc = true;
uint32_t mosSize;
uint16_t width, height, cols, rows;
Expand Down
1 change: 1 addition & 0 deletions tileconv/tiledata.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ THE SOFTWARE.
#ifndef _TILEDATA_H_
#define _TILEDATA_H_
#include <string>
#include <limits>
#include "types.h"
#include "options.h"

Expand Down
1 change: 0 additions & 1 deletion tileconv/zlib/remove.me

This file was deleted.