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

82
CMakeLists.txt Normal file
View file

@ -0,0 +1,82 @@
#########################################
#### CMake generator file for Niotso ####
cmake_minimum_required(VERSION 2.6)
project(Niotso)
# Installation directory
set(CMAKE_INSTALL_PREFIX "c:/Program Files (x86)/Maxis/The Sims Online/Niotso" CACHE FILEPATH "Installation directory")
# Build type
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build configurations: Release Debug Release-MakeProfile Release-UseProfile")
else()
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build configurations: Release Debug")
endif()
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
# Base options
set(CFLAGS "-Wall -Wextra -Wabi -m32 -mmmx -msse -msse2 -msse3 -mfpmath=both -msahf")
set(LDFLAGS "-m32")
set(RCFLAGS "-F pe-i386")
set(ASMFLAGS "-O3 -F win32")
set(CFLAGS_LANG_C "-ansi")
set(CFLAGS_LANG_CPP "-fno-exceptions -fno-rtti")
####
## [Profiles]
if(NOT (CMAKE_BUILD_TYPE MATCHES "Debug"))
if(CMAKE_BUILD_TYPE MATCHES "Release-MakeProfile")
set(CFLAGS "${CFLAGS} -fprofile-generate")
set(LDFLAGS "${LDFLAGS} -lgcov")
elseif(CMAKE_BUILD_TYPE MATCHES "Release-UseProfile")
set(CFLAGS "${CFLAGS} -fprofile-use")
endif()
# Size
set(CFLAGS_SIZE "${CFLAGS} -Os -g0 -fomit-frame-pointer -ffast-math -fmerge-all-constants -funsafe-loop-optimizations -fmerge-all-constants -fsched-pressure")
set(LDFLAGS_SIZE "${LDFLAGS} -s")
# Speed
set(CFLAGS_SPEED "${CFLAGS} -O3 -g0 -fomit-frame-pointer -ffast-math -fmerge-all-constants -funsafe-loop-optimizations -fmerge-all-constants -fsched-pressure -fmodulo-sched -fmodulo-sched-allow-regmoves -fgcse-sm -fgcse-las -fsched-spec-load -fsched-spec-load-dangerous -fsched-stalled-insns=0 -fsched-stalled-insns-dep -fsched2-use-superblocks -fipa-pta -fipa-matrix-reorg -ftree-loop-linear -floop-interchange -floop-strip-mine -floop-block -fgraphite-identity -floop-parallelize-all -ftree-loop-distribution -ftree-loop-im -ftree-loop-ivcanon -fivopts -fvect-cost-model -fvariable-expansion-in-unroller -fbranch-target-load-optimize -maccumulate-outgoing-args -fwhole-program -flto")
set(LDFLAGS_SPEED "${LDFLAGS} -s -fwhole-program -flto")
else()
# Debug
set(CFLAGS_DEBUG "${CFLAGS} -O0 -g3")
set(LDFLAGS_DEBUG "${LDFLAGS}")
set(CFLAGS_SIZE "${CFLAGS_DEBUG}")
set(LDFLAGS_SIZE "${LDFLAGS_DEBUG}")
set(CFLAGS_SPEED "${CFLAGS_DEBUG}")
set(LDFLAGS_SPEED "${LDFLAGS_DEBUG}")
endif()
set(CMAKE_C_FLAGS "${CFLAGS_LANG_C} ${CFLAGS_SIZE}")
set(CMAKE_CXX_FLAGS "${CFLAGS_LANG_CPP} ${CFLAGS_SIZE}")
set(CMAKE_SHARED_LINKER_FLAGS "${LDFLAGS} ${LDFLAGS_SIZE}")
set(CMAKE_EXE_LINKER_FLAGS "${LDFLAGS} ${LDFLAGS_SIZE}")
set(CMAKE_RC_FLAGS "${RCFLAGS}")
endif()
if(WIN32)
set(DIST_NAME "windows" CACHE STRING "Output folder name for the _dist folder (no start or end slash)")
elseif(APPLE)
set(DIST_NAME "mac" CACHE STRING "Output folder name for the _dist folder (no start or end slash)")
elseif(UNIX)
set(DIST_NAME "linux" CACHE STRING "Output folder name for the _dist folder (no start or end slash)")
else()
set(DIST_NAME "unknown" CACHE STRING "Output folder name for the _dist folder (no start or end slash)")
endif()
#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/_dist/${DIST_NAME}") (-flto means our archive files should not be redistributed)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/_dist/${DIST_NAME}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/_dist/${DIST_NAME}")
add_subdirectory(Client)
add_subdirectory(Libraries)
add_subdirectory(Server)
add_subdirectory(Tools)

