PoC CGO wrapper and sample command-line utility
This commit is contained in:
parent
65eccee074
commit
e4c1fbf490
20
cmd/gopngquant/main.go
Normal file
20
cmd/gopngquant/main.go
Normal file
@ -0,0 +1,20 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"code.ivysaur.me/imagequant"
|
||||
)
|
||||
|
||||
func main() {
|
||||
ShouldDisplayVersion := flag.Bool("Version", false, "")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
if *ShouldDisplayVersion {
|
||||
fmt.Printf("libimagequant %d\n", imagequant.GetLibraryVersion())
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
14
imagequant.go
Normal file
14
imagequant.go
Normal file
@ -0,0 +1,14 @@
|
||||
package imagequant
|
||||
|
||||
/*
|
||||
#cgo CFLAGS: -O3 -fno-math-errno -fopenmp -funroll-loops -fomit-frame-pointer -Wall -Wno-attributes -std=c99 -DNDEBUG -DUSE_SSE=1 -msse -fexcess-precision=fast
|
||||
#cgo LDFLAGS: -fopenmp -static
|
||||
#include "libimagequant.h"
|
||||
*/
|
||||
import (
|
||||
"C"
|
||||
)
|
||||
|
||||
func GetLibraryVersion() int {
|
||||
return int(C.liq_version())
|
||||
}
|
Loading…
Reference in New Issue
Block a user