Skip to content

Commit

Permalink
Windows, test program.
Browse files Browse the repository at this point in the history
  • Loading branch information
brett-smith committed Jun 26, 2023
1 parent 3e390c6 commit da4354c
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 7 deletions.
18 changes: 14 additions & 4 deletions NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ We need to build on various architectures and place the resultant shared librari
## Cross Compiling Libsixel for Windows 32 bit

```
CC=i686-w64-mingw32-gcc cross_compile=yes ./configure --host=i686-w64-mingw32 --without-libpng --without-libcurl --disable-python
CC=i686-w64-mingw32-gcc cross_compile=yes ./configure --host=i686-w64-mingw32 --without-png --without-libcurl --disable-python
make
cp src/.libs/libsixel-1.dll /path/to/jsixel/src/main/resources/win32-x86
cp src/.libs/libsixel-1.dll /path/to/jsixel/src/main/resources/win32-x86/sixel.dll
```

# Cross Compiling Libsixe for Windows 64 bit
## Cross Compiling Libsixel for Windows 64 bit

**FAILS TO BUILD**

```
CC=x86_64-w64-mingw32-g++ cross_compile=yes ./configure --without-libcurl --disable-python --without-libpng --host=x86_64-w32-mingw64
CC=x86_64-w64-mingw32-g++ cross_compile=yes ./configure --without-libcurl --disable-python --without-png --host=x86_64-w32-mingw64
make
```

Expand All @@ -31,4 +31,14 @@ results in.
```

## Using MSYS2 on Windows

As an alternative way to build 64 bit. Use MSYS2 on a Windows host.

```
./configure --without-png --without-libcurl --disable-python --disable-dependency-tracking
make
cp src/.libs/libsixel-1.dll /path/to/jsixel/src/main/resources/win32-x86-64/sixel.dll
```


36 changes: 33 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<version>0.0.1-SNAPSHOT</version>
<name>jsixel - JNA based Java bindings for libsixel</name>
<properties>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
Expand Down Expand Up @@ -82,7 +82,7 @@
<plugins>
<plugin>
<groupId>com.nativelibs4java</groupId>
<artifactId>maven-jnaerator-plugin</artifactId>
<artifactId>maven-jnaerator-plugin</artifactId>
<version>0.12</version>
</plugin>
</plugins>
Expand Down Expand Up @@ -199,6 +199,36 @@
</pluginManagement>
</build>
<profiles>
<profile>
<id>shaded</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.sshtools.jsixel.Jsixel</mainClass>
</transformer>
</transformers>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>launcher</shadedClassifierName>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>release-sign-artifacts</id>
<activation>
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/com/sshtools/jsixel/Jsixel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.sshtools.jsixel;

import java.nio.channels.Channels;

import com.sshtools.jsixel.converter.Converter;
import com.sshtools.jsixel.image.PNGDecoder;
import com.sun.jna.Platform;

public class Jsixel {

public static void main(String[] args) throws Exception {
System.out.println("Resource path: " + Platform.RESOURCE_PREFIX);
try(var in = Jsixel.class.getResource("jsixel.png").openStream()) {
new Converter(new PNGDecoder(in)).write(Channels.newChannel(System.out));
}
}
}
Binary file added src/main/resources/com/sshtools/jsixel/jsixel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/win32-x86-64/sixel.dll
Binary file not shown.
File renamed without changes.

0 comments on commit da4354c

Please sign in to comment.