View file

@ -1,6 +1,13 @@
All you need installed to compile Niotso for Windows, Linux, or Mac is GCC 4.6 or newer, and NASM for libjpeg-turbo.
All you need installed to compile Niotso for Windows, Linux, or Mac is cmake 2.6 or newer, a compatible compiler (such as GCC 4.6 or newer), and NASM 2.0 or newer for libjpeg-turbo.
Run "make" in this directory to compile every package. -j # will greatly speed up the compile time for processors with # cores.
cd into the _build directory and run
$ cmake -G "<Generator name>" ..
The list of generators can be found with cmake --help.
//-- Makefile
Run "make" to compile every package. -j # will greatly speed up the compile time for processors with # cores.
Run "make install" after compiling to install Niotso to your game directory; please specify it first in the Makefile.
Run "make objclean" to delete all object files created during compilation.
@ -10,5 +17,9 @@ Run "make uninstall" to delete Niotso from your game directory.
Run "make uninstall_all" to delete Niotso from your game directory as well as all Niotso.ini files created by Niotso.
Run "make <component>" to compile only a specific package.
For a list of packages, see packages.makefile.
Note that packages must and will compile any other packages required as a dependency.
For a list of packages, run "make help".
Note that packages must and will compile any other packages required as a dependency.
//-- Code::Blocks, Visual Studio, XCode
Open the solution or project file; you may select between a Release, Debug, Release64, and Debug64 build configuration.

3
Libraries/CMakeLists.txt Normal file
View file

@ -0,0 +1,3 @@
add_subdirectory(FileHandler)
add_subdirectory(freetype)
add_subdirectory(libvitaboy)

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);
}

View file

View file

@ -1,97 +0,0 @@
#######################################
#### Makefile for compiling Niotso ####
# Environment (valid options: cmd posix)
buildenv = cmd
# Installation directory (do not use backslashes)
installdir = c:/Program Files (x86)/Maxis/The Sims Online/Niotso
# Debugging (valid options: yes no)
debug = no
# Profile-guided optimization (valid options: none instrument optimize)
pgo = none
CC = gcc
LD = gcc
AR = ar
RC = windres
# Base options
CFLAGS = -m32 -mmx -sse -sse2 -sse3 -mfpmath=both -msahf
LDFLAGS = -m32 -static -static-libgcc
ARFLAGS = rcs
RCFLAGS = -F pe-i386
CFLAGS_LANG_C = -ansi
CFLAGS_LANG_CPP = -std=c++98
####
## [Profiles]
# Size
CFLAGS_SIZE = $(CFLAGS) -Os -g0 -fomit-frame-pointer -ffast-math -fmerge-all-constants -funsafe-loop-optimizations -fsched-pressure -fno-enforce-eh-specs
LDFLAGS_SIZE = $(LDFLAGS) -s
# Speed
CFLAGS_SPEED = $(CFLAGS) -O3 -g0 -fomit-frame-pointer -ffast-math -fmerge-all-constants -funsafe-loop-optimizations -fsched-pressure -fno-enforce-eh-specs -fmodulo-sched -fmodulo-sched-allow-regmoves -fgcse-sm -fgcse-las -fsched-spec-load -fsched-spec-load-dangerous -fsched-stalled-insns=0 -fsched-stalled-insns-dep -fsched2-use-superblocks -fipa-pta -fipa-matrix-reorg -ftree-loop-linear -floop-interchange -floop-strip-mine -floop-block -fgraphite-identity -floop-parallelize-all -ftree-loop-distribution -ftree-loop-im -ftree-loop-ivcanon -fivopts -fvect-cost-model -fvariable-expansion-in-unroller -fbranch-target-load-optimize -maccumulate-outgoing-args -fwhole-program -flto
LDFLAGS_SPEED = $(LDFLAGS) -s -flto
# Debug
CFLAGS_DEBUG = $(CFLAGS) -O0 -g3
LDFLAGS_DEBUG = $(LDFLAGS)
WARNINGS = -Wall -Wextra -Wabi -pedantic
ifeq($(debug), yes)
CFLAGS_SIZE = $(CFLAGS_DEBUG)
CFLAGS_SPEED = $(CFLAGS_DEBUG)
LDFLAGS_SIZE = $(LDFLAGS_DEBUG)
LDFLAGS_SPEED = $(LDFLAGS_DEBUG)
endif
####
## [Miscellaneous]
ifeq ($(buildenv),cmd)
RM_R = -@del /s /q
CP_F = copy /y
EXE = .exe
DLL = .dll
else
RM_R = -@rm -r
CP_F = cp -f
EXE =
DLL = .so
endif
ifeq ($(pgo),instrument)
CFLAGS += -fprofile-generate
LDFLAGS += -lgcov
else ifeq ($(pgo),optimize)
CFLAGS += -fprofile-use
endif
niotso_buildsys = 1
####
## [Targets]
include packages.makefile
filter_obj = *.o *.lo *.la *.Plo *.Pla *.gch *.pch *.obj *.res *.exp *.dep *.aps *.intermediate.manifest
filter_exe = *.a *.lib $(niotso_exes) $(niotso_dlls)
filter_profile = *.gcda
filter_dist = *.dsp *.dsw *.user *.ncb *.pdb *.idb *.opt *.plg *.suo BuildLog.htm
objclean:
$(RM_R) $(filter_obj)
clean: objclean
$(RM_R) $(filter_obj) $(filter_exe)
profileclean:
$(RM_R) $(filter_profile)
distclean:
$(RM_R) $(filter_obj) $(filter_exe) $(filter_profile) $(filter_dist)

