Skip to content

Commit

Permalink
Merge pull request #31 from PsyCommando/dev
Browse files Browse the repository at this point in the history
Merging change for Statsutil 0.23 to master
  • Loading branch information
PsyCommando authored Aug 23, 2016
2 parents dfe39b0 + 3715f06 commit 2b3a3e6
Show file tree
Hide file tree
Showing 199 changed files with 29,430 additions and 6,793 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,6 @@ Release WinXP
/ppmdutilities_dependencies.VC.db
/ppmdutilities.VC.db
ppmd3_utilities.VC.db
lib/whereami/_win-vs14/WhereAmI.VC.db
.vs/ppmd_statsutil/Supercharger.dat
/.vs
Empty file removed README
Empty file.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,19 @@ http://projectpokemon.org/wiki/Pokemon_Mystery_Dungeon_Explorers_of_Sky
Eventually more tools will come.
Even possibly full-fledged editors with a user interface! Ideally, I'd let 3rd parties make their own editors that uses my tools, as it lets me focus on research, while they can focus on making a good GUI. But we'll see.

## Licence:
## Portability:
This was mainly made on several version of Visual Studio. So while I tried to keep everything portable, and use portable
libraries, there might be some issues from time to time compiling on GCC or using Clang+LLVM.

### Mingw
If you're using Mingw on windows, I suggest you use MSys for building the dependencies. Especially since POCO for some reasons
won't compile on Mingw without some messing around. Unless if ran in MSys using ./configure and make.
The line I used to configure it is (Feel free to remove --static or --shared or add --no-tests and play around with it):
./configure --prefix=INSERT_PATH_TO_LIB_RELEASE_HERE --no-samples --no-tests --static --shared --omit=Crypto,NetSSL_OpenSSL,Zip,Data,Data/SQLite,Data/ODBC,Data/MySQL,MongoDB,PDF,CppParser,PageCompiler,Net

Then I just ran "make -j 8"(-j 8 is for 8 core machines) and "make install". The --minimal switch makes the whole thing only compile the

