Switched over to cmake. Everything now works in one command.

This commit is contained in:
Fatbag 2012-01-28 12:11:34 -06:00
parent b3985e7306
commit 17c3bb1145
20 changed files with 179 additions and 203 deletions

View file

@ -0,0 +1,4 @@
add_subdirectory(libpng)
add_subdirectory(utk)
add_subdirectory(xa)
add_subdirectory(zlib)

View file

@ -1 +0,0 @@
filehandler: bmp cmx ini libfar libjpeg-turbo libpng mpg123 tga vtd-xml wav xa zlib

View file

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 2.6)
project(utk)
set(UTK_SOURCES
read_utk.c
utkdecode.c
)
add_executable(utkdecode ${UTK_SOURCES})

View file

@ -1,30 +0,0 @@
# macros --------------------------------------------------------------------
CC = gcc
LD = gcc
CFLAGS = -m32 -Wall -Wextra -Wabi -Os -march=i686 -fomit-frame-pointer -g0
LDFLAGS = -m32 -s -fwhole-program
AR = ar rcs
WINDRES = windres -F pe-i386
OBJECTS = obj/read_utk.o obj/utkdecode.o
# These will rebuild the entire library upon edit.
DEPS = Makefile \
read_utk.h
# dependencies --------------------------------------------------------------
all: utkdecode.exe
$(OBJECTS): $(DEPS)
utkdecode.exe: $(OBJECTS)
$(CC) $(LDFLAGS) -o $@ $(OBJECTS)
# make rules ----------------------------------------------------------------
obj/%.o: %.c
$(CC) -c -ansi -pedantic $(CFLAGS) -o $@ $<
# maintenance ---------------------------------------------------------------
clean:
del /Q /S obj utkdecode.exe

View file

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 2.6)
project(xa)
set(XA_SOURCES
read_xa.c
xadecode.c
)
add_executable(xadecode ${XA_SOURCES})

View file

@ -1,30 +0,0 @@
# macros --------------------------------------------------------------------
CC = gcc
LD = gcc
CFLAGS = -m32 -Wall -Wextra -Wabi -Os -march=i686 -fomit-frame-pointer -ffast-math -funsafe-loop-optimizations -fmerge-all-constants -g0 -fno-exceptions
LDFLAGS = -m32 -s -fwhole-program
AR = ar rcs
WINDRES = windres -F pe-i386
OBJECTS = obj/read_xa.o obj/xadecode.o
# These will rebuild the entire library upon edit.
DEPS = Makefile \
read_xa.h
# dependencies --------------------------------------------------------------
all: xadecode.exe
$(OBJECTS): $(DEPS)
xadecode.exe: $(OBJECTS)
$(CC) $(LDFLAGS) -o $@ $(OBJECTS)
# make rules ----------------------------------------------------------------
obj/%.o: %.c
$(CC) -c -ansi -pedantic $(CFLAGS) -o $@ $<
# maintenance ---------------------------------------------------------------
clean:
del /Q /S obj xadecode.exe

View file

@ -1,5 +1,5 @@
/*
xadecode.c - Copyright (c) 2011 Fatbag <X-Fi6@phppoll.org>
xadecode.c - Copyright (c) 2011-2012 Fatbag <X-Fi6@phppoll.org>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@ -39,6 +39,7 @@ int main(int argc, char *argv[]){
DWORD bytestransferred = 0;
uint8_t * XAData;
xaheader_t XAHeader;
unsigned BeginningTime, EndingTime;
if(argc == 1 || !strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")){
printf("Usage: xadecode [-f] infile outfile\n"
@ -106,10 +107,12 @@ int main(int argc, char *argv[]){
return -1;
}
BeginningTime = GetTickCount();
if(!xa_decode(XAData+24, WaveData+44, XAHeader.Frames, XAHeader.nChannels)){
printf("%sMemory for this file could not be allocated.", "xadecode: error: ");
return -1;
}
EndingTime = GetTickCount();
HeapFree(ProcessHeap, HEAP_NO_SERIALIZE, XAData);
@ -154,6 +157,8 @@ int main(int argc, char *argv[]){
return -1;
}
}
printf("Extracted %u bytes in %.2f seconds.\n", (unsigned) XAHeader.dwOutSize,
((float) (EndingTime - BeginningTime))/1000);
WriteFile(hFile, WaveData, 44+XAHeader.dwOutSize, &bytestransferred, NULL);
CloseHandle(hFile);
}