0
Server/CMakeLists.txt Normal file
View file

1
Tools/CMakeLists.txt Normal file
View file

@ -0,0 +1 @@
add_subdirectory(FARDive)

View file

@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 2.6)
project(FARDive)
if(WIN32)
set(FARDIVE_SOURCES
windows/common.cpp
windows/Interaction.cpp
windows/MainWindow.cpp
windows/ReadPNGIcon.cpp
windows/Resource.rc
windows/Startup.cpp
windows/Dialog/AddToArchive.cpp
windows/Dialog/NewArchive.cpp
)
set(FARDIVE_LINK -mwindows ole32 uxtheme)
endif()
add_executable(FARDive ${FARDIVE_SOURCES})
target_link_libraries(FARDive ${FARDIVE_LINK} libpng_shared)

View file

@ -1,5 +1,5 @@
#include <windows.h>
#include "../libpng-1.5.6/png.h"
#include "../../../Libraries/FileHandler/libpng/png.h"
extern HDC hDC;

View file

@ -1,6 +1,6 @@
#include "Windows.hpp"
#include "GUI.hpp"
#include "../libpng-1.5.6/png.h"
#include "../../../Libraries/FileHandler/libpng/png.h"
HBITMAP PNGIcon[MENUICONS];

View file

@ -3,8 +3,8 @@
#include "../version.hpp"
#include "resource.hpp"
ID_MANIFEST RT_MANIFEST "resources/Windows/FARDive.exe.manifest"
IDI_FARDIVE ICON "resources/Windows/FARDive.ico"
ID_MANIFEST RT_MANIFEST "../resources/Windows/FARDive.exe.manifest"
IDI_FARDIVE ICON "../resources/Windows/FARDive.ico"
ID_VERSIONINFO VERSIONINFO
FILEVERSION FD_VERSION_A,FD_VERSION_B,FD_VERSION_C,FD_REVISION
@ -82,34 +82,34 @@ BEGIN
END
END
IDI_FILE_NEW RCDATA "resources/icons/document-new.png"
IDI_FILE_OPEN RCDATA "resources/icons/document-open.png"
IDI_FILE_SAVE RCDATA "resources/icons/document-save.png"
IDI_FILE_SAVEAS RCDATA "resources/icons/document-save-as.png"
IDI_FILE_ADD RCDATA "resources/icons/list-add.png"
IDI_FILE_EXPORTALL RCDATA "resources/icons/package-x-generic.png"
IDI_FILE_EXPORTSELECTED RCDATA "resources/icons/package-x-generic-selected.png"
IDI_FILE_CHANGETYPE RCDATA "resources/icons/applications-other.png"
IDI_FILE_CLOSE RCDATA "resources/icons/emblem-unreadable.png"
IDI_FILE_EXIT RCDATA "resources/icons/system-log-out.png"
IDI_EDIT_DUPLICATE RCDATA "resources/icons/edit-copy.png"
IDI_EDIT_REMOVE RCDATA "resources/icons/list-remove.png"
IDI_EDIT_RENAME RCDATA "resources/icons/edit-select-all.png"
IDI_EDIT_PROPERTIES RCDATA "resources/icons/document-properties.png"
IDI_EDIT_CONTENTS RCDATA "resources/icons/accessories-text-editor.png"
IDI_EDIT_FIND RCDATA "resources/icons/edit-find.png"
IDI_EDIT_FINDNEXT RCDATA "resources/icons/go-last.png"
IDI_EDIT_FINDPREVIOUS RCDATA "resources/icons/go-first.png"
IDI_EDIT_MATCHES RCDATA "resources/icons/preferences-system-windows.png"
IDI_EDIT_GOTO RCDATA "resources/icons/go-jump.png"
IDI_EDIT_PREFERENCES RCDATA "resources/icons/preferences-desktop.png"
IDI_TOOLS_RECOMPRESS RCDATA "resources/icons/system-file-manager.png"
IDI_TOOLS_RESORT RCDATA "resources/icons/mail-send-receive.png"
IDI_TOOLS_REMOVEHOLES RCDATA "resources/icons/edit-clear.png"
IDI_TOOLS_BATCH RCDATA "resources/icons/utilities-terminal.png"
IDI_HELP_WEBSITE RCDATA "resources/icons/internet-web-browser.png"
IDI_FILE_NEW RCDATA "../resources/icons/document-new.png"
IDI_FILE_OPEN RCDATA "../resources/icons/document-open.png"
IDI_FILE_SAVE RCDATA "../resources/icons/document-save.png"
IDI_FILE_SAVEAS RCDATA "../resources/icons/document-save-as.png"
IDI_FILE_ADD RCDATA "../resources/icons/list-add.png"
IDI_FILE_EXPORTALL RCDATA "../resources/icons/package-x-generic.png"
IDI_FILE_EXPORTSELECTED RCDATA "../resources/icons/package-x-generic-selected.png"
IDI_FILE_CHANGETYPE RCDATA "../resources/icons/applications-other.png"
IDI_FILE_CLOSE RCDATA "../resources/icons/emblem-unreadable.png"
IDI_FILE_EXIT RCDATA "../resources/icons/system-log-out.png"
IDI_EDIT_DUPLICATE RCDATA "../resources/icons/edit-copy.png"
IDI_EDIT_REMOVE RCDATA "../resources/icons/list-remove.png"
IDI_EDIT_RENAME RCDATA "../resources/icons/edit-select-all.png"
IDI_EDIT_PROPERTIES RCDATA "../resources/icons/document-properties.png"
IDI_EDIT_CONTENTS RCDATA "../resources/icons/accessories-text-editor.png"
IDI_EDIT_FIND RCDATA "../resources/icons/edit-find.png"
IDI_EDIT_FINDNEXT RCDATA "../resources/icons/go-last.png"
IDI_EDIT_FINDPREVIOUS RCDATA "../resources/icons/go-first.png"
IDI_EDIT_MATCHES RCDATA "../resources/icons/preferences-system-windows.png"
IDI_EDIT_GOTO RCDATA "../resources/icons/go-jump.png"
IDI_EDIT_PREFERENCES RCDATA "../resources/icons/preferences-desktop.png"
IDI_TOOLS_RECOMPRESS RCDATA "../resources/icons/system-file-manager.png"
IDI_TOOLS_RESORT RCDATA "../resources/icons/mail-send-receive.png"
IDI_TOOLS_REMOVEHOLES RCDATA "../resources/icons/edit-clear.png"
IDI_TOOLS_BATCH RCDATA "../resources/icons/utilities-terminal.png"
IDI_HELP_WEBSITE RCDATA "../resources/icons/internet-web-browser.png"
IDB_INFO BITMAP "resources/icons/info.bmp"
IDB_INFO BITMAP "../resources/icons/info.bmp"
ID_ACCELERATOR ACCELERATORS
BEGIN

View file

@ -1,9 +0,0 @@
####
## [Packages]
all: client filehandler server fardive
include Client/Makefile
include Libraries/FileHandler/Makefile
include Server/Makefile
include Tools/FARDive/Makefile