Fixed Linux build
This commit is contained in:
parent
ccbd3ed107
commit
b95a3f621c
|
@ -17,6 +17,11 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STRE
|
|||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
|
||||
endif()
|
||||
|
||||
# Enable POSIX threads
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -lpthread")
|
||||
endif()
|
||||
|
||||
# Make sure Xcode uses libc++ instead of libstdc++, allowing us to use the C++14 standard library prior to OS X 10.9
|
||||
if("${CMAKE_GENERATOR}" STREQUAL "Xcode")
|
||||
add_compile_options(-stdlib=libc++)
|
||||
|
@ -44,6 +49,10 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
|
||||
endif()
|
||||
|
||||
if(${UNIX})
|
||||
add_definitions(-DHAVE_UNISTD_H)
|
||||
endif()
|
||||
|
||||
# Enable project folders
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
|
@ -53,7 +62,7 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|||
set(Boost_USE_STATIC_LIBS ON) # Use static libs
|
||||
set(Boost_USE_MULTITHREADED ON) # Enable multithreading support
|
||||
set(Boost_USE_STATIC_RUNTIME ON) # Use static C++ runtime
|
||||
find_package(Boost REQUIRED COMPONENTS filesystem locale system)
|
||||
find_package(Boost 1.58 REQUIRED COMPONENTS filesystem locale system)
|
||||
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
|
||||
|
||||
# ... C++ Format
|
||||
|
@ -116,11 +125,16 @@ set(webRTCFiles
|
|||
)
|
||||
add_library(webRTC ${webRTCFiles})
|
||||
target_compile_options(webRTC PRIVATE ${disableWarningsFlags})
|
||||
target_compile_options(webRTC PRIVATE -pthread -lpthread)
|
||||
if (NOT WIN32)
|
||||
target_compile_definitions(webRTC PRIVATE WEBRTC_POSIX)
|
||||
endif()
|
||||
set_target_properties(webRTC PROPERTIES FOLDER lib)
|
||||
|
||||
# ... whereami
|
||||
include_directories(SYSTEM "lib/whereami/src")
|
||||
add_library(whereami lib/whereami/src/whereami.c)
|
||||
|
||||
# ... Flite
|
||||
include_directories("lib/flite-1.4/include" "lib/flite-1.4")
|
||||
set(fliteFiles
|
||||
|
@ -230,7 +244,7 @@ set(SOURCE_FILES
|
|||
src/Lazy.h
|
||||
)
|
||||
add_executable(rhubarb ${SOURCE_FILES})
|
||||
target_link_libraries(rhubarb ${Boost_LIBRARIES} cppFormat sphinxbase pocketSphinx flite webRTC)
|
||||
target_link_libraries(rhubarb ${Boost_LIBRARIES} cppFormat sphinxbase pocketSphinx flite webRTC whereami)
|
||||
target_compile_options(rhubarb PUBLIC ${enableWarningsFlags})
|
||||
|
||||
# Define test project
|
||||
|
@ -258,7 +272,7 @@ set(TEST_FILES
|
|||
src/Lazy.h
|
||||
)
|
||||
add_executable(runTests ${TEST_FILES})
|
||||
target_link_libraries(runTests ${Boost_LIBRARIES} gtest gmock gmock_main flite cppFormat)
|
||||
target_link_libraries(runTests ${Boost_LIBRARIES} gtest gmock gmock_main flite cppFormat whereami)
|
||||
|
||||
set(CPACK_PACKAGE_NAME ${appName})
|
||||
string(REPLACE " " "-" CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}")
|
||||
|
|
22
LICENSE.md
22
LICENSE.md
|
@ -175,3 +175,25 @@ The [WebRTC](https://chromium.googlesource.com/external/webrtc) library is relea
|
|||
> * Neither the name of Google nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
### `[whereami]` Where Am I?
|
||||
|
||||
The [Where Am I?](https://github.com/gpakosz/whereami) library is released under the **DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE**.
|
||||
|
||||
> DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
> Version 2, December 2004
|
||||
>
|
||||
> Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
>
|
||||
> 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.
|
||||
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
* text=auto
|
||||
|
||||
# sources
|
||||
*.h text diff=cpp
|
||||
*.c text diff=cpp
|
||||
*.cpp text diff=cpp
|
||||
*.rb text diff=ruby
|
||||
*.html text diff=html
|
||||
*.m text diff=objc
|
||||
|
||||
# shell scripts
|
||||
*.sh eol=lf
|
||||
|
||||
# GNU Makefile
|
||||
Makefile text eol=lf
|
||||
|
||||
# Autotools
|
||||
*.am text eol=lf
|
||||
|
||||
# Android
|
||||
*.mk text eol=lf
|
||||
|
||||
# Xcode files
|
||||
*.pbxproj text eol=lf merge=union
|
||||
|
||||
# Visual Studio files
|
||||
*.sln text eol=crlf merge=union
|
||||
*.vcxproj text eol=crlf merge=union
|
||||
*.vcxproj.filters text eol=crlf merge=union
|
||||
*.props text eol=crlf
|
|
@ -0,0 +1,5 @@
|
|||
.DS_Store
|
||||
*~
|
||||
*.swp
|
||||
|
||||
/bin
|
|
@ -0,0 +1,25 @@
|
|||
--------------------------------------------------------------------------------
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
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.
|
||||
|
||||
--------------------------------------------------------------------------------
|
|
@ -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/
|
|
@ -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)
|
|
@ -0,0 +1,2 @@
|
|||
xcuserdata/
|
||||
xcshareddata/
|
|
@ -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>
|
|
@ -0,0 +1,327 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
1A1E0A8D1A4486A300611947 /* whereami.c in Sources */ = {isa = PBXBuildFile; fileRef = 1A1E0A8B1A4486A300611947 /* whereami.c */; };
|
||||
1A1E0A8F1A4486A900611947 /* executable.c in Sources */ = {isa = PBXBuildFile; fileRef = 1A1E0A8E1A4486A900611947 /* executable.c */; };
|
||||
1A1E0AAC1A4486FB00611947 /* library.c in Sources */ = {isa = PBXBuildFile; fileRef = 1A1E0AAB1A4486FB00611947 /* library.c */; };
|
||||
1A1E0AAD1A44880600611947 /* whereami.c in Sources */ = {isa = PBXBuildFile; fileRef = 1A1E0A8B1A4486A300611947 /* whereami.c */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
1A1E0A921A4486E800611947 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "include/$(PRODUCT_NAME)";
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
1A1E0A891A44868400611947 /* WhereAmI-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "WhereAmI-Info.plist"; sourceTree = "<group>"; };
|
||||
1A1E0A8B1A4486A300611947 /* whereami.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = whereami.c; sourceTree = "<group>"; };
|
||||
1A1E0A8C1A4486A300611947 /* whereami.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = whereami.h; sourceTree = "<group>"; };
|
||||
1A1E0A8E1A4486A900611947 /* executable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = executable.c; sourceTree = "<group>"; };
|
||||
1A1E0A941A4486E800611947 /* library.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = library.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A1E0AAB1A4486FB00611947 /* library.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = library.c; sourceTree = "<group>"; };
|
||||
1A98F9C917A4018400BF09FF /* executable.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = executable.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
1A1E0A911A4486E800611947 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
1A98F9C617A4018400BF09FF /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
1A7335C3182EC2E000691A33 /* src */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1A1E0A8B1A4486A300611947 /* whereami.c */,
|
||||
1A1E0A8C1A4486A300611947 /* whereami.h */,
|
||||
);
|
||||
name = src;
|
||||
path = ../src;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1A7335C4182EC30100691A33 /* example */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1A1E0AAB1A4486FB00611947 /* library.c */,
|
||||
1A1E0A8E1A4486A900611947 /* executable.c */,
|
||||
);
|
||||
name = example;
|
||||
path = ../example;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1A98F9C017A4018400BF09FF = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1A1E0A891A44868400611947 /* WhereAmI-Info.plist */,
|
||||
1A7335C3182EC2E000691A33 /* src */,
|
||||
1A7335C4182EC30100691A33 /* example */,
|
||||
1A98F9CA17A4018400BF09FF /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1A98F9CA17A4018400BF09FF /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1A98F9C917A4018400BF09FF /* executable.app */,
|
||||
1A1E0A941A4486E800611947 /* library.dylib */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
1A1E0A931A4486E800611947 /* library */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 1A1E0AA51A4486E900611947 /* Build configuration list for PBXNativeTarget "library" */;
|
||||
buildPhases = (
|
||||
1A1E0A901A4486E800611947 /* Sources */,
|
||||
1A1E0A911A4486E800611947 /* Frameworks */,
|
||||
1A1E0A921A4486E800611947 /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = library;
|
||||
productName = library;
|
||||
productReference = 1A1E0A941A4486E800611947 /* library.dylib */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
1A98F9C817A4018400BF09FF /* executable */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 1A98F9E617A4018400BF09FF /* Build configuration list for PBXNativeTarget "executable" */;
|
||||
buildPhases = (
|
||||
1A98F9C517A4018400BF09FF /* Sources */,
|
||||
1A98F9C617A4018400BF09FF /* Frameworks */,
|
||||
1A98F9C717A4018400BF09FF /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = executable;
|
||||
productName = WhereAmI;
|
||||
productReference = 1A98F9C917A4018400BF09FF /* executable.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
1A98F9C117A4018400BF09FF /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0460;
|
||||
ORGANIZATIONNAME = "Gregory Pakosz";
|
||||
TargetAttributes = {
|
||||
1A1E0A931A4486E800611947 = {
|
||||
CreatedOnToolsVersion = 6.1.1;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 1A98F9C417A4018400BF09FF /* Build configuration list for PBXProject "WhereAmI" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 1A98F9C017A4018400BF09FF;
|
||||
productRefGroup = 1A98F9CA17A4018400BF09FF /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
1A98F9C817A4018400BF09FF /* executable */,
|
||||
1A1E0A931A4486E800611947 /* library */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
1A98F9C717A4018400BF09FF /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
1A1E0A901A4486E800611947 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
1A1E0AAC1A4486FB00611947 /* library.c in Sources */,
|
||||
1A1E0AAD1A44880600611947 /* whereami.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
1A98F9C517A4018400BF09FF /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
1A1E0A8D1A4486A300611947 /* whereami.c in Sources */,
|
||||
1A1E0A8F1A4486A900611947 /* executable.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
1A1E0AA61A4486E900611947 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
EXECUTABLE_EXTENSION = dylib;
|
||||
EXECUTABLE_PREFIX = "";
|
||||
MACH_O_TYPE = mh_dylib;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1A1E0AA71A4486E900611947 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
EXECUTABLE_EXTENSION = dylib;
|
||||
EXECUTABLE_PREFIX = "";
|
||||
MACH_O_TYPE = mh_dylib;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
1A98F9E417A4018400BF09FF /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
../src,
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
);
|
||||
INFOPLIST_FILE = "WhereAmI-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1A98F9E517A4018400BF09FF /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_OPTIMIZATION_LEVEL = 2;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = NDEBUG;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
../src,
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
);
|
||||
INFOPLIST_FILE = "WhereAmI-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
1A98F9E717A4018400BF09FF /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1A98F9E817A4018400BF09FF /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
1A1E0AA51A4486E900611947 /* Build configuration list for PBXNativeTarget "library" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1A1E0AA61A4486E900611947 /* Debug */,
|
||||
1A1E0AA71A4486E900611947 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
1A98F9C417A4018400BF09FF /* Build configuration list for PBXProject "WhereAmI" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1A98F9E417A4018400BF09FF /* Debug */,
|
||||
1A98F9E517A4018400BF09FF /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
1A98F9E617A4018400BF09FF /* Build configuration list for PBXNativeTarget "executable" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1A98F9E717A4018400BF09FF /* Debug */,
|
||||
1A98F9E817A4018400BF09FF /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 1A98F9C117A4018400BF09FF /* Project object */;
|
||||
}
|
7
lib/whereami/_ios-xcode/WhereAmI.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
7
lib/whereami/_ios-xcode/WhereAmI.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:WhereAmI.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
|
@ -0,0 +1,2 @@
|
|||
xcuserdata/
|
||||
xcshareddata/
|
|
@ -0,0 +1,333 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
1A1E0A801A4484DC00611947 /* whereami.c in Sources */ = {isa = PBXBuildFile; fileRef = 1A1E0A7E1A4484DC00611947 /* whereami.c */; };
|
||||
1A1E0A811A4484DC00611947 /* whereami.c in Sources */ = {isa = PBXBuildFile; fileRef = 1A1E0A7E1A4484DC00611947 /* whereami.c */; };
|
||||
1A1E0A821A4484DC00611947 /* whereami.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A1E0A7F1A4484DC00611947 /* whereami.h */; };
|
||||
1A1E0A851A4484ED00611947 /* executable.c in Sources */ = {isa = PBXBuildFile; fileRef = 1A1E0A831A4484EA00611947 /* executable.c */; };
|
||||
1A1E0A861A4484EF00611947 /* library.c in Sources */ = {isa = PBXBuildFile; fileRef = 1A1E0A841A4484EA00611947 /* library.c */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
1A98F9FF17A4249200BF09FF /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = /usr/share/man/man1/;
|
||||
dstSubfolderSpec = 0;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
1A1E0A7A1A44841F00611947 /* library.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = library.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A1E0A7E1A4484DC00611947 /* whereami.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = whereami.c; sourceTree = "<group>"; };
|
||||
1A1E0A7F1A4484DC00611947 /* whereami.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = whereami.h; sourceTree = "<group>"; };
|
||||
1A1E0A831A4484EA00611947 /* executable.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = executable.c; sourceTree = "<group>"; };
|
||||
1A1E0A841A4484EA00611947 /* library.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = library.c; sourceTree = "<group>"; };
|
||||
1A98FA0117A4249200BF09FF /* executable */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = executable; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
1A1E0A771A44841F00611947 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
1A98F9FE17A4249200BF09FF /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
1A42F178182EB9EF00F3880C /* src */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1A1E0A7E1A4484DC00611947 /* whereami.c */,
|
||||
1A1E0A7F1A4484DC00611947 /* whereami.h */,
|
||||
);
|
||||
name = src;
|
||||
path = ../src;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1A42F17A182EB9FE00F3880C /* example */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1A1E0A831A4484EA00611947 /* executable.c */,
|
||||
1A1E0A841A4484EA00611947 /* library.c */,
|
||||
);
|
||||
name = example;
|
||||
path = ../example;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1A98F9F817A4249200BF09FF = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1A42F178182EB9EF00F3880C /* src */,
|
||||
1A42F17A182EB9FE00F3880C /* example */,
|
||||
1A98FA0217A4249200BF09FF /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1A98FA0217A4249200BF09FF /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1A98FA0117A4249200BF09FF /* executable */,
|
||||
1A1E0A7A1A44841F00611947 /* library.dylib */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
1A1E0A781A44841F00611947 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
1A1E0A821A4484DC00611947 /* whereami.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
1A1E0A791A44841F00611947 /* library */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 1A1E0A7B1A44841F00611947 /* Build configuration list for PBXNativeTarget "library" */;
|
||||
buildPhases = (
|
||||
1A1E0A761A44841F00611947 /* Sources */,
|
||||
1A1E0A771A44841F00611947 /* Frameworks */,
|
||||
1A1E0A781A44841F00611947 /* Headers */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = library;
|
||||
productName = library;
|
||||
productReference = 1A1E0A7A1A44841F00611947 /* library.dylib */;
|
||||
productType = "com.apple.product-type.library.dynamic";
|
||||
};
|
||||
1A98FA0017A4249200BF09FF /* executable */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 1A98FA0A17A4249200BF09FF /* Build configuration list for PBXNativeTarget "executable" */;
|
||||
buildPhases = (
|
||||
1A98F9FD17A4249200BF09FF /* Sources */,
|
||||
1A98F9FE17A4249200BF09FF /* Frameworks */,
|
||||
1A98F9FF17A4249200BF09FF /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = executable;
|
||||
productName = WhereAmI;
|
||||
productReference = 1A98FA0117A4249200BF09FF /* executable */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
1A98F9F917A4249200BF09FF /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0610;
|
||||
ORGANIZATIONNAME = "Gregory Pakosz";
|
||||
TargetAttributes = {
|
||||
1A1E0A791A44841F00611947 = {
|
||||
CreatedOnToolsVersion = 6.1.1;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 1A98F9FC17A4249200BF09FF /* Build configuration list for PBXProject "WhereAmI" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 1A98F9F817A4249200BF09FF;
|
||||
productRefGroup = 1A98FA0217A4249200BF09FF /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
1A98FA0017A4249200BF09FF /* executable */,
|
||||
1A1E0A791A44841F00611947 /* library */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
1A1E0A761A44841F00611947 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
1A1E0A811A4484DC00611947 /* whereami.c in Sources */,
|
||||
1A1E0A861A4484EF00611947 /* library.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
1A98F9FD17A4249200BF09FF /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
1A1E0A801A4484DC00611947 /* whereami.c in Sources */,
|
||||
1A1E0A851A4484ED00611947 /* executable.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
1A1E0A7C1A44841F00611947 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1A1E0A7D1A44841F00611947 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
1A98FA0817A4249200BF09FF /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "compiler-default";
|
||||
CLANG_CXX_LIBRARY = "compiler-default";
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
../src,
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.8;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1A98FA0917A4249200BF09FF /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "compiler-default";
|
||||
CLANG_CXX_LIBRARY = "compiler-default";
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 2;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = NDEBUG;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
../src,
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.8;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
1A98FA0B17A4249200BF09FF /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1A98FA0C17A4249200BF09FF /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
1A1E0A7B1A44841F00611947 /* Build configuration list for PBXNativeTarget "library" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1A1E0A7C1A44841F00611947 /* Debug */,
|
||||
1A1E0A7D1A44841F00611947 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
1A98F9FC17A4249200BF09FF /* Build configuration list for PBXProject "WhereAmI" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1A98FA0817A4249200BF09FF /* Debug */,
|
||||
1A98FA0917A4249200BF09FF /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
1A98FA0A17A4249200BF09FF /* Build configuration list for PBXNativeTarget "executable" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1A98FA0B17A4249200BF09FF /* Debug */,
|
||||
1A98FA0C17A4249200BF09FF /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 1A98F9F917A4249200BF09FF /* Project object */;
|
||||
}
|
7
lib/whereami/_mac-xcode/WhereAmI.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
7
lib/whereami/_mac-xcode/WhereAmI.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:WhereAmI.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
|
@ -0,0 +1,9 @@
|
|||
/build
|
||||
/ipch
|
||||
|
||||
*.suo
|
||||
*.sdf
|
||||
*.opensdf
|
||||
*.user
|
||||
*.sln.docstates
|
||||
*.opendb
|
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="UserMacros">
|
||||
<BIN_DIR>..\bin\Windows$(PLATFORM_SUFFIX)-$(ARCH)$(CONF_SUFFIX)</BIN_DIR>
|
||||
<LIB_DIR>..\lib\Windows$(PLATFORM_SUFFIX)-$(ARCH)-vs11$(CONF_SUFFIX)</LIB_DIR>
|
||||
<BUILD_DIR>build\$(ProjectName)-win$(PLATFORM_SUFFIX)-$(ARCH)-vs11$(CONF_SUFFIX)</BUILD_DIR>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<IntDir>$(BUILD_DIR)\</IntDir>
|
||||
<OutDir>$(BIN_DIR)\</OutDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalOptions>/we4013 /wd4820 /we4289 /wd4342 /wd4347 /wd4514 /we4545 /we4546 /we4547 /we4548 /we4549 /we4619 /we4623 /we4625 /we4626 /wd4710 /we4836 /we4905 /we4906 /we4928 /we4946 /wd4986 /wd4711 /wd4350 /wd4255 /wd4668</AdditionalOptions>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<AdditionalOptions>/time %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<BuildMacro Include="BIN_DIR">
|
||||
<Value>$(BIN_DIR)</Value>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="LIB_DIR">
|
||||
<Value>$(LIB_DIR)</Value>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="BUILD_DIR">
|
||||
<Value>$(BUILD_DIR)</Value>
|
||||
</BuildMacro>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="UserMacros">
|
||||
<CONF_SUFFIX>-Debug</CONF_SUFFIX>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<BuildMacro Include="CONF_SUFFIX">
|
||||
<Value>$(CONF_SUFFIX)</Value>
|
||||
</BuildMacro>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,114 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\example\executable.c" />
|
||||
<ClCompile Include="..\src\whereami.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\whereami.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>WhereAmI</RootNamespace>
|
||||
<ProjectGuid>{4F614870-9A09-4661-9963-7DF73803240B}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="x86.props" />
|
||||
<Import Project="Debug.props" />
|
||||
<Import Project="Common.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="x64.props" />
|
||||
<Import Project="Debug.props" />
|
||||
<Import Project="Common.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="x86.props" />
|
||||
<Import Project="Release.props" />
|
||||
<Import Project="Common.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="x64.props" />
|
||||
<Import Project="Release.props" />
|
||||
<Import Project="Common.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions>/we4013 /wd4820 /we4289 /wd4342 /wd4347 /wd4514 /we4545 /we4546 /we4547 /we4548 /we4549 /we4619 /we4623 /we4625 /we4626 /wd4710 /we4836 /we4905 /we4906 /we4928 /we4946 /wd4986 /wd4711 /wd4350 /Qvec-report:2</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>../src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/we4013 /wd4820 /we4289 /wd4342 /wd4347 /wd4514 /we4545 /we4546 /we4547 /we4548 /we4549 /we4619 /we4623 /we4625 /we4626 /wd4710 /we4836 /we4905 /we4906 /we4928 /we4946 /wd4986 /wd4711 /wd4350 /wd4255 /wd4668 /Qvec-report:2</AdditionalOptions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/we4013 /wd4820 /we4289 /wd4342 /wd4347 /wd4514 /we4545 /we4546 /we4547 /we4548 /we4549 /we4619 /we4623 /we4625 /we4626 /wd4710 /we4836 /we4905 /we4906 /we4928 /we4946 /wd4986 /wd4711 /wd4350 /wd4255 /wd4668 /Qvec-report:2</AdditionalOptions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -0,0 +1,113 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\example\library.c" />
|
||||
<ClCompile Include="..\src\whereami.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\whereami.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>WhereAmI</RootNamespace>
|
||||
<ProjectGuid>{D53572AD-B43A-4507-9BB2-F330F942912B}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="x86.props" />
|
||||
<Import Project="Debug.props" />
|
||||
<Import Project="Common.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="x64.props" />
|
||||
<Import Project="Debug.props" />
|
||||
<Import Project="Common.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="x86.props" />
|
||||
<Import Project="Release.props" />
|
||||
<Import Project="Common.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="x64.props" />
|
||||
<Import Project="Release.props" />
|
||||
<Import Project="Common.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/we4013 /wd4820 /we4289 /wd4342 /wd4347 /wd4514 /we4545 /we4546 /we4547 /we4548 /we4549 /we4619 /we4623 /we4625 /we4626 /wd4710 /we4836 /we4905 /we4906 /we4928 /we4946 /wd4986 /wd4711 /wd4350 /wd4255 /wd4668 /Qvec-report:2</AdditionalOptions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/we4013 /wd4820 /we4289 /wd4342 /wd4347 /wd4514 /we4545 /we4546 /we4547 /we4548 /we4549 /we4619 /we4623 /we4625 /we4626 /wd4710 /we4836 /we4905 /we4906 /we4928 /we4946 /wd4986 /wd4711 /wd4350 /wd4255 /wd4668 /Qvec-report:2</AdditionalOptions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="UserMacros">
|
||||
<CONF_SUFFIX />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<AdditionalOptions>/d2Zi+ %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
</Link>
|
||||
<Lib>
|
||||
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<BuildMacro Include="CONF_SUFFIX">
|
||||
<Value>$(CONF_SUFFIX)</Value>
|
||||
</BuildMacro>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,38 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Executable", "Executable.vcxproj", "{4F614870-9A09-4661-9963-7DF73803240B}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Library", "Library.vcxproj", "{D53572AD-B43A-4507-9BB2-F330F942912B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{4F614870-9A09-4661-9963-7DF73803240B}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{4F614870-9A09-4661-9963-7DF73803240B}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{4F614870-9A09-4661-9963-7DF73803240B}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{4F614870-9A09-4661-9963-7DF73803240B}.Debug|x64.Build.0 = Debug|x64
|
||||
{4F614870-9A09-4661-9963-7DF73803240B}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{4F614870-9A09-4661-9963-7DF73803240B}.Release|Win32.Build.0 = Release|Win32
|
||||
{4F614870-9A09-4661-9963-7DF73803240B}.Release|x64.ActiveCfg = Release|x64
|
||||
{4F614870-9A09-4661-9963-7DF73803240B}.Release|x64.Build.0 = Release|x64
|
||||
{D53572AD-B43A-4507-9BB2-F330F942912B}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{D53572AD-B43A-4507-9BB2-F330F942912B}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{D53572AD-B43A-4507-9BB2-F330F942912B}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{D53572AD-B43A-4507-9BB2-F330F942912B}.Debug|x64.Build.0 = Debug|x64
|
||||
{D53572AD-B43A-4507-9BB2-F330F942912B}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{D53572AD-B43A-4507-9BB2-F330F942912B}.Release|Win32.Build.0 = Release|Win32
|
||||
{D53572AD-B43A-4507-9BB2-F330F942912B}.Release|x64.ActiveCfg = Release|x64
|
||||
{D53572AD-B43A-4507-9BB2-F330F942912B}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="UserMacros">
|
||||
<ARCH>x64</ARCH>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<BuildMacro Include="ARCH">
|
||||
<Value>$(ARCH)</Value>
|
||||
</BuildMacro>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="UserMacros">
|
||||
<ARCH>x86</ARCH>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<BuildMacro Include="ARCH">
|
||||
<Value>$(ARCH)</Value>
|
||||
</BuildMacro>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,126 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <whereami.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(push, 3)
|
||||
#endif
|
||||
#include <windows.h>
|
||||
|
||||
#define RTLD_LAZY 1
|
||||
#define RTLD_NOW 2
|
||||
#define RTLD_GLOBAL 4
|
||||
#define RTLD_LOCAL 8
|
||||
|
||||
static void* dlopen(const char* fileName, int mode)
|
||||
{
|
||||
wchar_t buffer[MAX_PATH];
|
||||
|
||||
if (MultiByteToWideChar(CP_UTF8, 0, fileName, -1, buffer, sizeof(buffer) / sizeof(*buffer)))
|
||||
{
|
||||
wchar_t buffer_[MAX_PATH];
|
||||
|
||||
GetFullPathNameW(buffer, sizeof(buffer_) / sizeof(*buffer_), buffer_, NULL);
|
||||
|
||||
return (void*)LoadLibraryW(buffer_);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int dlclose(void* handle)
|
||||
{
|
||||
return FreeLibrary((HMODULE)handle) ? 0 : -1;
|
||||
}
|
||||
|
||||
static const char* dlerror(void)
|
||||
{
|
||||
DWORD error;
|
||||
|
||||
error = GetLastError();
|
||||
|
||||
if (error)
|
||||
{
|
||||
static char message[1024];
|
||||
|
||||
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, error, MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), message, sizeof(message), NULL);
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
return "no error";
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
#endif
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
char* path = NULL;
|
||||
int length, dirname_length;
|
||||
int i;
|
||||
|
||||
length = wai_getExecutablePath(NULL, 0, &dirname_length);
|
||||
if (length > 0)
|
||||
{
|
||||
path = (char*)malloc(length + 1);
|
||||
if (!path)
|
||||
abort();
|
||||
wai_getExecutablePath(path, length, &dirname_length);
|
||||
path[length] = '\0';
|
||||
|
||||
printf("executable path: %s\n", path);
|
||||
path[dirname_length] = '\0';
|
||||
printf(" dirname: %s\n", path);
|
||||
printf(" basename: %s\n", path + dirname_length + 1);
|
||||
free(path);
|
||||
}
|
||||
|
||||
length = wai_getModulePath(NULL, 0, &dirname_length);
|
||||
if (length > 0)
|
||||
{
|
||||
path = (char*)malloc(length + 1);
|
||||
if (!path)
|
||||
abort();
|
||||
wai_getModulePath(path, length, &dirname_length);
|
||||
path[length] = '\0';
|
||||
|
||||
printf("module path: %s\n", path);
|
||||
path[dirname_length] = '\0';
|
||||
printf(" dirname: %s\n", path);
|
||||
printf(" basename: %s\n", path + dirname_length + 1);
|
||||
free(path);
|
||||
}
|
||||
|
||||
for (i = 1; i < argc; ++i)
|
||||
{
|
||||
if (strncmp(argv[i], "--load-library=", 15) == 0)
|
||||
{
|
||||
char* name = argv[i] + 15;
|
||||
void* handle;
|
||||
|
||||
printf("\n");
|
||||
|
||||
handle = dlopen(name, RTLD_NOW);
|
||||
if (!handle)
|
||||
printf("failed to load library: %s\n", dlerror());
|
||||
|
||||
if (handle)
|
||||
dlclose(handle);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <whereami.h>
|
||||
|
||||
#if defined(__GNUC__) && !defined(_WIN32)
|
||||
__attribute__((constructor))
|
||||
#endif
|
||||
static void load()
|
||||
{
|
||||
char* path = NULL;
|
||||
int length, dirname_length;
|
||||
|
||||
printf("library loaded\n");
|
||||
|
||||
length = wai_getExecutablePath(NULL, 0, &dirname_length);
|
||||
if (length > 0)
|
||||
{
|
||||
path = (char*)malloc(length + 1);
|
||||
wai_getExecutablePath(path, length, &dirname_length);
|
||||
path[length] = '\0';
|
||||
|
||||
printf("executable path: %s\n", path);
|
||||
path[dirname_length] = '\0';
|
||||
printf(" dirname: %s\n", path);
|
||||
printf(" basename: %s\n", path + dirname_length + 1);
|
||||
free(path);
|
||||
}
|
||||
|
||||
length = wai_getModulePath(NULL, 0, &dirname_length);
|
||||
if (length > 0)
|
||||
{
|
||||
path = (char*)malloc(length + 1);
|
||||
wai_getModulePath(path, length, &dirname_length);
|
||||
path[length] = '\0';
|
||||
|
||||
printf("module path: %s\n", path);
|
||||
path[dirname_length] = '\0';
|
||||
printf(" dirname: %s\n", path);
|
||||
printf(" basename: %s\n", path + dirname_length + 1);
|
||||
free(path);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__GNUC__) && !defined(_WIN32)
|
||||
__attribute__((constructor))
|
||||
__attribute__((destructor))
|
||||
#endif
|
||||
static void unload()
|
||||
{
|
||||
printf("library unloaded\n");
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(push, 3)
|
||||
#endif
|
||||
#include <windows.h>
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
|
||||
{
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
load();
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
break;
|
||||
case DLL_THREAD_DETACH:
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
unload();
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,660 @@
|
|||
// (‑●‑●)> released under the WTFPL v2 license, by Gregory Pakosz (@gpakosz)
|
||||
// https://github.com/gpakosz/whereami
|
||||
|
||||
// in case you want to #include "whereami.c" in a larger compilation unit
|
||||
#if !defined(WHEREAMI_H)
|
||||
#include <whereami.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(WAI_MALLOC) || !defined(WAI_FREE) || !defined(WAI_REALLOC)
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if !defined(WAI_MALLOC)
|
||||
#define WAI_MALLOC(size) malloc(size)
|
||||
#endif
|
||||
|
||||
#if !defined(WAI_FREE)
|
||||
#define WAI_FREE(p) free(p)
|
||||
#endif
|
||||
|
||||
#if !defined(WAI_REALLOC)
|
||||
#define WAI_REALLOC(p, size) realloc(p, size)
|
||||
#endif
|
||||
|
||||
#ifndef WAI_NOINLINE
|
||||
#if defined(_MSC_VER)
|
||||
#define WAI_NOINLINE __declspec(noinline)
|
||||
#elif defined(__GNUC__)
|
||||
#define WAI_NOINLINE __attribute__((noinline))
|
||||
#else
|
||||
#error unsupported compiler
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define WAI_RETURN_ADDRESS() _ReturnAddress()
|
||||
#elif defined(__GNUC__)
|
||||
#define WAI_RETURN_ADDRESS() __builtin_extract_return_addr(__builtin_return_address(0))
|
||||
#else
|
||||
#error unsupported compiler
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(push, 3)
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <intrin.h>
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
static int WAI_PREFIX(getModulePath_)(HMODULE module, char* out, int capacity, int* dirname_length)
|
||||
{
|
||||
wchar_t buffer1[1];
|
||||
wchar_t buffer2[MAX_PATH];
|
||||
wchar_t* path = NULL;
|
||||
int length = -1;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
DWORD size;
|
||||
int length_;
|
||||
|
||||
size = GetModuleFileNameW(module, buffer1, sizeof(buffer1) / sizeof(buffer1[0]));
|
||||
|
||||
if (size == 0)
|
||||
break;
|
||||
else if (size == (DWORD)(sizeof(buffer1) / sizeof(buffer1[0])))
|
||||
{
|
||||
DWORD size_ = size;
|
||||
do
|
||||
{
|
||||
wchar_t* path_;
|
||||
|
||||
path_ = (wchar_t*)WAI_REALLOC(path, sizeof(wchar_t) * size_ * 2);
|
||||
if (!path_)
|
||||
break;
|
||||
size_ *= 2;
|
||||
path = path_;
|
||||
size = GetModuleFileNameW(module, path, size_);
|
||||
}
|
||||
while (size == size_);
|
||||
|
||||
if (size == size_)
|
||||
break;
|
||||
}
|
||||
else
|
||||
path = buffer1;
|
||||
|
||||
if (!_wfullpath(buffer2, path, MAX_PATH))
|
||||
break;
|
||||
length_ = WideCharToMultiByte(CP_UTF8, 0, buffer2, -1, out, capacity, NULL, NULL);
|
||||
|
||||
if (length_ == 0)
|
||||
length_ = WideCharToMultiByte(CP_UTF8, 0, buffer2, -1, NULL, 0, NULL, NULL);
|
||||
if (length_ == 0)
|
||||
break;
|
||||
|
||||
if (length_ <= capacity && dirname_length)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = length_ - 1; i >= 0; --i)
|
||||
{
|
||||
if (out[i] == '\\')
|
||||
{
|
||||
*dirname_length = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
length = length_;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (path != buffer1)
|
||||
WAI_FREE(path);
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
WAI_NOINLINE
|
||||
WAI_FUNCSPEC
|
||||
int WAI_PREFIX(getExecutablePath)(char* out, int capacity, int* dirname_length)
|
||||
{
|
||||
return WAI_PREFIX(getModulePath_)(NULL, out, capacity, dirname_length);
|
||||
}
|
||||
|
||||
WAI_NOINLINE
|
||||
WAI_FUNCSPEC
|
||||
int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
|
||||
{
|
||||
HMODULE module;
|
||||
int length = -1;
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4054)
|
||||
#endif
|
||||
if (GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCTSTR)WAI_RETURN_ADDRESS(), &module))
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
{
|
||||
length = WAI_PREFIX(getModulePath_)(module, out, capacity, dirname_length);
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
#elif defined(__linux__)
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#ifndef __STDC_FORMAT_MACROS
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#endif
|
||||
#include <inttypes.h>
|
||||
|
||||
#if !defined(WAI_PROC_SELF_EXE)
|
||||
#define WAI_PROC_SELF_EXE "/proc/self/exe"
|
||||
#endif
|
||||
|
||||
WAI_FUNCSPEC
|
||||
int WAI_PREFIX(getExecutablePath)(char* out, int capacity, int* dirname_length)
|
||||
{
|
||||
char buffer[PATH_MAX];
|
||||
char* resolved = NULL;
|
||||
int length = -1;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
resolved = realpath(WAI_PROC_SELF_EXE, buffer);
|
||||
if (!resolved)
|
||||
break;
|
||||
|
||||
length = (int)strlen(resolved);
|
||||
if (length <= capacity)
|
||||
{
|
||||
memcpy(out, resolved, length);
|
||||
|
||||
if (dirname_length)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = length - 1; i >= 0; --i)
|
||||
{
|
||||
if (out[i] == '/')
|
||||
{
|
||||
*dirname_length = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
#if !defined(WAI_PROC_SELF_MAPS_RETRY)
|
||||
#define WAI_PROC_SELF_MAPS_RETRY 5
|
||||
#endif
|
||||
|
||||
#if !defined(WAI_PROC_SELF_MAPS)
|
||||
#define WAI_PROC_SELF_MAPS "/proc/self/maps"
|
||||
#endif
|
||||
|
||||
#if defined(__ANDROID__) || defined(ANDROID)
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
WAI_NOINLINE
|
||||
WAI_FUNCSPEC
|
||||
int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
|
||||
{
|
||||
int length = -1;
|
||||
FILE* maps = NULL;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < WAI_PROC_SELF_MAPS_RETRY; ++i)
|
||||
{
|
||||
maps = fopen(WAI_PROC_SELF_MAPS, "r");
|
||||
if (!maps)
|
||||
break;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
char buffer[PATH_MAX < 1024 ? 1024 : PATH_MAX];
|
||||
uint64_t low, high;
|
||||
char perms[5];
|
||||
uint64_t offset;
|
||||
uint32_t major, minor;
|
||||
char path[PATH_MAX];
|
||||
uint32_t inode;
|
||||
|
||||
if (!fgets(buffer, sizeof(buffer), maps))
|
||||
break;
|
||||
|
||||
if (sscanf(buffer, "%" PRIx64 "-%" PRIx64 " %s %" PRIx64 " %x:%x %u %s\n", &low, &high, perms, &offset, &major, &minor, &inode, path) == 8)
|
||||
{
|
||||
uint64_t addr = (uint64_t)(uintptr_t)WAI_RETURN_ADDRESS();
|
||||
if (low <= addr && addr <= high)
|
||||
{
|
||||
char* resolved;
|
||||
|
||||
resolved = realpath(path, buffer);
|
||||
if (!resolved)
|
||||
break;
|
||||
|
||||
length = (int)strlen(resolved);
|
||||
#if defined(__ANDROID__) || defined(ANDROID)
|
||||
if (length > 4
|
||||
&&buffer[length - 1] == 'k'
|
||||
&&buffer[length - 2] == 'p'
|
||||
&&buffer[length - 3] == 'a'
|
||||
&&buffer[length - 4] == '.')
|
||||
{
|
||||
int fd = open(path, O_RDONLY);
|
||||
char* begin;
|
||||
char* p;
|
||||
|
||||
begin = (char*)mmap(0, offset, PROT_READ, MAP_SHARED, fd, 0);
|
||||
p = begin + offset;
|
||||
|
||||
while (p >= begin) // scan backwards
|
||||
{
|
||||
if (*((uint32_t*)p) == 0x04034b50UL) // local file header found
|
||||
{
|
||||
uint16_t length_ = *((uint16_t*)(p + 26));
|
||||
|
||||
if (length + 2 + length_ < (int)sizeof(buffer))
|
||||
{
|
||||
memcpy(&buffer[length], "!/", 2);
|
||||
memcpy(&buffer[length + 2], p + 30, length_);
|
||||
length += 2 + length_;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
p -= 4;
|
||||
}
|
||||
|
||||
munmap(begin, offset);
|
||||
close(fd);
|
||||
}
|
||||
#endif
|
||||
if (length <= capacity)
|
||||
{
|
||||
memcpy(out, resolved, length);
|
||||
|
||||
if (dirname_length)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = length - 1; i >= 0; --i)
|
||||
{
|
||||
if (out[i] == '/')
|
||||
{
|
||||
*dirname_length = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose(maps);
|
||||
|
||||
if (length != -1)
|
||||
break;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
|
||||
#define _DARWIN_BETTER_REALPATH
|
||||
#include <mach-o/dyld.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
WAI_FUNCSPEC
|
||||
int WAI_PREFIX(getExecutablePath)(char* out, int capacity, int* dirname_length)
|
||||
{
|
||||
char buffer1[PATH_MAX];
|
||||
char buffer2[PATH_MAX];
|
||||
char* path = buffer1;
|
||||
char* resolved = NULL;
|
||||
int length = -1;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
uint32_t size = (uint32_t)sizeof(buffer1);
|
||||
if (_NSGetExecutablePath(path, &size) == -1)
|
||||
{
|
||||
path = (char*)WAI_MALLOC(size);
|
||||
if (!_NSGetExecutablePath(path, &size))
|
||||
break;
|
||||
}
|
||||
|
||||
resolved = realpath(path, buffer2);
|
||||
if (!resolved)
|
||||
break;
|
||||
|
||||
length = (int)strlen(resolved);
|
||||
if (length <= capacity)
|
||||
{
|
||||
memcpy(out, resolved, length);
|
||||
|
||||
if (dirname_length)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = length - 1; i >= 0; --i)
|
||||
{
|
||||
if (out[i] == '/')
|
||||
{
|
||||
*dirname_length = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (path != buffer1)
|
||||
WAI_FREE(path);
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
WAI_NOINLINE
|
||||
WAI_FUNCSPEC
|
||||
int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
|
||||
{
|
||||
char buffer[PATH_MAX];
|
||||
char* resolved = NULL;
|
||||
int length = -1;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
Dl_info info;
|
||||
|
||||
if (dladdr(WAI_RETURN_ADDRESS(), &info))
|
||||
{
|
||||
resolved = realpath(info.dli_fname, buffer);
|
||||
if (!resolved)
|
||||
break;
|
||||
|
||||
length = (int)strlen(resolved);
|
||||
if (length <= capacity)
|
||||
{
|
||||
memcpy(out, resolved, length);
|
||||
|
||||
if (dirname_length)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = length - 1; i >= 0; --i)
|
||||
{
|
||||
if (out[i] == '/')
|
||||
{
|
||||
*dirname_length = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
#elif defined(__QNXNTO__)
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#if !defined(WAI_PROC_SELF_EXE)
|
||||
#define WAI_PROC_SELF_EXE "/proc/self/exefile"
|
||||
#endif
|
||||
|
||||
WAI_FUNCSPEC
|
||||
int WAI_PREFIX(getExecutablePath)(char* out, int capacity, int* dirname_length)
|
||||
{
|
||||
char buffer1[PATH_MAX];
|
||||
char buffer2[PATH_MAX];
|
||||
char* resolved = NULL;
|
||||
FILE* self_exe = NULL;
|
||||
int length = -1;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
self_exe = fopen(WAI_PROC_SELF_EXE, "r");
|
||||
if (!self_exe)
|
||||
break;
|
||||
|
||||
if (!fgets(buffer1, sizeof(buffer1), self_exe))
|
||||
break;
|
||||
|
||||
resolved = realpath(buffer1, buffer2);
|
||||
if (!resolved)
|
||||
break;
|
||||
|
||||
length = (int)strlen(resolved);
|
||||
if (length <= capacity)
|
||||
{
|
||||
memcpy(out, resolved, length);
|
||||
|
||||
if (dirname_length)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = length - 1; i >= 0; --i)
|
||||
{
|
||||
if (out[i] == '/')
|
||||
{
|
||||
*dirname_length = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
fclose(self_exe);
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
WAI_FUNCSPEC
|
||||
int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
|
||||
{
|
||||
char buffer[PATH_MAX];
|
||||
char* resolved = NULL;
|
||||
int length = -1;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
Dl_info info;
|
||||
|
||||
if (dladdr(WAI_RETURN_ADDRESS(), &info))
|
||||
{
|
||||
resolved = realpath(info.dli_fname, buffer);
|
||||
if (!resolved)
|
||||
break;
|
||||
|
||||
length = (int)strlen(resolved);
|
||||
if (length <= capacity)
|
||||
{
|
||||
memcpy(out, resolved, length);
|
||||
|
||||
if (dirname_length)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = length - 1; i >= 0; --i)
|
||||
{
|
||||
if (out[i] == '/')
|
||||
{
|
||||
*dirname_length = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
#elif defined(__FreeBSD__)
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
WAI_FUNCSPEC
|
||||
int WAI_PREFIX(getExecutablePath)(char* out, int capacity, int* dirname_length)
|
||||
{
|
||||
char buffer1[PATH_MAX];
|
||||
char buffer2[PATH_MAX];
|
||||
char* path = buffer1;
|
||||
char* resolved = NULL;
|
||||
int length = -1;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
|
||||
size_t size = sizeof(buffer1);
|
||||
|
||||
if (sysctl(mib, (u_int)(sizeof(mib) / sizeof(mib[0])), path, &size, NULL, 0) != 0)
|
||||
break;
|
||||
|
||||
resolved = realpath(path, buffer2);
|
||||
if (!resolved)
|
||||
break;
|
||||
|
||||
length = (int)strlen(resolved);
|
||||
if (length <= capacity)
|
||||
{
|
||||
memcpy(out, resolved, length);
|
||||
|
||||
if (dirname_length)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = length - 1; i >= 0; --i)
|
||||
{
|
||||
if (out[i] == '/')
|
||||
{
|
||||
*dirname_length = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (path != buffer1)
|
||||
WAI_FREE(path);
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
WAI_NOINLINE
|
||||
WAI_FUNCSPEC
|
||||
int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
|
||||
{
|
||||
char buffer[PATH_MAX];
|
||||
char* resolved = NULL;
|
||||
int length = -1;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
Dl_info info;
|
||||
|
||||
if (dladdr(WAI_RETURN_ADDRESS(), &info))
|
||||
{
|
||||
resolved = realpath(info.dli_fname, buffer);
|
||||
if (!resolved)
|
||||
break;
|
||||
|
||||
length = (int)strlen(resolved);
|
||||
if (length <= capacity)
|
||||
{
|
||||
memcpy(out, resolved, length);
|
||||
|
||||
if (dirname_length)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = length - 1; i >= 0; --i)
|
||||
{
|
||||
if (out[i] == '/')
|
||||
{
|
||||
*dirname_length = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#error unsupported platform
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,65 @@
|
|||
// (‑●‑●)> released under the WTFPL v2 license, by Gregory Pakosz (@gpakosz)
|
||||
// https://github.com/gpakosz/whereami
|
||||
|
||||
#ifndef WHEREAMI_H
|
||||
#define WHEREAMI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef WAI_FUNCSPEC
|
||||
#define WAI_FUNCSPEC
|
||||
#endif
|
||||
#ifndef WAI_PREFIX
|
||||
#define WAI_PREFIX(function) wai_##function
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns the path to the current executable.
|
||||
*
|
||||
* 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, NULL)` again to retrieve the
|
||||
* path
|
||||
* - add a terminal NUL character with `path[length] = '\0';`
|
||||
*
|
||||
* @param out destination buffer, optional
|
||||
* @param capacity destination buffer capacity
|
||||
* @param dirname_length optional recipient for the length of the dirname part
|
||||
* of the path.
|
||||
*
|
||||
* @return the length of the executable path on success (without a terminal NUL
|
||||
* character), otherwise `-1`
|
||||
*/
|
||||
WAI_FUNCSPEC
|
||||
int WAI_PREFIX(getExecutablePath)(char* out, int capacity, int* dirname_length);
|
||||
|
||||
/**
|
||||
* Returns the path to the current module
|
||||
*
|
||||
* Usage:
|
||||
* - first call `int length = wai_getModulePath(NULL, 0, NULL);` to retrieve
|
||||
* the length of the path
|
||||
* - allocate the destination buffer with `path = (char*)malloc(length + 1);`
|
||||
* - call `wai_getModulePath(path, length, NULL)` again to retrieve the path
|
||||
* - add a terminal NUL character with `path[length] = '\0';`
|
||||
*
|
||||
* @param out destination buffer, optional
|
||||
* @param capacity destination buffer capacity
|
||||
* @param dirname_length optional recipient for the length of the dirname part
|
||||
* of the path.
|
||||
*
|
||||
* @return the length of the module path on success (without a terminal NUL
|
||||
* character), otherwise `-1`
|
||||
*/
|
||||
WAI_FUNCSPEC
|
||||
int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // #ifndef WHEREAMI_H
|
|
@ -1,6 +1,6 @@
|
|||
#include <chrono>
|
||||
#include <ostream>
|
||||
#include "Centiseconds.h"
|
||||
#include "centiseconds.h"
|
||||
|
||||
std::ostream& operator <<(std::ostream& stream, const centiseconds cs) {
|
||||
return stream << cs.count() << "cs";
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include "audio/AudioClip.h"
|
||||
#include "Phone.h"
|
||||
#include "progressBar.h"
|
||||
#include "ProgressBar.h"
|
||||
#include "BoundedTimeline.h"
|
||||
|
||||
BoundedTimeline<Phone> detectPhones(
|
||||
|
|
|
@ -5,125 +5,29 @@
|
|||
#include <boost/uuid/uuid.hpp>
|
||||
#include <boost/uuid/uuid_generators.hpp>
|
||||
#include <boost/uuid/uuid_io.hpp>
|
||||
|
||||
#include "platformTools.h"
|
||||
#include <whereami.h>
|
||||
|
||||
using boost::filesystem::path;
|
||||
using std::string;
|
||||
|
||||
constexpr int InitialBufferSize = 256;
|
||||
|
||||
#if (BOOST_OS_CYGWIN || BOOST_OS_WINDOWS)
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
path getBinPathImpl() {
|
||||
std::vector<WCHAR> buffer(InitialBufferSize);
|
||||
|
||||
// Try to get the executable path with a buffer of MAX_PATH characters.
|
||||
DWORD result = GetModuleFileNameW(0, buffer.data(), buffer.size());
|
||||
|
||||
// As long the function returns the buffer size, it is indicating that the buffer
|
||||
// was too small. Keep doubling the buffer size until it fits.
|
||||
while (result == buffer.size()) {
|
||||
buffer.resize(buffer.size() * 2);
|
||||
result = GetModuleFileNameW(0, buffer.data(), buffer.size());
|
||||
}
|
||||
|
||||
// If the function returned 0, something went wrong
|
||||
if (result == 0) {
|
||||
DWORD error = GetLastError();
|
||||
throw std::runtime_error(fmt::format("`GetModuleFileNameW` failed. Error code: {0}", error));
|
||||
}
|
||||
|
||||
return path(buffer.data());
|
||||
}
|
||||
|
||||
#elif (BOOST_OS_MACOS)
|
||||
|
||||
#include <mach-o/dyld.h>
|
||||
|
||||
path getBinPathImpl() {
|
||||
std::vector<char> buffer(InitialBufferSize);
|
||||
uint32_t size = buffer.size();
|
||||
int result = _NSGetExecutablePath(buffer.data(), &size);
|
||||
if (result == -1) {
|
||||
// Insufficient buffer. Resize.
|
||||
buffer.resize(size);
|
||||
result = _NSGetExecutablePath(buffer.data(), &size);
|
||||
}
|
||||
if (result != 0) {
|
||||
throw std::runtime_error(fmt::format("`_NSGetExecutablePath` failed. Error code: {0}", result));
|
||||
}
|
||||
return path(buffer.data());
|
||||
}
|
||||
|
||||
#elif (BOOST_OS_SOLARIS)
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
path getBinPathImpl() {
|
||||
const char* executableName = getexecname();
|
||||
if (!executableName) {
|
||||
throw std::runtime_error("`getexecname` failed."));
|
||||
}
|
||||
return path(executableName);
|
||||
}
|
||||
|
||||
#elif (BOOST_OS_BSD)
|
||||
|
||||
#include <sys/sysctl.h>
|
||||
#include <errno.h>
|
||||
|
||||
path getBinPathImpl() {
|
||||
// Determine required buffer size
|
||||
std::array<int, 4> mib = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
|
||||
size_t size = 0;
|
||||
sysctl(mib.data(), mib.size(), nullptr, &size, nullptr, 0);
|
||||
|
||||
// Get path
|
||||
std::vector<char> buffer(size);
|
||||
int result = sysctl(mib.data(), mib.size(), buffer.data(), &size, nullptr, 0);
|
||||
if (result == -1) {
|
||||
throw std::runtime_error(fmt::format("`sysctl` failed. Error code: {0}", errno));
|
||||
}
|
||||
|
||||
return path(std::string(buffer, size));
|
||||
}
|
||||
|
||||
#elif (BOOST_OS_LINUX)
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
path getBinPathImpl() {
|
||||
// Determine required buffer size
|
||||
stat info;
|
||||
const char* selfPath = "/proc/self/exe";
|
||||
int result = lstat(selfPath, &stat);
|
||||
if (result == -1) {
|
||||
throw std::runtime_error(fmt::format("`lstat` failed. Error code: {0}", errno));
|
||||
}
|
||||
|
||||
// Get path
|
||||
std::vector<char> buffer(info.st_size);
|
||||
result = readlink(selfPath, buffer.data(), buffer.size());
|
||||
if (result == -1) {
|
||||
throw std::runtime_error(fmt::format("`readlink` failed. Error code: {0}", errno));
|
||||
}
|
||||
|
||||
return path(std::string(buffer, buffer.size()));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#error "Unsupported platform."
|
||||
|
||||
#endif
|
||||
|
||||
path getBinPath() {
|
||||
try {
|
||||
static path binPath(boost::filesystem::canonical(getBinPathImpl()).make_preferred());
|
||||
// Determine path length
|
||||
int pathLength = wai_getExecutablePath(nullptr, 0, nullptr);
|
||||
if (pathLength == -1) {
|
||||
throw std::runtime_error("Error determining path length.");
|
||||
}
|
||||
|
||||
// Get path
|
||||
std::vector<char> buffer(pathLength);
|
||||
if (wai_getExecutablePath(buffer.data(), buffer.size(), nullptr) == -1) {
|
||||
throw std::runtime_error("Error reading path.");
|
||||
}
|
||||
|
||||
// Convert to boost::filesystem::path
|
||||
string pathString(buffer.data(), buffer.size());
|
||||
static path binPath(boost::filesystem::canonical(pathString).make_preferred());
|
||||
return binPath;
|
||||
} catch (...) {
|
||||
std::throw_with_nested(std::runtime_error("Could not determine path of bin directory.") );
|
||||
|
@ -142,9 +46,8 @@ path getTempFilePath() {
|
|||
}
|
||||
|
||||
std::tm getLocalTime(const time_t& time) {
|
||||
// Xcode doesn't support localtime_s.
|
||||
tm timeInfo;
|
||||
#if (BOOST_OS_MACOS)
|
||||
#if (BOOST_OS_UNIX || BOOST_OS_MACOS)
|
||||
localtime_r(&time, &timeInfo);
|
||||
#else
|
||||
localtime_s(&timeInfo, &time);
|
||||
|
@ -153,9 +56,8 @@ std::tm getLocalTime(const time_t& time) {
|
|||
}
|
||||
|
||||
std::string errorNumberToString(int errorNumber) {
|
||||
// Xcode doesn't support strerror_s.
|
||||
char message[256];
|
||||
#if (BOOST_OS_MACOS)
|
||||
#if (BOOST_OS_UNIX || BOOST_OS_MACOS)
|
||||
strerror_r(errorNumber, message, sizeof message);
|
||||
#else
|
||||
strerror_s(message, sizeof message, errorNumber);
|
||||
|
|
Loading…
Reference in New Issue