## License:
Those tools and their source code, excluding the content of the /lib/ directory (present only for convenience), is [Creative Common 0](https://creativecommons.org/publicdomain/zero/1.0/), AKA Public Domain.
Do what you want with it. Use the code in your coding horror museum, copy-paste it in your pmd2 tools, anything.. XD
You don't have to credit me, but its always appreciated if you do ! And I'd love to see what people will do with this code.
Expand Down
25 changes: 25 additions & 0 deletions lib/whereami/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--------------------------------------------------------------------------------
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004

Copyright (C) 2004 Sam Hocevar <[email protected]>

Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. You just DO WHAT THE FUCK YOU WANT TO.
1. Bla bla bla
2. Montesqieu et camembert, vive la France, zut alors!

--------------------------------------------------------------------------------

WTFPLv2 is very permissive, see http://www.wtfpl.net/faq/

However, if this WTFPLV2 is REALLY a blocker and is the reason you can't use
this project, contact me and I'll dual license it.

--------------------------------------------------------------------------------
118 changes: 118 additions & 0 deletions lib/whereami/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# Where Am I?

A drop-in two files library to locate the current executable and the current
module on the file system.

Supported platforms:

- Windows
- Linux
- Mac
- iOS
- Android
- QNX Neutrino
- FreeBSD

Just drop `whereami.h` and `whereami.c` into your build and get started. (see
also [customizing compilation])

[customizing compilation]: #customizing-compilation

--------------------------------------------------------------------------------

## Usage

- `wai_getExecutablePath()` returns the path of the enclosing executable
- `wai_getModulePath()` returns the path of the enclosing module

Example usage:

- first call `int length = wai_getExecutablePath(NULL, 0, NULL);` to retrieve
the length of the path
- allocate the destination buffer with `path = (char*)malloc(length + 1);`
- call `wai_getExecutablePath(path, length, &dirname_length)` again to retrieve
the path
- add a terminal `NUL` character with `path[length] = '\0';`

Here is the output of the example:

$ make -C _gnu-make
$ cp ./bin/mac-x86_64/library.dylib /tmp/
$ ./bin/mac-x86_64/executable --load-library=/tmp/library.dylib

executable path: /Users/gregory/Projects/whereami/bin/mac-x86_64/executable
dirname: /Users/gregory/Projects/whereami/bin/mac-x86_64
basename: executable
module path: /Users/gregory/Projects/whereami/bin/mac-x86_64/executable
dirname: /Users/gregory/Projects/whereami/bin/mac-x86_64
basename: executable

library loaded
executable path: /Users/gregory/Projects/whereami/bin/mac-x86_64/executable
dirname: /Users/gregory/Projects/whereami/bin/mac-x86_64
basename: executable
module path: /private/tmp/library.dylib
dirname: /private/tmp
basename: library.dylib
library unloaded

--------------------------------------------------------------------------------

## Customizing compilation

You can customize the library's behavior by defining the following macros:

- `WAI_FUNCSPEC`
- `WAI_PREFIX`
- `WAI_MALLOC`
- `WAI_REALLOC`
- `WAI_FREE`

## Compiling for Windows

There is a Visual Studio 2015 solution in the `_win-vs14/` folder.

## Compiling for Linux or Mac

There is a GNU Make 3.81 `MakeFile` in the `_gnu-make/` folder:

$ make -C _gnu-make/

## Compiling for Mac

See above if you want to compile from command line. Otherwise there is an Xcode
project located in the `_mac-xcode/` folder.

## Compiling for iOS

There is an Xcode project located in the `_ios-xcode/` folder.

If you prefer compiling from command line and deploying to a jailbroken device
through SSH, use:

$ make -C _gnu-make/ binsubdir=ios CC="$(xcrun --sdk iphoneos --find clang) -isysroot $(xcrun --sdk iphoneos --show-sdk-path) -arch armv7 -arch armv7s -arch arm64" postbuild="codesign -s 'iPhone Developer'"

## Compiling for Android

You will have to install the Android NDK, and point the `$NDK_ROOT` environment
variable to the NDK path: e.g. `export NDK_ROOT=/opt/android-ndk` (without a
trailing `/` character).

Next, the easy way is to make a standalone Android toolchain with the following
command:

$ $NDK_ROOT/build/tools/make-standalone-toolchain.sh --system=$(uname -s | tr [A-Z] [a-z])-$(uname -m) --platform=android-3 --arch=arm --install-dir=/tmp/android

Now you can compile the self test and self benchmark programs by running:

$ make -C _gnu-make/ libsuffix=.so binsubdir=android CC=/tmp/android/bin/arm-linux-androideabi-gcc CFLAGS='-march=armv7-a -mfloat-abi=softfp -O2'

--------------------------------------------------------------------------------

If you find this library useful and decide to use it in your own projects please
drop me a line [@gpakosz].

If you use it in a commercial project, consider using [Gittip].

[@gpakosz]: https://twitter.com/gpakosz
[Gittip]: https://www.gittip.com/gpakosz/
103 changes: 103 additions & 0 deletions lib/whereami/_gnu-make/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
.PHONY: build clean

# directories
ifeq ($(realpath .),)
$(error your version of Make doesn't support $$(realpath names...) - please use GNU Make 3.81 or later)
endif

ifeq ($(platform),)
__uname_s := $(shell sh -c 'uname -s 2>/dev/null | tr [A-Z] [a-z] || echo unknown-platform')
__uname_m := $(shell sh -c 'uname -m 2>/dev/null | tr [A-Z] [a-z] || echo unknown-architecture')

ifeq ($(__uname_s),linux)
override platform := linux
override architecture := $(__uname_m)
endif
ifeq ($(__uname_s),darwin)
override platform := mac
override architecture := $(__uname_m)
endif
ifeq ($(findstring mingw,$(__uname_s)),mingw)
override platform := windows
override architecture := $(if $(findstring MINGW32,$(MSYSTEM)),i686,$(if $(findstring MINGW64,$(MSYSTEM)),x86_64,))
ifeq ($(CC),cc)
override CC := gcc
endif
endif
ifeq ($(__uname_s),freebsd)
override platform := freebsd
override architecture := $(__uname_m)
endif
endif
ifeq ($(architecture),)
override architecture := unknown-architecture
endif

prefix := $(realpath ..)
srcdir := $(realpath ../src)
exampledir := $(realpath ../example)
testdir := $(realpath ../test)
buildir := $(realpath .)/build
binsubdir := $(platform)-$(architecture)
bindir := $(prefix)/bin/$(binsubdir)

CFLAGS := -O2 -g -Wall -pedantic -Werror -std=c99
CXXFLAGS := -O2 -g -Wall -pedantic -Werror

ifeq ($(platform),linux)
LDFLAGS += -ldl
CFLAGS += -D_XOPEN_SOURCE=500 -fpic
CXXFLAGS += -fpic
endif
ifeq ($(platform),mac)
CFLAGS += -D_DARWIN_C_SOURCE
endif
ifeq ($(platform),freebsd)
CFLAGS += -fpic
CXXFLAGS += -fpic
endif

ifeq ($(platform),mac)
libsuffix := .dylib
endif
ifeq ($(platform),linux)
libsuffix := .so
endif
ifeq ($(platform),windows)
libsuffix := .dll
endif
ifeq ($(platform),freebsd)
libsuffix := .so
endif

.PHONY: build-executable
build: build-executable
build-executable: $(bindir)/executable $(bindir)/executable-cpp

$(bindir)/executable: $(srcdir)/whereami.c $(srcdir)/whereami.h $(exampledir)/executable.c
mkdir -p $(@D)
$(CC) -o $@ -I $(srcdir) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(filter-out %.h,$^)
$(if $(postbuild),$(postbuild) $@)

$(bindir)/executable-cpp: $(srcdir)/whereami.c $(srcdir)/whereami.h $(exampledir)/executable.c
mkdir -p $(@D)
$(CXX) -x c++ -o $@ -I $(srcdir) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(filter-out %.h,$^)
$(if $(postbuild),$(postbuild) $@)

.PHONY: build-library
build: build-library
build-library: $(bindir)/library$(libsuffix) $(bindir)/library-cpp$(libsuffix)

$(bindir)/library$(libsuffix): $(srcdir)/whereami.c $(srcdir)/whereami.h $(exampledir)/library.c
mkdir -p $(@D)
$(CC) -shared -o $@ -I $(srcdir) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(filter-out %.h,$^)
$(if $(postbuild),$(postbuild) $@)

$(bindir)/library-cpp$(libsuffix): $(srcdir)/whereami.c $(srcdir)/whereami.h $(exampledir)/library.c
mkdir -p $(@D)
$(CXX) -x c++ -shared -o $@ -I $(srcdir) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(filter-out %.h,$^)
$(if $(postbuild),$(postbuild) $@)

clean:
rm -rf $(buildir)
rm -rf $(bindir)
47 changes: 47 additions & 0 deletions lib/whereami/_ios-xcode/WhereAmI-Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>net.pempek.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UIRequiresFullScreen</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
Loading

0 comments on commit 2b3a3e6

Please sign in to comment.