diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml
new file mode 100644
index 00000000..5fb029c1
--- /dev/null
+++ b/.github/workflows/cmake.yml
@@ -0,0 +1,91 @@
+name: CMake
+
+on:
+ push:
+ branches: [ "*" ]
+ pull_request:
+ branches: [ "*" ]
+ release:
+ type: [created, edited]
+
+env:
+ # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
+ BUILD_TYPE: RelWithDebInfo
+
+jobs:
+ build:
+ strategy:
+ fail-fast: false
+ matrix:
+ os:
+ - ubuntu-latest
+ - windows-latest
+ - macos-latest
+
+ runs-on: ${{matrix.os}}
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: "Windows: Configure environment"
+ if: runner.os == 'Windows'
+ shell: bash
+ run: |
+ # Select MinGW toolchain instead of the default MSVC.
+ echo "CMAKE_GENERATOR=MinGW Makefiles" >> $GITHUB_ENV
+
+ - name: "Linux: Install dependency libraries"
+ if: runner.os == 'Linux'
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y --no-install-recommends freeglut3-dev libudev-dev libopenal-dev
+
+ - name: Configure CMake
+ working-directory: ${{github.workspace}}/src
+ run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
+
+ - name: Build
+ working-directory: ${{github.workspace}}/src
+ run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
+
+ - name: Test
+ working-directory: ${{github.workspace}}/build
+ run: ctest -C ${{env.BUILD_TYPE}}
+
+ - uses: actions/upload-artifact@v2
+ with:
+ name: binaries
+ path: ${{github.workspace}}/build/*.xpl
+ if-no-files-found: error
+
+ package:
+ needs: build
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - uses: actions/download-artifact@v2
+ with:
+ name: binaries
+ path: FlyWithLua/64
+
+ - uses: actions/upload-artifact@v2
+ with:
+ name: FlyWithLua_plugin
+ path: |
+ ${{github.workspace}}/FlyWithLua*
+ if-no-files-found: error
+
+ - name: Create plugin archive
+ if: github.event_name == 'release'
+ run: zip -r FlyWithLua_all_platforms.zip FlyWithLua/
+
+ - name: Upload binaries to release
+ if: github.event_name == 'release'
+ uses: svenstaro/upload-release-action@v2
+ with:
+ repo_token: ${{ secrets.GITHUB_TOKEN }}
+ file: FlyWithLua_all_platforms.zip
+ tag: ${{ github.ref }}
+ overwrite: true
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index b60fd05e..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-language: cpp
-compiler:
- - gcc
-services:
- - docker
-env:
- - TARGET_PLATFORM=mac
- - TARGET_PLATFORM=win
- - TARGET_PLATFORM=lin
-before_install:
- - chmod a+rwx src/
- - (cd docker; make .image)
-script:
- - (cd docker; make $TARGET_PLATFORM)
diff --git a/FlyWithLua/64/.gitignore b/FlyWithLua/64/.gitignore
new file mode 100644
index 00000000..96fb05d5
--- /dev/null
+++ b/FlyWithLua/64/.gitignore
@@ -0,0 +1 @@
+*.xpl
diff --git a/FlyWithLua/64/lin.xpl b/FlyWithLua/64/lin.xpl
deleted file mode 100755
index 77866df5..00000000
Binary files a/FlyWithLua/64/lin.xpl and /dev/null differ
diff --git a/FlyWithLua/64/mac.xpl b/FlyWithLua/64/mac.xpl
deleted file mode 100755
index 0916996c..00000000
Binary files a/FlyWithLua/64/mac.xpl and /dev/null differ
diff --git a/FlyWithLua/64/win.xpl b/FlyWithLua/64/win.xpl
deleted file mode 100755
index 63d785d9..00000000
Binary files a/FlyWithLua/64/win.xpl and /dev/null differ
diff --git a/README.md b/README.md
index 0982c034..d02758f5 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,6 @@
-FlyWithLua for X-Plane 11
-=========================
+# FlyWithLua for X-Plane 11
-[![Build Status](https://travis-ci.org/X-Friese/FlyWithLua.svg)](https://travis-ci.org/X-Friese/FlyWithLua)
+[![CMake](https://github.com/X-Friese/FlyWithLua/actions/workflows/cmake.yml/badge.svg)](https://github.com/X-Friese/FlyWithLua/actions/workflows/cmake.yml)
This is the official source code repository for the FlyWithLua plugin project.
@@ -13,20 +12,176 @@ You will find a binary version ready to use in X-Plane 9 or 10 in the [download
The new versions are X-Plane 11 only and the binary is also in the [download area of x-plane.org](https://forums.x-plane.org/index.php?/files/file/38445-flywithlua-ng-next-generation-edition-for-x-plane-11-win-lin-mac/).
-If you want to grab a most nightly binary, just copy the subfolder `FlyWithLua` into your X-Plane's plugin folder.
+If you want to grab a most nightly binary, just download `FlyWithLua_plugin.zip` from the most recent [GitHub Actions build](https://github.com/X-Friese/FlyWithLua/actions/workflows/cmake.yml?query=branch%3Amaster) and unpack it into your X-Plane's plugin folder.
-Copyright (c) 2012 Carsten Lynker
+> Copyright (c) 2012 Carsten Lynker
+>
+> Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+> and associated documentation files (the "Software"), to deal in the Software without restriction,
+> including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
+> and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
+> subject to the following conditions:
+>
+> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+>
+> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+> TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+> THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+> CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+> DEALINGS IN THE SOFTWARE.
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software
-and associated documentation files (the "Software"), to deal in the Software without restriction,
-including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
+## Building FlyWithLua from source
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+### On windows
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
-TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
+1. Install required software using [Chocolatey](https://chocolatey.org/) using admin command prompt:
+
+ ```
+ choco install git cmake
+ choco install mingw --version 8.1.0
+ ```
+
+ You can also install the same programs manually if you prefer.
+
+2. Checkout and configure the project:
+
+ ```
+ git clone https://github.com/X-Friese/FlyWithLua.git
+ cd FlyWithLua
+ cmake -G "MinGW Makefiles" -S .\src -B .\build -DCMAKE_BUILD_TYPE=RelWithDebInfo
+ ```
+
+3. Build the project and copy the plugin DLL into the appropriate directory:
+
+ ```
+ cmake --build .\build
+ cp .\build\win.xpl .\FlyWithLua\64\
+ ```
+
+### On Ubuntu:
+
+1. Install required software:
+
+ ```
+ sudo apt-get install -y --no-install-recommends build-essential cmake git freeglut3-dev libudev-dev libopenal-dev
+
+ ```
+
+2. Checkout and configure the project:
+
+ ```
+ git clone https://github.com/X-Friese/FlyWithLua.git
+ cd FlyWithLua
+ cmake -S ./src -B ./build -DCMAKE_BUILD_TYPE=RelWithDebInfo
+ ```
+
+3. Build the project and copy the plugin DLL into the appropriate directory:
+
+ ```
+ cmake --build ./build
+ cp ./build/lin.xpl ./FlyWithLua/64
+ ```
+
+### On OS X:
+
+1. Install XCode, Git, CMake (Homebrew can be convenient for this).
+
+2. Checkout and configure the project:
+
+ ```
+ git clone https://github.com/X-Friese/FlyWithLua.git
+ cd FlyWithLua
+ cmake -S ./src -B ./build -DCMAKE_BUILD_TYPE=RelWithDebInfo
+ ```
+
+3. Build the project and copy the plugin DLL into the appropriate directory:
+
+ ```
+ cmake --build ./build
+ cp ./build/mac.xpl ./FlyWithLua/64
+ ```
+
+### Additional tips
+
+
+How to cross-compile FlyWithLua on Ubuntu for Windows and OS X
+
+Note: this is documented just in case, but generally is not recommended. Using native builds and/or GitHub Actions workflow is more convenient and less prone to errors and bugs.
+
+Install cross-compiling toolchains:
+
+```
+# Install Windows cross-compiling toolchain (MinGW).
+sudo apt-get install -y --no-install-recommends mingw-w64 g++-mingw-w64 && apt-get clean
+
+# Install OS X cross-compiling toolchain (clang).
+apt-get install -y --no-install-recommends clang curl && apt-get clean
+#Build arguments
+OSXCROSS_REPO="tpoechtrager/osxcross"
+OSXCROSS_REVISION="f4ba4facae996b3b14d89eb62c0384564f7368b5"
+DARWIN_SDK_VERSION="10.11"
+DARWIN_SDK_URL="https://github.com/apriorit/osxcross-sdks/raw/master/MacOSX10.11.sdk.tar.xz"
+CROSSBUILD=1
+
+mkdir -p "/tmp/osxcross" \
+ && cd "/tmp/osxcross" \
+ && curl -sSLo osxcross.tar.gz "https://codeload.github.com/${OSXCROSS_REPO}/tar.gz/${OSXCROSS_REVISION}" \
+ && tar --strip=1 -xzf osxcross.tar.gz \
+ && rm -f osxcross.tar.gz \
+ && curl -sLo tarballs/MacOSX${DARWIN_SDK_VERSION}.sdk.tar.xz \
+ "${DARWIN_SDK_URL}" \
+ && UNATTENDED=1 JOBS=4 SDK_VERSION=${DARWIN_SDK_VERSION} ./build.sh \
+ && mv target /usr/osxcross \
+ && mv tools /usr/osxcross/ \
+ && rm -rf "/usr/osxcross/SDK/MacOSX${DARWIN_SDK_VERSION}.sdk/usr/share/man"
+
+export PATH="$PATH:/usr/osxcross/bin"
+```
+
+Build FlyWithLua:
+
+```
+git clone https://github.com/X-Friese/FlyWithLua.git
+cd FlyWithLua
+
+# For Windows:
+cmake -S ./src -B ./build-win -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=src/Toolchain-mingw-w64-x86-64.cmake
+cmake --build ./build-win
+
+# For OS X:
+cmake -S ./src -B ./build-mac -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=src/Toolchain-ubuntu-osxcross-10.11.cmake -DCMAKE_FIND_ROOT_PATH=/usr/osxcross/SDK/MacOSX10.11.sdk/
+cmake --build ./build-mac
+```
+
+
+
+
+How to create Code Blocks Project From CmakeLists.txt File
+
+- First you will need to install MinGW-64, Cmake, CodeBlocks and Git.
+- Create a CodeBlocks Projects folder like this.
+- `mkdir CodeBlocksProjects`
+- `cd D:\CodeBlocksProjects`
+- `git clone https://github.com/X-Friese/FlyWithLua.git`
+- `cd FlyWithLua/src`
+- `mkdir build`
+- `cd build`
+- `cmake -G "CodeBlocks - MinGW Makefiles" ..`
+- Open CodeBlocks and use "Open an existing project" browsing to "FlyWithLua/src/build/FlyWithLua.cbp" and click on the Open button.
+
+At that point you should be able to build FlwWithLua.
+
+
+
+
+How To Build Using QT Creator From the CmakeLists.txt File
+
+- Create a QT Creator Projects folder like this.
+ - `mkdir QTCreatorProjects`
+ - `cd D:\QTCreatorProjects`
+ - `git clone https://github.com/X-Friese/FlyWithLua.git`
+- Using QT Creator use "File" > "Open File or Project" and browse to "FlyWithLua/src/CMakeLists.txt" then click on the "Open" button.
+
+At that point you should be able to build FlyWithLua.
+
+
diff --git a/buildFlyWithLua_NG b/buildFlyWithLua_NG
deleted file mode 100755
index 2f599687..00000000
--- a/buildFlyWithLua_NG
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-#
-# How to run
-# ./xp11_FlyWithLua_NG_plugin_builder/FlyWithLua/buildFlyWithLua_NG
-
-cd ~/xp11_FlyWithLua_NG_plugin_builder/FlyWithLua
-
-rm -r src/build-mac/*
-rm -r src/build-lin/*
-rm -r src/build-win/*
-rm -r FlyWithLua/64/*.xpl
-
-(cd docker; make)
-
-cp src/build-mac/mac.xpl ~/xp11_FlyWithLua_NG_plugin_builder/FlyWithLua/FlyWithLua/64/mac.xpl
-
-cp src/build-lin/lin.xpl ~/xp11_FlyWithLua_NG_plugin_builder/FlyWithLua/FlyWithLua/64/lin.xpl
-
-cp src/build-win/win.xpl ~/xp11_FlyWithLua_NG_plugin_builder/FlyWithLua/FlyWithLua/64/win.xpl
-
-exec $SHELL
-#
-
diff --git a/docker/.gitignore b/docker/.gitignore
deleted file mode 100644
index 8dfca4d3..00000000
--- a/docker/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-.image
diff --git a/docker/Dockerfile b/docker/Dockerfile
deleted file mode 100644
index 9f3489fb..00000000
--- a/docker/Dockerfile
+++ /dev/null
@@ -1,54 +0,0 @@
-FROM ubuntu:16.04
-
-RUN sed -i -e 's/http:\/\/archive.ubuntu.com\/ubuntu\//mirror:\/\/mirrors.ubuntu.com\/mirrors.txt/' /etc/apt/sources.list && apt-get update
-
-# Install Linux toolchain (GCC).
-RUN apt-get install -y --no-install-recommends build-essential ninja-build sudo bash coreutils ca-certificates curl \
- && apt-get clean \
- && curl -sSL https://cmake.org/files/v3.12/cmake-3.12.3-Linux-x86_64.tar.gz \
- | tar -xz -C /usr/local/ --strip-components=1
-
-# Install Windows cross-compiling toolchain (MinGW).
-RUN apt-get install -y --no-install-recommends mingw-w64 g++-mingw-w64 && apt-get clean
-
-# Install OS X cross-compiling toolchain (clang).
-
-RUN apt-get install -y --no-install-recommends clang curl && apt-get clean
-#Build arguments
-ARG osxcross_repo="tpoechtrager/osxcross"
-ARG osxcross_revision="f4ba4facae996b3b14d89eb62c0384564f7368b5"
-ARG darwin_sdk_version="10.11"
-ARG darwin_sdk_url="https://github.com/apriorit/osxcross-sdks/raw/master/MacOSX10.11.sdk.tar.xz"
-
-# ENV available in docker image
-ENV OSXCROSS_REPO="${osxcross_repo}" \
- OSXCROSS_REVISION="${osxcross_revision}" \
- DARWIN_SDK_VERSION="${darwin_sdk_version}" \
- DARWIN_SDK_URL="${darwin_sdk_url}" \
- CROSSBUILD=1
-
-RUN mkdir -p "/tmp/osxcross" \
- && cd "/tmp/osxcross" \
- && curl -sSLo osxcross.tar.gz "https://codeload.github.com/${OSXCROSS_REPO}/tar.gz/${OSXCROSS_REVISION}" \
- && tar --strip=1 -xzf osxcross.tar.gz \
- && rm -f osxcross.tar.gz \
- && curl -sLo tarballs/MacOSX${DARWIN_SDK_VERSION}.sdk.tar.xz \
- "${DARWIN_SDK_URL}" \
- && UNATTENDED=1 JOBS=4 SDK_VERSION=10.11 ./build.sh \
- && mv target /usr/osxcross \
- && mv tools /usr/osxcross/ \
- && rm -rf "/usr/osxcross/SDK/MacOSX${DARWIN_SDK_VERSION}.sdk/usr/share/man" \
- && true
-
-# Install dependency libraries under Linux.
-RUN apt-get install -y --no-install-recommends freeglut3-dev libudev-dev libopenal-dev && apt-get clean
-
-RUN echo "" | adduser --uid 1000 --disabled-password --gecos "" aleks && adduser aleks sudo
-RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
-
-VOLUME /src
-USER aleks
-ADD build.sh /usr/bin/build.sh
-
-WORKDIR /src
-ENTRYPOINT ["build.sh"]
diff --git a/docker/Makefile b/docker/Makefile
deleted file mode 100644
index 22dd7533..00000000
--- a/docker/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-platforms=win mac lin
-container=fwl-cross-compile-env
-
-# all: mac lin win
-# all: mac lin win
-all: mac win lin
-
-.image: Dockerfile build.sh
- docker build . -t $(container)
- docker inspect -f "{{ .ID}}" $(container):latest > .image
-
-bash: .image
- docker run -it --rm -v "$(realpath ../src):/src" --entrypoint bash $(container):latest
-
-$(platforms): .image
- docker run -i --rm -v "$(realpath ../src):/src" $(container):latest $@
-
-.PHONY: $(platforms) bash
diff --git a/docker/Makefile_no_cache b/docker/Makefile_no_cache
deleted file mode 100644
index 1f048487..00000000
--- a/docker/Makefile_no_cache
+++ /dev/null
@@ -1,18 +0,0 @@
-COMPLETE_EDITION=1
-
-platforms=win mac lin
-container=fwl-cross-compile-env
-
-all: mac win lin
-
-.image: Dockerfile build.sh
- docker build . -t $(container) --no-cache
- docker inspect -f "{{ .ID}}" $(container):latest > .image
-
-bash: .image
- docker run -it --rm -v "$(realpath ../src):/src" --entrypoint bash $(container):latest
-
-$(platforms): .image
- docker run -i --rm -v "$(realpath ../src):/src" $(container):latest --complete $(COMPLETE_EDITION) $@
-
-.PHONY: $(platforms) bash
diff --git a/docker/README.md b/docker/README.md
deleted file mode 100644
index 663d9335..00000000
--- a/docker/README.md
+++ /dev/null
@@ -1,42 +0,0 @@
-# FlyWithLua cross-compiling environment
-
-Scripts in this directory provide an easy way to build FlyWithLua for Windows,
-Linux and OS X in a reproducible way. This is useful when you want to verify
-that your changes work (or at least compile) for all supported platforms
-without manually setting up three independent build environments.
-
-The long-term goal is to integrate this seamlessly with host-native CMake and
-IDEs. For now it just simplifies setting things up and keeps your host system
-free of all the extra compilers and libraries for all platforms.
-
-## Prerequisites
-
- 1. [Docker](https://docs.docker.com/install/) — provides containers for
- a reproducible build environment independent from the host system.
- 2. GNU Make — provides an easy way to build container image and launch build
- processes.
-
-## Usage
-
-Let's assume we're in a root directory of Git repository:
-
- $ cd $FLY_WITH_LUA_REPO
-
-Build Complete Edition binaries for all platforms:
-
- $ (cd docker; make)
- $ ls src/build-*/*.xpl
- src/build-lin/lin.xpl src/build-mac/mac.xpl src/build-win/win.xpl
-
-Build Core Edition for all platforms:
-
- $ (cd docker; make COMPLETE_EDITION=0)
-
-Build for a specific platform (`lin`, `mac` or `win`):
-
- $ (cd docker; make lin)
-
-Start bash shell inside container, useful for various debugging needs or to
-access platform-specific tools:
-
- $ (cd docker; make bash)
diff --git a/docker/build.sh b/docker/build.sh
deleted file mode 100755
index b0c38af6..00000000
--- a/docker/build.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/bash
-set -e
-
-function build() {
- local src_dir="$1"
- local platform="$2"
- echo "----------------- Building for $platform -----------------"
-
- local build_dir="$src_dir/build-$platform"
-
- local flags=()
- local cmake="cmake"
- case "$platform" in
- lin)
- ;;
- win)
- flags+=('-DCMAKE_TOOLCHAIN_FILE=../Toolchain-mingw-w64-x86-64.cmake')
- ;;
- mac)
- flags+=('-DCMAKE_TOOLCHAIN_FILE=../Toolchain-ubuntu-osxcross-10.11.cmake')
- flags+=('-DCMAKE_FIND_ROOT_PATH=/usr/osxcross/SDK/MacOSX10.11.sdk/')
- ;;
- *)
- echo "Platform $platform is not supported, skipping..."
- return
- esac
-
- (
- export PATH="$PATH:/usr/osxcross/bin"
- mkdir -p "$build_dir" && cd "$build_dir"
- "$cmake" -G Ninja "${flags[@]}" ..
- ninja -v
- )
-}
-
-src_dir="$(pwd)"
-for platform in $@; do
- build "$src_dir" "$platform"
-done
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 14a91ffa..a277458d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -8,6 +8,10 @@
cmake_minimum_required(VERSION 3.9)
project(FlyWithLua VERSION 2.7.5 DESCRIPTION "FlyWithLua X-Plane plugin")
+# X-Plane supports OS X 10.10+, so this should ensure FlyWithLua can run on
+# all supported versions.
+set(CMAKE_OSX_DEPLOYMENT_TARGET "10.10")
+
# By default, use optimized release configuration.
if (NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
@@ -21,12 +25,12 @@ include_directories("${CMAKE_SOURCE_DIR}/XPSDK301/CHeaders/Wrappers")
include_directories("${CMAKE_SOURCE_DIR}/XPSDK301/CHeaders/XPLM")
include_directories("${CMAKE_SOURCE_DIR}/include64")
include_directories("${CMAKE_SOURCE_DIR}/hidapi")
-include_directories("${CMAKE_SOURCE_DIR}/OpenAL")
include_directories("${CMAKE_SOURCE_DIR}/.")
include_directories("${CMAKE_SOURCE_DIR}/FloatingWindows")
include_directories("${CMAKE_SOURCE_DIR}/imgui")
if (WIN32)
+ include_directories("${CMAKE_SOURCE_DIR}/OpenAL")
include_directories("${CMAKE_SOURCE_DIR}/GLUT_for_Windows")
endif (WIN32)
@@ -34,13 +38,11 @@ endif (WIN32)
# Specify library search locations.
if (WIN32)
list(APPEND CMAKE_LIBRARY_PATH "${CMAKE_SOURCE_DIR}/include64")
- list(APPEND CMAKE_LIBRARY_PATH "${CMAKE_SOURCE_DIR}/GLUT_for_Windows")
+ list(APPEND CMAKE_LIBRARY_PATH "${CMAKE_SOURCE_DIR}/GLUT_for_Windows/GL")
list(APPEND CMAKE_LIBRARY_PATH "${CMAKE_SOURCE_DIR}/XPSDK301/Libraries/Win")
elseif (APPLE)
list(APPEND CMAKE_FRAMEWORK_PATH "${CMAKE_SOURCE_DIR}/XPSDK301/Libraries/Mac")
- list(APPEND CMAKE_LIBRARY_PATH "${CMAKE_SOURCE_DIR}/mac_libs")
elseif (UNIX)
- list(APPEND CMAKE_LIBRARY_PATH "${CMAKE_SOURCE_DIR}/linux_libs/OpenAL")
endif ()
@@ -91,17 +93,10 @@ add_library(FlyWithLua SHARED ${FLYWITHLUA_SRCS})
target_compile_features(FlyWithLua PUBLIC cxx_std_11)
-if (APPLE)
- # X-Plane supports OS X 10.10+, so this should ensure FlyWithLua can run on
- # all supported versions.
- target_compile_options(FlyWithLua PUBLIC -mmacosx-version-min=10.10)
- target_link_libraries(FlyWithLua -mmacosx-version-min=10.10)
-endif ()
-
# Link OpenGL and OpenAL related libraries.
find_package(OpenGL REQUIRED) # apt install freeglut3-dev
find_library(OPENAL_LIBRARY NAMES openal OpenAL OpenAL32) # apt install libopenal-dev
-find_library(GLUT_LIBRARY NAMES glut GLUT glut64) # apt install freeglut3-dev
+find_library(GLUT_LIBRARY NAMES glut64 glut) # apt install freeglut3-dev
target_link_libraries(FlyWithLua ${OPENGL_LIBRARIES} ${OPENAL_LIBRARY} ${GLUT_LIBRARY})
# Link Lua related libraries.
@@ -123,7 +118,10 @@ endif ()
# Link OS-specific libraries HidApi depends on. Only supported for Windows and Linux.
if ((WIN32 OR UNIX) AND NOT APPLE)
- find_library(HIDAPIDEPS_LIBRARY NAMES setupapi udev)
+ # HINTS is required to force CMake to search among the toolchain-provided libraries.
+ # This is important to make sure that the correct library is picked up on a system with
+ # several toolchains installed.
+ find_library(HIDAPIDEPS_LIBRARY NAMES setupapi udev HINTS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES})
target_link_libraries(FlyWithLua ${HIDAPIDEPS_LIBRARY})
endif ()
@@ -155,7 +153,7 @@ elseif (UNIX)
# Specify additional runtime search laths for dynamically-linked libraries.
target_link_libraries(FlyWithLua -Wl,-rpath=./Resources/plugins/FlyWithLua/64)
target_link_libraries(FlyWithLua -Wl,-rpath=./Resources/plugins/FlyWithLua/Modules)
- # Restrict set of symbols exported from the plugin. This reduces changes of
+ # Restrict set of symbols exported from the plugin. This reduces chances of
# conflict with other plugins, in particular ones with Lua interpreter
# embedded.
target_link_libraries(FlyWithLua -Wl,--version-script -Wl,${CMAKE_SOURCE_DIR}/flywithlua.sym)
diff --git a/src/How_To_Build_FlyWithLua_NG.txt b/src/How_To_Build_FlyWithLua_NG.txt
deleted file mode 100644
index 8817ae59..00000000
--- a/src/How_To_Build_FlyWithLua_NG.txt
+++ /dev/null
@@ -1,172 +0,0 @@
-I have tried to move all the dependicies into the src folder but if I have missed any please contact me.
-
-Moving to the folder you want to build FlyWithLua NG in use the following commands.
-
-First use "Git Clone https://github.com/X-Friese/FlyWithLua.git"
-
-Now "cd FlyWithLua/scr"
-
-Next "mkdir build"
-
-Next "cd build"
-
-Next "cmake .."
-
-Next "make"
-
-If everything went well you should see a *.xpl in build for the platform you are on.
-
-My goal after getting this working is to be able to import the CMakeLists.txt file into CodeBlocks so that can be used for the IDE.
-
-*********************************************************************************************************************************
-
-
-Here are some examples of how to build for mutiple platforms and build systems.
-
-
-******************************* Build For Windows On Linux *******************************************************************
-
-If you are wanting to build for Windows on Linux you need x86_64-w64-mingw32 installed and use the following commands.
-
-Starting from the folder you want to build FlyWithLua NG in use the following commands.
-
-First use "Git Clone https://github.com/X-Friese/FlyWithLua.git"
-
-Now "cd FlyWithLua/scr"
-
-Next "mkdir build"
-
-Next "cd build"
-
-Next "cmake -DCMAKE_TOOLCHAIN_FILE=../Toolchain-mingw-w64-x86-64.cmake .."
-
-Next "make"
-
-If everything went well you should see a win.xpl in the build folder.
-
-
-*********************************** Build For Windows On Windows Using MSYS *************************************************
-
-If you are wanting to build for Windows on Windows using Msys use the following commands.
-
-Starting from folder you want to build FlyWithLua NG in use the following commands.
-
-First use "git clone https://github.com/X-Friese/FlyWithLua.git"
-
-Now "cd FlyWithLua"
-
-Next "cd src"
-
-Next "mkdir build"
-
-Next "cd build"
-
-Next "cmake -G 'MSYS Makefiles' .."
-
-Next "make"
-
-If everything went well you should see a win.xpl in the build folder.
-
-
-*********************************** Build For Linux On Linux ***********************************************************
-
-If you are wanting to build for Linux on Linux use the following commands.
-
-Starting from folder you want to build FlyWithLua NG in use the following commands.
-
-First use "Git Clone https://github.com/X-Friese/FlyWithLua.git"
-
-Now "cd FlyWithLua/scr"
-
-Next "mkdir build"
-
-Next "cd build"
-
-Next "cmake .."
-
-Next "make"
-
-If everything went well you should see a lin.xpl in the build folder.
-
-
-*************************************** Build for Mac on Linux using osxcross ************************************************
-
-
-If you are wanting to build for the Mac on Linux use the following commands.
-
-First you need to install osxcross found here "https://github.com/tpoechtrager/osxcross" and follow the instructions on how to install.
-
-Starting from folder you want to build FlyWithLua NG in use the following commands.
-
-First use "Git Clone https://github.com/X-Friese/FlyWithLua.git"
-
-Now "cd FlyWithLua/scr"
-
-Next "mkdir build"
-
-Next "cd build"
-
-Next "cmake -DCMAKE_TOOLCHAIN_FILE=../Toolchain-ubuntu-osxcross-10.11.cmake .."
-
-Next "make"
-
-If everything went well you should see a mac.xpl in the build folder.
-
-
-
-*************************************** Some Other Comands I Have Found Useful ************************************************
-
-If you are in the build folder using there three commands will clear out the build folder and put you back there ready for a Cmake command.
-
-First "cd .."
-
-Then "rm -r build/*"
-
-Then "cd build"
-
-
-If you want make to be more verbose use this command.
-
-"make VERBOSE=1"
-
-
-******************************************** Create Code Blocks Project From CmakeLists.txt File **************************************
-
-
-First you will need to install MinGW-64, Cmake, CodeBlocks and Git.
-
-Create a CodeBlocks Projects folder like this.
-
-"mkdir CodeBlocksProjects"
-
-"cd D:\CodeBlocksProjects"
-
-"git clone https://github.com/X-Friese/FlyWithLua.git"
-
-"cd FlyWithLua/src"
-
-"mkdir build"
-
-"cd build"
-
-"cmake -G "CodeBlocks - MinGW Makefiles" .."
-
-Open CodeBlocks and use "Open an existing project" browsing to "FlyWithLua/src/build/FlyWithLua.cbp" and click on the Open button.
-
-At that point you should be able to build FlwWithLua.
-
-
-******************************** How To Build Using QT Creator From the CmakeLists.txt File ******************************************
-
-
-Create a QT Creator Projects folder like this.
-
-"mkdir QTCreatorProjects"
-
-"cd D:\QTCreatorProjects"
-
-"git clone https://github.com/X-Friese/FlyWithLua.git"
-
-Using QT Creator use "File" > "Open File or Project" and browse to "FlyWithLua/src/CMakeLists.txt" then click on the "Open" button.
-
-At that point you should be able to build FlyWithLua.
diff --git a/src/include64/glut64.lib b/src/include64/glut64.lib
deleted file mode 100644
index d5f244d2..00000000
Binary files a/src/include64/glut64.lib and /dev/null differ
diff --git a/src/include64/hid.c b/src/include64/hid.c
deleted file mode 100644
index 427bcd1c..00000000
--- a/src/include64/hid.c
+++ /dev/null
@@ -1,939 +0,0 @@
-/*******************************************************
- HIDAPI - Multi-Platform library for
- communication with HID devices.
-
- Alan Ott
- Signal 11 Software
-
- 8/22/2009
-
- Copyright 2009, All Rights Reserved.
-
- At the discretion of the user of this library,
- this software may be licensed under the terms of the
- GNU General Public License v3, a BSD-Style license, or the
- original HIDAPI license as outlined in the LICENSE.txt,
- LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt
- files located at the root of the source distribution.
- These files may also be found in the public source
- code repository located at:
- http://github.com/signal11/hidapi .
-********************************************************/
-
-#include
-
-#ifndef _NTDEF_
-typedef LONG NTSTATUS;
-#endif
-
-#ifdef __MINGW32__
-#include
-#include
-#endif
-
-#ifdef __CYGWIN__
-#include
-#define _wcsdup wcsdup
-#endif
-
-/*#define HIDAPI_USE_DDK*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
- #include
- #include
- #ifdef HIDAPI_USE_DDK
- #include
- #endif
-
- /* Copied from inc/ddk/hidclass.h, part of the Windows DDK. */
- #define HID_OUT_CTL_CODE(id) \
- CTL_CODE(FILE_DEVICE_KEYBOARD, (id), METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
- #define IOCTL_HID_GET_FEATURE HID_OUT_CTL_CODE(100)
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#include
-#include
-
-
-#include "hidapi.h"
-
-#ifdef _MSC_VER
- /* Thanks Microsoft, but I know how to use strncpy(). */
- #pragma warning(disable:4996)
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef HIDAPI_USE_DDK
- /* Since we're not building with the DDK, and the HID header
- files aren't part of the SDK, we have to define all this
- stuff here. In lookup_functions(), the function pointers
- defined below are set. */
- typedef struct _HIDD_ATTRIBUTES{
- ULONG Size;
- USHORT VendorID;
- USHORT ProductID;
- USHORT VersionNumber;
- } HIDD_ATTRIBUTES, *PHIDD_ATTRIBUTES;
-
- typedef USHORT USAGE;
- typedef struct _HIDP_CAPS {
- USAGE Usage;
- USAGE UsagePage;
- USHORT InputReportByteLength;
- USHORT OutputReportByteLength;
- USHORT FeatureReportByteLength;
- USHORT Reserved[17];
- USHORT fields_not_used_by_hidapi[10];
- } HIDP_CAPS, *PHIDP_CAPS;
- typedef void* PHIDP_PREPARSED_DATA;
- #define HIDP_STATUS_SUCCESS 0x110000
-
- typedef BOOLEAN (__stdcall *HidD_GetAttributes_)(HANDLE device, PHIDD_ATTRIBUTES attrib);
- typedef BOOLEAN (__stdcall *HidD_GetSerialNumberString_)(HANDLE device, PVOID buffer, ULONG buffer_len);
- typedef BOOLEAN (__stdcall *HidD_GetManufacturerString_)(HANDLE handle, PVOID buffer, ULONG buffer_len);
- typedef BOOLEAN (__stdcall *HidD_GetProductString_)(HANDLE handle, PVOID buffer, ULONG buffer_len);
- typedef BOOLEAN (__stdcall *HidD_SetFeature_)(HANDLE handle, PVOID data, ULONG length);
- typedef BOOLEAN (__stdcall *HidD_GetFeature_)(HANDLE handle, PVOID data, ULONG length);
- typedef BOOLEAN (__stdcall *HidD_GetIndexedString_)(HANDLE handle, ULONG string_index, PVOID buffer, ULONG buffer_len);
- typedef BOOLEAN (__stdcall *HidD_GetPreparsedData_)(HANDLE handle, PHIDP_PREPARSED_DATA *preparsed_data);
- typedef BOOLEAN (__stdcall *HidD_FreePreparsedData_)(PHIDP_PREPARSED_DATA preparsed_data);
- typedef NTSTATUS (__stdcall *HidP_GetCaps_)(PHIDP_PREPARSED_DATA preparsed_data, HIDP_CAPS *caps);
- typedef BOOLEAN (__stdcall *HidD_SetNumInputBuffers_)(HANDLE handle, ULONG number_buffers);
-
- static HidD_GetAttributes_ HidD_GetAttributes;
- static HidD_GetSerialNumberString_ HidD_GetSerialNumberString;
- static HidD_GetManufacturerString_ HidD_GetManufacturerString;
- static HidD_GetProductString_ HidD_GetProductString;
- static HidD_SetFeature_ HidD_SetFeature;
- static HidD_GetFeature_ HidD_GetFeature;
- static HidD_GetIndexedString_ HidD_GetIndexedString;
- static HidD_GetPreparsedData_ HidD_GetPreparsedData;
- static HidD_FreePreparsedData_ HidD_FreePreparsedData;
- static HidP_GetCaps_ HidP_GetCaps;
- static HidD_SetNumInputBuffers_ HidD_SetNumInputBuffers;
-
- static HMODULE lib_handle = NULL;
- static BOOLEAN initialized = FALSE;
-#endif /* HIDAPI_USE_DDK */
-
-struct hid_device_ {
- HANDLE device_handle;
- BOOL blocking;
- USHORT output_report_length;
- size_t input_report_length;
- void *last_error_str;
- DWORD last_error_num;
- BOOL read_pending;
- char *read_buf;
- OVERLAPPED ol;
-};
-
-static hid_device *new_hid_device()
-{
- hid_device *dev = (hid_device*) calloc(1, sizeof(hid_device));
- dev->device_handle = INVALID_HANDLE_VALUE;
- dev->blocking = TRUE;
- dev->output_report_length = 0;
- dev->input_report_length = 0;
- dev->last_error_str = NULL;
- dev->last_error_num = 0;
- dev->read_pending = FALSE;
- dev->read_buf = NULL;
- memset(&dev->ol, 0, sizeof(dev->ol));
- dev->ol.hEvent = CreateEvent(NULL, FALSE, FALSE /*inital state f=nonsignaled*/, NULL);
-
- return dev;
-}
-
-static void free_hid_device(hid_device *dev)
-{
- CloseHandle(dev->ol.hEvent);
- CloseHandle(dev->device_handle);
- LocalFree(dev->last_error_str);
- free(dev->read_buf);
- free(dev);
-}
-
-static void register_error(hid_device *device, const char *op)
-{
- WCHAR *ptr, *msg;
-
- FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPVOID)&msg, 0/*sz*/,
- NULL);
-
- /* Get rid of the CR and LF that FormatMessage() sticks at the
- end of the message. Thanks Microsoft! */
- ptr = msg;
- while (*ptr) {
- if (*ptr == '\r') {
- *ptr = 0x0000;
- break;
- }
- ptr++;
- }
-
- /* Store the message off in the Device entry so that
- the hid_error() function can pick it up. */
- LocalFree(device->last_error_str);
- device->last_error_str = msg;
-}
-
-#ifndef HIDAPI_USE_DDK
-static int lookup_functions()
-{
- lib_handle = LoadLibraryA("hid.dll");
- if (lib_handle) {
-#define RESOLVE(x) x = (x##_)GetProcAddress(lib_handle, #x); if (!x) return -1;
- RESOLVE(HidD_GetAttributes);
- RESOLVE(HidD_GetSerialNumberString);
- RESOLVE(HidD_GetManufacturerString);
- RESOLVE(HidD_GetProductString);
- RESOLVE(HidD_SetFeature);
- RESOLVE(HidD_GetFeature);
- RESOLVE(HidD_GetIndexedString);
- RESOLVE(HidD_GetPreparsedData);
- RESOLVE(HidD_FreePreparsedData);
- RESOLVE(HidP_GetCaps);
- RESOLVE(HidD_SetNumInputBuffers);
-#undef RESOLVE
- }
- else
- return -1;
-
- return 0;
-}
-#endif
-
-static HANDLE open_device(const char *path, BOOL enumerate)
-{
- HANDLE handle;
- DWORD desired_access = (enumerate)? 0: (GENERIC_WRITE | GENERIC_READ);
- DWORD share_mode = (enumerate)?
- FILE_SHARE_READ|FILE_SHARE_WRITE:
- FILE_SHARE_READ;
-
- handle = CreateFileA(path,
- desired_access,
- share_mode,
- NULL,
- OPEN_EXISTING,
- FILE_FLAG_OVERLAPPED,/*FILE_ATTRIBUTE_NORMAL,*/
- 0);
-
- return handle;
-}
-
-int HID_API_EXPORT hid_init(void)
-{
-#ifndef HIDAPI_USE_DDK
- if (!initialized) {
- if (lookup_functions() < 0) {
- hid_exit();
- return -1;
- }
- initialized = TRUE;
- }
-#endif
- return 0;
-}
-
-int HID_API_EXPORT hid_exit(void)
-{
-#ifndef HIDAPI_USE_DDK
- if (lib_handle)
- FreeLibrary(lib_handle);
- lib_handle = NULL;
- initialized = FALSE;
-#endif
- return 0;
-}
-
-struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id)
-{
- BOOL res;
- struct hid_device_info *root = NULL; /* return object */
- struct hid_device_info *cur_dev = NULL;
-
- /* Windows objects for interacting with the driver. */
- GUID InterfaceClassGuid = {0x4d1e55b2, 0xf16f, 0x11cf, {0x88, 0xcb, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30} };
- SP_DEVINFO_DATA devinfo_data;
- SP_DEVICE_INTERFACE_DATA device_interface_data;
- SP_DEVICE_INTERFACE_DETAIL_DATA_A *device_interface_detail_data = NULL;
- HDEVINFO device_info_set = INVALID_HANDLE_VALUE;
- int device_index = 0;
- int i;
-
- if (hid_init() < 0)
- return NULL;
-
- /* Initialize the Windows objects. */
- memset(&devinfo_data, 0x0, sizeof(devinfo_data));
- devinfo_data.cbSize = sizeof(SP_DEVINFO_DATA);
- device_interface_data.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
-
- /* Get information for all the devices belonging to the HID class. */
- device_info_set = SetupDiGetClassDevsA(&InterfaceClassGuid, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
-
- /* Iterate over each device in the HID class, looking for the right one. */
-
- for (;;) {
- HANDLE write_handle = INVALID_HANDLE_VALUE;
- DWORD required_size = 0;
- HIDD_ATTRIBUTES attrib;
-
- res = SetupDiEnumDeviceInterfaces(device_info_set,
- NULL,
- &InterfaceClassGuid,
- device_index,
- &device_interface_data);
-
- if (!res) {
- /* A return of FALSE from this function means that
- there are no more devices. */
- break;
- }
-
- /* Call with 0-sized detail size, and let the function
- tell us how long the detail struct needs to be. The
- size is put in &required_size. */
- res = SetupDiGetDeviceInterfaceDetailA(device_info_set,
- &device_interface_data,
- NULL,
- 0,
- &required_size,
- NULL);
-
- /* Allocate a long enough structure for device_interface_detail_data. */
- device_interface_detail_data = (SP_DEVICE_INTERFACE_DETAIL_DATA_A*) malloc(required_size);
- device_interface_detail_data->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_A);
-
- /* Get the detailed data for this device. The detail data gives us
- the device path for this device, which is then passed into
- CreateFile() to get a handle to the device. */
- res = SetupDiGetDeviceInterfaceDetailA(device_info_set,
- &device_interface_data,
- device_interface_detail_data,
- required_size,
- NULL,
- NULL);
-
- if (!res) {
- /* register_error(dev, "Unable to call SetupDiGetDeviceInterfaceDetail");
- Continue to the next device. */
- goto cont;
- }
-
- /* Make sure this device is of Setup Class "HIDClass" and has a
- driver bound to it. */
- for (i = 0; ; i++) {
- char driver_name[256];
-
- /* Populate devinfo_data. This function will return failure
- when there are no more interfaces left. */
- res = SetupDiEnumDeviceInfo(device_info_set, i, &devinfo_data);
- if (!res)
- goto cont;
-
- res = SetupDiGetDeviceRegistryPropertyA(device_info_set, &devinfo_data,
- SPDRP_CLASS, NULL, (PBYTE)driver_name, sizeof(driver_name), NULL);
- if (!res)
- goto cont;
-
- if (strcmp(driver_name, "HIDClass") == 0) {
- /* See if there's a driver bound. */
- res = SetupDiGetDeviceRegistryPropertyA(device_info_set, &devinfo_data,
- SPDRP_DRIVER, NULL, (PBYTE)driver_name, sizeof(driver_name), NULL);
- if (res)
- break;
- }
- }
-
- //wprintf(L"HandleName: %s\n", device_interface_detail_data->DevicePath);
-
- /* Open a handle to the device */
- write_handle = open_device(device_interface_detail_data->DevicePath, TRUE);
-
- /* Check validity of write_handle. */
- if (write_handle == INVALID_HANDLE_VALUE) {
- /* Unable to open the device. */
- //register_error(dev, "CreateFile");
- goto cont_close;
- }
-
-
- /* Get the Vendor ID and Product ID for this device. */
- attrib.Size = sizeof(HIDD_ATTRIBUTES);
- HidD_GetAttributes(write_handle, &attrib);
- //wprintf(L"Product/Vendor: %x %x\n", attrib.ProductID, attrib.VendorID);
-
- /* Check the VID/PID to see if we should add this
- device to the enumeration list. */
- if ((vendor_id == 0x0 || attrib.VendorID == vendor_id) &&
- (product_id == 0x0 || attrib.ProductID == product_id)) {
-
- #define WSTR_LEN 512
- const char *str;
- struct hid_device_info *tmp;
- PHIDP_PREPARSED_DATA pp_data = NULL;
- HIDP_CAPS caps;
- BOOLEAN res;
- NTSTATUS nt_res;
- wchar_t wstr[WSTR_LEN]; /* TODO: Determine Size */
- size_t len;
-
- /* VID/PID match. Create the record. */
- tmp = (struct hid_device_info*) calloc(1, sizeof(struct hid_device_info));
- if (cur_dev) {
- cur_dev->next = tmp;
- }
- else {
- root = tmp;
- }
- cur_dev = tmp;
-
- /* Get the Usage Page and Usage for this device. */
- res = HidD_GetPreparsedData(write_handle, &pp_data);
- if (res) {
- nt_res = HidP_GetCaps(pp_data, &caps);
- if (nt_res == HIDP_STATUS_SUCCESS) {
- cur_dev->usage_page = caps.UsagePage;
- cur_dev->usage = caps.Usage;
- }
-
- HidD_FreePreparsedData(pp_data);
- }
-
- /* Fill out the record */
- cur_dev->next = NULL;
- str = device_interface_detail_data->DevicePath;
- if (str) {
- len = strlen(str);
- cur_dev->path = (char*) calloc(len+1, sizeof(char));
- strncpy(cur_dev->path, str, len+1);
- cur_dev->path[len] = '\0';
- }
- else
- cur_dev->path = NULL;
-
- /* Serial Number */
- res = HidD_GetSerialNumberString(write_handle, wstr, sizeof(wstr));
- wstr[WSTR_LEN-1] = 0x0000;
- if (res) {
- cur_dev->serial_number = _wcsdup(wstr);
- }
-
- /* Manufacturer String */
- res = HidD_GetManufacturerString(write_handle, wstr, sizeof(wstr));
- wstr[WSTR_LEN-1] = 0x0000;
- if (res) {
- cur_dev->manufacturer_string = _wcsdup(wstr);
- }
-
- /* Product String */
- res = HidD_GetProductString(write_handle, wstr, sizeof(wstr));
- wstr[WSTR_LEN-1] = 0x0000;
- if (res) {
- cur_dev->product_string = _wcsdup(wstr);
- }
-
- /* VID/PID */
- cur_dev->vendor_id = attrib.VendorID;
- cur_dev->product_id = attrib.ProductID;
-
- /* Release Number */
- cur_dev->release_number = attrib.VersionNumber;
-
- /* Interface Number. It can sometimes be parsed out of the path
- on Windows if a device has multiple interfaces. See
- http://msdn.microsoft.com/en-us/windows/hardware/gg487473 or
- search for "Hardware IDs for HID Devices" at MSDN. If it's not
- in the path, it's set to -1. */
- cur_dev->interface_number = -1;
- if (cur_dev->path) {
- char *interface_component = strstr(cur_dev->path, "&mi_");
- if (interface_component) {
- char *hex_str = interface_component + 4;
- char *endptr = NULL;
- cur_dev->interface_number = strtol(hex_str, &endptr, 16);
- if (endptr == hex_str) {
- /* The parsing failed. Set interface_number to -1. */
- cur_dev->interface_number = -1;
- }
- }
- }
- }
-
-cont_close:
- CloseHandle(write_handle);
-cont:
- /* We no longer need the detail data. It can be freed */
- free(device_interface_detail_data);
-
- device_index++;
-
- }
-
- /* Close the device information handle. */
- SetupDiDestroyDeviceInfoList(device_info_set);
-
- return root;
-
-}
-
-void HID_API_EXPORT HID_API_CALL hid_free_enumeration(struct hid_device_info *devs)
-{
- /* TODO: Merge this with the Linux version. This function is platform-independent. */
- struct hid_device_info *d = devs;
- while (d) {
- struct hid_device_info *next = d->next;
- free(d->path);
- free(d->serial_number);
- free(d->manufacturer_string);
- free(d->product_string);
- free(d);
- d = next;
- }
-}
-
-
-HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number)
-{
- /* TODO: Merge this functions with the Linux version. This function should be platform independent. */
- struct hid_device_info *devs, *cur_dev;
- const char *path_to_open = NULL;
- hid_device *handle = NULL;
-
- devs = hid_enumerate(vendor_id, product_id);
- cur_dev = devs;
- while (cur_dev) {
- if (cur_dev->vendor_id == vendor_id &&
- cur_dev->product_id == product_id) {
- if (serial_number) {
- if (wcscmp(serial_number, cur_dev->serial_number) == 0) {
- path_to_open = cur_dev->path;
- break;
- }
- }
- else {
- path_to_open = cur_dev->path;
- break;
- }
- }
- cur_dev = cur_dev->next;
- }
-
- if (path_to_open) {
- /* Open the device */
- handle = hid_open_path(path_to_open);
- }
-
- hid_free_enumeration(devs);
-
- return handle;
-}
-
-HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path)
-{
- hid_device *dev;
- HIDP_CAPS caps;
- PHIDP_PREPARSED_DATA pp_data = NULL;
- BOOLEAN res;
- NTSTATUS nt_res;
-
- if (hid_init() < 0) {
- return NULL;
- }
-
- dev = new_hid_device();
-
- /* Open a handle to the device */
- dev->device_handle = open_device(path, FALSE);
-
- /* Check validity of write_handle. */
- if (dev->device_handle == INVALID_HANDLE_VALUE) {
- /* Unable to open the device. */
- register_error(dev, "CreateFile");
- goto err;
- }
-
- /* Set the Input Report buffer size to 64 reports. */
- res = HidD_SetNumInputBuffers(dev->device_handle, 64);
- if (!res) {
- register_error(dev, "HidD_SetNumInputBuffers");
- goto err;
- }
-
- /* Get the Input Report length for the device. */
- res = HidD_GetPreparsedData(dev->device_handle, &pp_data);
- if (!res) {
- register_error(dev, "HidD_GetPreparsedData");
- goto err;
- }
- nt_res = HidP_GetCaps(pp_data, &caps);
- if (nt_res != HIDP_STATUS_SUCCESS) {
- register_error(dev, "HidP_GetCaps");
- goto err_pp_data;
- }
- dev->output_report_length = caps.OutputReportByteLength;
- dev->input_report_length = caps.InputReportByteLength;
- HidD_FreePreparsedData(pp_data);
-
- dev->read_buf = (char*) malloc(dev->input_report_length);
-
- return dev;
-
-err_pp_data:
- HidD_FreePreparsedData(pp_data);
-err:
- free_hid_device(dev);
- return NULL;
-}
-
-int HID_API_EXPORT HID_API_CALL hid_write(hid_device *dev, const unsigned char *data, size_t length)
-{
- DWORD bytes_written;
- BOOL res;
-
- OVERLAPPED ol;
- unsigned char *buf;
- memset(&ol, 0, sizeof(ol));
-
- /* Make sure the right number of bytes are passed to WriteFile. Windows
- expects the number of bytes which are in the _longest_ report (plus
- one for the report number) bytes even if the data is a report
- which is shorter than that. Windows gives us this value in
- caps.OutputReportByteLength. If a user passes in fewer bytes than this,
- create a temporary buffer which is the proper size. */
- if (length >= dev->output_report_length) {
- /* The user passed the right number of bytes. Use the buffer as-is. */
- buf = (unsigned char *) data;
- } else {
- /* Create a temporary buffer and copy the user's data
- into it, padding the rest with zeros. */
- buf = (unsigned char *) malloc(dev->output_report_length);
- memcpy(buf, data, length);
- memset(buf + length, 0, dev->output_report_length - length);
- length = dev->output_report_length;
- }
-
- res = WriteFile(dev->device_handle, buf, length, NULL, &ol);
-
- if (!res) {
- if (GetLastError() != ERROR_IO_PENDING) {
- /* WriteFile() failed. Return error. */
- register_error(dev, "WriteFile");
- bytes_written = -1;
- goto end_of_function;
- }
- }
-
- /* Wait here until the write is done. This makes
- hid_write() synchronous. */
- res = GetOverlappedResult(dev->device_handle, &ol, &bytes_written, TRUE/*wait*/);
- if (!res) {
- /* The Write operation failed. */
- register_error(dev, "WriteFile");
- bytes_written = -1;
- goto end_of_function;
- }
-
-end_of_function:
- if (buf != data)
- free(buf);
-
- return bytes_written;
-}
-
-
-int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds)
-{
- DWORD bytes_read = 0;
- size_t copy_len = 0;
- BOOL res;
-
- /* Copy the handle for convenience. */
- HANDLE ev = dev->ol.hEvent;
-
- if (!dev->read_pending) {
- /* Start an Overlapped I/O read. */
- dev->read_pending = TRUE;
- memset(dev->read_buf, 0, dev->input_report_length);
- ResetEvent(ev);
- res = ReadFile(dev->device_handle, dev->read_buf, dev->input_report_length, &bytes_read, &dev->ol);
-
- if (!res) {
- if (GetLastError() != ERROR_IO_PENDING) {
- /* ReadFile() has failed.
- Clean up and return error. */
- CancelIo(dev->device_handle);
- dev->read_pending = FALSE;
- goto end_of_function;
- }
- }
- }
-
- if (milliseconds >= 0) {
- /* See if there is any data yet. */
- res = WaitForSingleObject(ev, milliseconds);
- if (res != WAIT_OBJECT_0) {
- /* There was no data this time. Return zero bytes available,
- but leave the Overlapped I/O running. */
- return 0;
- }
- }
-
- /* Either WaitForSingleObject() told us that ReadFile has completed, or
- we are in non-blocking mode. Get the number of bytes read. The actual
- data has been copied to the data[] array which was passed to ReadFile(). */
- res = GetOverlappedResult(dev->device_handle, &dev->ol, &bytes_read, TRUE/*wait*/);
-
- /* Set pending back to false, even if GetOverlappedResult() returned error. */
- dev->read_pending = FALSE;
-
- if (res && bytes_read > 0) {
- if (dev->read_buf[0] == 0x0) {
- /* If report numbers aren't being used, but Windows sticks a report
- number (0x0) on the beginning of the report anyway. To make this
- work like the other platforms, and to make it work more like the
- HID spec, we'll skip over this byte. */
- bytes_read--;
- copy_len = length > bytes_read ? bytes_read : length;
- memcpy(data, dev->read_buf+1, copy_len);
- }
- else {
- /* Copy the whole buffer, report number and all. */
- copy_len = length > bytes_read ? bytes_read : length;
- memcpy(data, dev->read_buf, copy_len);
- }
- }
-
-end_of_function:
- if (!res) {
- register_error(dev, "GetOverlappedResult");
- return -1;
- }
-
- return copy_len;
-}
-
-int HID_API_EXPORT HID_API_CALL hid_read(hid_device *dev, unsigned char *data, size_t length)
-{
- return hid_read_timeout(dev, data, length, (dev->blocking)? -1: 0);
-}
-
-int HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *dev, int nonblock)
-{
- dev->blocking = !nonblock;
- return 0; /* Success */
-}
-
-int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *dev, const unsigned char *data, size_t length)
-{
- BOOL res = HidD_SetFeature(dev->device_handle, (PVOID)data, length);
- if (!res) {
- register_error(dev, "HidD_SetFeature");
- return -1;
- }
-
- return length;
-}
-
-
-int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *dev, unsigned char *data, size_t length)
-{
- BOOL res;
-#if 0
- res = HidD_GetFeature(dev->device_handle, data, length);
- if (!res) {
- register_error(dev, "HidD_GetFeature");
- return -1;
- }
- return 0; /* HidD_GetFeature() doesn't give us an actual length, unfortunately */
-#else
- DWORD bytes_returned;
-
- OVERLAPPED ol;
- memset(&ol, 0, sizeof(ol));
-
- res = DeviceIoControl(dev->device_handle,
- IOCTL_HID_GET_FEATURE,
- data, length,
- data, length,
- &bytes_returned, &ol);
-
- if (!res) {
- if (GetLastError() != ERROR_IO_PENDING) {
- /* DeviceIoControl() failed. Return error. */
- register_error(dev, "Send Feature Report DeviceIoControl");
- return -1;
- }
- }
-
- /* Wait here until the write is done. This makes
- hid_get_feature_report() synchronous. */
- res = GetOverlappedResult(dev->device_handle, &ol, &bytes_returned, TRUE/*wait*/);
- if (!res) {
- /* The operation failed. */
- register_error(dev, "Send Feature Report GetOverLappedResult");
- return -1;
- }
-
- /* bytes_returned does not include the first byte which contains the
- report ID. The data buffer actually contains one more byte than
- bytes_returned. */
- bytes_returned++;
-
- return bytes_returned;
-#endif
-}
-
-void HID_API_EXPORT HID_API_CALL hid_close(hid_device *dev)
-{
- if (!dev)
- return;
- CancelIo(dev->device_handle);
- free_hid_device(dev);
-}
-
-int HID_API_EXPORT_CALL HID_API_CALL hid_get_manufacturer_string(hid_device *dev, wchar_t *string, size_t maxlen)
-{
- BOOL res;
-
- res = HidD_GetManufacturerString(dev->device_handle, string, sizeof(wchar_t) * maxlen);
- if (!res) {
- register_error(dev, "HidD_GetManufacturerString");
- return -1;
- }
-
- return 0;
-}
-
-int HID_API_EXPORT_CALL HID_API_CALL hid_get_product_string(hid_device *dev, wchar_t *string, size_t maxlen)
-{
- BOOL res;
-
- res = HidD_GetProductString(dev->device_handle, string, sizeof(wchar_t) * maxlen);
- if (!res) {
- register_error(dev, "HidD_GetProductString");
- return -1;
- }
-
- return 0;
-}
-
-int HID_API_EXPORT_CALL HID_API_CALL hid_get_serial_number_string(hid_device *dev, wchar_t *string, size_t maxlen)
-{
- BOOL res;
-
- res = HidD_GetSerialNumberString(dev->device_handle, string, sizeof(wchar_t) * maxlen);
- if (!res) {
- register_error(dev, "HidD_GetSerialNumberString");
- return -1;
- }
-
- return 0;
-}
-
-int HID_API_EXPORT_CALL HID_API_CALL hid_get_indexed_string(hid_device *dev, int string_index, wchar_t *string, size_t maxlen)
-{
- BOOL res;
-
- res = HidD_GetIndexedString(dev->device_handle, string_index, string, sizeof(wchar_t) * maxlen);
- if (!res) {
- register_error(dev, "HidD_GetIndexedString");
- return -1;
- }
-
- return 0;
-}
-
-
-HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev)
-{
- return (wchar_t*)dev->last_error_str;
-}
-
-
-/*#define PICPGM*/
-/*#define S11*/
-#define P32
-#ifdef S11
- unsigned short VendorID = 0xa0a0;
- unsigned short ProductID = 0x0001;
-#endif
-
-#ifdef P32
- unsigned short VendorID = 0x04d8;
- unsigned short ProductID = 0x3f;
-#endif
-
-
-#ifdef PICPGM
- unsigned short VendorID = 0x04d8;
- unsigned short ProductID = 0x0033;
-#endif
-
-
-#if 0
-int __cdecl main(int argc, char* argv[])
-{
- int res;
- unsigned char buf[65];
-
- UNREFERENCED_PARAMETER(argc);
- UNREFERENCED_PARAMETER(argv);
-
- /* Set up the command buffer. */
- memset(buf,0x00,sizeof(buf));
- buf[0] = 0;
- buf[1] = 0x81;
-
-
- /* Open the device. */
- int handle = open(VendorID, ProductID, L"12345");
- if (handle < 0)
- printf("unable to open device\n");
-
-
- /* Toggle LED (cmd 0x80) */
- buf[1] = 0x80;
- res = write(handle, buf, 65);
- if (res < 0)
- printf("Unable to write()\n");
-
- /* Request state (cmd 0x81) */
- buf[1] = 0x81;
- write(handle, buf, 65);
- if (res < 0)
- printf("Unable to write() (2)\n");
-
- /* Read requested state */
- read(handle, buf, 65);
- if (res < 0)
- printf("Unable to read()\n");
-
- /* Print out the returned buffer. */
- for (int i = 0; i < 4; i++)
- printf("buf[%d]: %d\n", i, buf[i]);
-
- return 0;
-}
-#endif
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
diff --git a/src/include64/hidapi.h b/src/include64/hidapi.h
deleted file mode 100644
index e5bc2dc4..00000000
--- a/src/include64/hidapi.h
+++ /dev/null
@@ -1,391 +0,0 @@
-/*******************************************************
- HIDAPI - Multi-Platform library for
- communication with HID devices.
-
- Alan Ott
- Signal 11 Software
-
- 8/22/2009
-
- Copyright 2009, All Rights Reserved.
-
- At the discretion of the user of this library,
- this software may be licensed under the terms of the
- GNU General Public License v3, a BSD-Style license, or the
- original HIDAPI license as outlined in the LICENSE.txt,
- LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt
- files located at the root of the source distribution.
- These files may also be found in the public source
- code repository located at:
- http://github.com/signal11/hidapi .
-********************************************************/
-
-/** @file
- * @defgroup API hidapi API
- */
-
-#ifndef HIDAPI_H__
-#define HIDAPI_H__
-
-#include
-
-#ifdef _WIN32
- #define HID_API_EXPORT __declspec(dllexport)
- #define HID_API_CALL
-#else
- #define HID_API_EXPORT /**< API export macro */
- #define HID_API_CALL /**< API call macro */
-#endif
-
-#define HID_API_EXPORT_CALL HID_API_EXPORT HID_API_CALL /**< API export and call macro*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
- struct hid_device_;
- typedef struct hid_device_ hid_device; /**< opaque hidapi structure */
-
- /** hidapi info structure */
- struct hid_device_info {
- /** Platform-specific device path */
- char *path;
- /** Device Vendor ID */
- unsigned short vendor_id;
- /** Device Product ID */
- unsigned short product_id;
- /** Serial Number */
- wchar_t *serial_number;
- /** Device Release Number in binary-coded decimal,
- also known as Device Version Number */
- unsigned short release_number;
- /** Manufacturer String */
- wchar_t *manufacturer_string;
- /** Product string */
- wchar_t *product_string;
- /** Usage Page for this Device/Interface
- (Windows/Mac only). */
- unsigned short usage_page;
- /** Usage for this Device/Interface
- (Windows/Mac only).*/
- unsigned short usage;
- /** The USB interface which this logical device
- represents. Valid on both Linux implementations
- in all cases, and valid on the Windows implementation
- only if the device contains more than one interface. */
- int interface_number;
-
- /** Pointer to the next device */
- struct hid_device_info *next;
- };
-
-
- /** @brief Initialize the HIDAPI library.
-
- This function initializes the HIDAPI library. Calling it is not
- strictly necessary, as it will be called automatically by
- hid_enumerate() and any of the hid_open_*() functions if it is
- needed. This function should be called at the beginning of
- execution however, if there is a chance of HIDAPI handles
- being opened by different threads simultaneously.
-
- @ingroup API
-
- @returns
- This function returns 0 on success and -1 on error.
- */
- int HID_API_EXPORT HID_API_CALL hid_init(void);
-
- /** @brief Finalize the HIDAPI library.
-
- This function frees all of the static data associated with
- HIDAPI. It should be called at the end of execution to avoid
- memory leaks.
-
- @ingroup API
-
- @returns
- This function returns 0 on success and -1 on error.
- */
- int HID_API_EXPORT HID_API_CALL hid_exit(void);
-
- /** @brief Enumerate the HID Devices.
-
- This function returns a linked list of all the HID devices
- attached to the system which match vendor_id and product_id.
- If @p vendor_id is set to 0 then any vendor matches.
- If @p product_id is set to 0 then any product matches.
- If @p vendor_id and @p product_id are both set to 0, then
- all HID devices will be returned.
-
- @ingroup API
- @param vendor_id The Vendor ID (VID) of the types of device
- to open.
- @param product_id The Product ID (PID) of the types of
- device to open.
-
- @returns
- This function returns a pointer to a linked list of type
- struct #hid_device, containing information about the HID devices
- attached to the system, or NULL in the case of failure. Free
- this linked list by calling hid_free_enumeration().
- */
- struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id);
-
- /** @brief Free an enumeration Linked List
-
- This function frees a linked list created by hid_enumerate().
-
- @ingroup API
- @param devs Pointer to a list of struct_device returned from
- hid_enumerate().
- */
- void HID_API_EXPORT HID_API_CALL hid_free_enumeration(struct hid_device_info *devs);
-
- /** @brief Open a HID device using a Vendor ID (VID), Product ID
- (PID) and optionally a serial number.
-
- If @p serial_number is NULL, the first device with the
- specified VID and PID is opened.
-
- @ingroup API
- @param vendor_id The Vendor ID (VID) of the device to open.
- @param product_id The Product ID (PID) of the device to open.
- @param serial_number The Serial Number of the device to open
- (Optionally NULL).
-
- @returns
- This function returns a pointer to a #hid_device object on
- success or NULL on failure.
- */
- HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number);
-
- /** @brief Open a HID device by its path name.
-
- The path name be determined by calling hid_enumerate(), or a
- platform-specific path name can be used (eg: /dev/hidraw0 on
- Linux).
-
- @ingroup API
- @param path The path name of the device to open
-
- @returns
- This function returns a pointer to a #hid_device object on
- success or NULL on failure.
- */
- HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path);
-
- /** @brief Write an Output report to a HID device.
-
- The first byte of @p data[] must contain the Report ID. For
- devices which only support a single report, this must be set
- to 0x0. The remaining bytes contain the report data. Since
- the Report ID is mandatory, calls to hid_write() will always
- contain one more byte than the report contains. For example,
- if a hid report is 16 bytes long, 17 bytes must be passed to
- hid_write(), the Report ID (or 0x0, for devices with a
- single report), followed by the report data (16 bytes). In
- this example, the length passed in would be 17.
-
- hid_write() will send the data on the first OUT endpoint, if
- one exists. If it does not, it will send the data through
- the Control Endpoint (Endpoint 0).
-
- @ingroup API
- @param device A device handle returned from hid_open().
- @param data The data to send, including the report number as
- the first byte.
- @param length The length in bytes of the data to send.
-
- @returns
- This function returns the actual number of bytes written and
- -1 on error.
- */
- int HID_API_EXPORT HID_API_CALL hid_write(hid_device *device, const unsigned char *data, size_t length);
-
- /** @brief Read an Input report from a HID device with timeout.
-
- Input reports are returned
- to the host through the INTERRUPT IN endpoint. The first byte will
- contain the Report number if the device uses numbered reports.
-
- @ingroup API
- @param device A device handle returned from hid_open().
- @param data A buffer to put the read data into.
- @param length The number of bytes to read. For devices with
- multiple reports, make sure to read an extra byte for
- the report number.
- @param milliseconds timeout in milliseconds or -1 for blocking wait.
-
- @returns
- This function returns the actual number of bytes read and
- -1 on error. If no packet was available to be read within
- the timeout period, this function returns 0.
- */
- int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds);
-
- /** @brief Read an Input report from a HID device.
-
- Input reports are returned
- to the host through the INTERRUPT IN endpoint. The first byte will
- contain the Report number if the device uses numbered reports.
-
- @ingroup API
- @param device A device handle returned from hid_open().
- @param data A buffer to put the read data into.
- @param length The number of bytes to read. For devices with
- multiple reports, make sure to read an extra byte for
- the report number.
-
- @returns
- This function returns the actual number of bytes read and
- -1 on error. If no packet was available to be read and
- the handle is in non-blocking mode, this function returns 0.
- */
- int HID_API_EXPORT HID_API_CALL hid_read(hid_device *device, unsigned char *data, size_t length);
-
- /** @brief Set the device handle to be non-blocking.
-
- In non-blocking mode calls to hid_read() will return
- immediately with a value of 0 if there is no data to be
- read. In blocking mode, hid_read() will wait (block) until
- there is data to read before returning.
-
- Nonblocking can be turned on and off at any time.
-
- @ingroup API
- @param device A device handle returned from hid_open().
- @param nonblock enable or not the nonblocking reads
- - 1 to enable nonblocking
- - 0 to disable nonblocking.
-
- @returns
- This function returns 0 on success and -1 on error.
- */
- int HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *device, int nonblock);
-
- /** @brief Send a Feature report to the device.
-
- Feature reports are sent over the Control endpoint as a
- Set_Report transfer. The first byte of @p data[] must
- contain the Report ID. For devices which only support a
- single report, this must be set to 0x0. The remaining bytes
- contain the report data. Since the Report ID is mandatory,
- calls to hid_send_feature_report() will always contain one
- more byte than the report contains. For example, if a hid
- report is 16 bytes long, 17 bytes must be passed to
- hid_send_feature_report(): the Report ID (or 0x0, for
- devices which do not use numbered reports), followed by the
- report data (16 bytes). In this example, the length passed
- in would be 17.
-
- @ingroup API
- @param device A device handle returned from hid_open().
- @param data The data to send, including the report number as
- the first byte.
- @param length The length in bytes of the data to send, including
- the report number.
-
- @returns
- This function returns the actual number of bytes written and
- -1 on error.
- */
- int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *device, const unsigned char *data, size_t length);
-
- /** @brief Get a feature report from a HID device.
-
- Set the first byte of @p data[] to the Report ID of the
- report to be read. Make sure to allow space for this
- extra byte in @p data[]. Upon return, the first byte will
- still contain the Report ID, and the report data will
- start in data[1].
-
- @ingroup API
- @param device A device handle returned from hid_open().
- @param data A buffer to put the read data into, including
- the Report ID. Set the first byte of @p data[] to the
- Report ID of the report to be read, or set it to zero
- if your device does not use numbered reports.
- @param length The number of bytes to read, including an
- extra byte for the report ID. The buffer can be longer
- than the actual report.
-
- @returns
- This function returns the number of bytes read plus
- one for the report ID (which is still in the first
- byte), or -1 on error.
- */
- int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *device, unsigned char *data, size_t length);
-
- /** @brief Close a HID device.
-
- @ingroup API
- @param device A device handle returned from hid_open().
- */
- void HID_API_EXPORT HID_API_CALL hid_close(hid_device *device);
-
- /** @brief Get The Manufacturer String from a HID device.
-
- @ingroup API
- @param device A device handle returned from hid_open().
- @param string A wide string buffer to put the data into.
- @param maxlen The length of the buffer in multiples of wchar_t.
-
- @returns
- This function returns 0 on success and -1 on error.
- */
- int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *device, wchar_t *string, size_t maxlen);
-
- /** @brief Get The Product String from a HID device.
-
- @ingroup API
- @param device A device handle returned from hid_open().
- @param string A wide string buffer to put the data into.
- @param maxlen The length of the buffer in multiples of wchar_t.
-
- @returns
- This function returns 0 on success and -1 on error.
- */
- int HID_API_EXPORT_CALL hid_get_product_string(hid_device *device, wchar_t *string, size_t maxlen);
-
- /** @brief Get The Serial Number String from a HID device.
-
- @ingroup API
- @param device A device handle returned from hid_open().
- @param string A wide string buffer to put the data into.
- @param maxlen The length of the buffer in multiples of wchar_t.
-
- @returns
- This function returns 0 on success and -1 on error.
- */
- int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *device, wchar_t *string, size_t maxlen);
-
- /** @brief Get a string from a HID device, based on its string index.
-
- @ingroup API
- @param device A device handle returned from hid_open().
- @param string_index The index of the string to get.
- @param string A wide string buffer to put the data into.
- @param maxlen The length of the buffer in multiples of wchar_t.
-
- @returns
- This function returns 0 on success and -1 on error.
- */
- int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *device, int string_index, wchar_t *string, size_t maxlen);
-
- /** @brief Get a string describing the last error which occurred.
-
- @ingroup API
- @param device A device handle returned from hid_open().
-
- @returns
- This function returns a string containing the last error
- which occurred or NULL if none has occurred.
- */
- HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *device);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/src/include64/lauxlib.h b/src/include64/lauxlib.h
deleted file mode 100644
index fed1491b..00000000
--- a/src/include64/lauxlib.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
-** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $
-** Auxiliary functions for building Lua libraries
-** See Copyright Notice in lua.h
-*/
-
-
-#ifndef lauxlib_h
-#define lauxlib_h
-
-
-#include
-#include
-
-#include "lua.h"
-
-
-#define luaL_getn(L,i) ((int)lua_objlen(L, i))
-#define luaL_setn(L,i,j) ((void)0) /* no op! */
-
-/* extra error code for `luaL_load' */
-#define LUA_ERRFILE (LUA_ERRERR+1)
-
-typedef struct luaL_Reg {
- const char *name;
- lua_CFunction func;
-} luaL_Reg;
-
-LUALIB_API void (luaL_openlib) (lua_State *L, const char *libname,
- const luaL_Reg *l, int nup);
-LUALIB_API void (luaL_register) (lua_State *L, const char *libname,
- const luaL_Reg *l);
-LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e);
-LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e);
-LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname);
-LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg);
-LUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg,
- size_t *l);
-LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg,
- const char *def, size_t *l);
-LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg);
-LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def);
-
-LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg);
-LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg,
- lua_Integer def);
-
-LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);
-LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t);
-LUALIB_API void (luaL_checkany) (lua_State *L, int narg);
-
-LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname);
-LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname);
-
-LUALIB_API void (luaL_where) (lua_State *L, int lvl);
-LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);
-
-LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,
- const char *const lst[]);
-
-LUALIB_API int (luaL_ref) (lua_State *L, int t);
-LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);
-
-LUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename);
-LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz,
- const char *name);
-LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s);
-
-LUALIB_API lua_State *(luaL_newstate) (void);
-
-
-LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p,
- const char *r);
-
-LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx,
- const char *fname, int szhint);
-
-/* From Lua 5.2. */
-LUALIB_API int luaL_fileresult(lua_State *L, int stat, const char *fname);
-LUALIB_API int luaL_execresult(lua_State *L, int stat);
-LUALIB_API int (luaL_loadfilex) (lua_State *L, const char *filename,
- const char *mode);
-LUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz,
- const char *name, const char *mode);
-LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1, const char *msg,
- int level);
-
-
-/*
-** ===============================================================
-** some useful macros
-** ===============================================================
-*/
-
-#define luaL_argcheck(L, cond,numarg,extramsg) \
- ((void)((cond) || luaL_argerror(L, (numarg), (extramsg))))
-#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL))
-#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL))
-#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n)))
-#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d)))
-#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n)))
-#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d)))
-
-#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i)))
-
-#define luaL_dofile(L, fn) \
- (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))
-
-#define luaL_dostring(L, s) \
- (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
-
-#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n)))
-
-#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
-
-/*
-** {======================================================
-** Generic Buffer manipulation
-** =======================================================
-*/
-
-
-
-typedef struct luaL_Buffer {
- char *p; /* current position in buffer */
- int lvl; /* number of strings in the stack (level) */
- lua_State *L;
- char buffer[LUAL_BUFFERSIZE];
-} luaL_Buffer;
-
-#define luaL_addchar(B,c) \
- ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \
- (*(B)->p++ = (char)(c)))
-
-/* compatibility only */
-#define luaL_putchar(B,c) luaL_addchar(B,c)
-
-#define luaL_addsize(B,n) ((B)->p += (n))
-
-LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B);
-LUALIB_API char *(luaL_prepbuffer) (luaL_Buffer *B);
-LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);
-LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s);
-LUALIB_API void (luaL_addvalue) (luaL_Buffer *B);
-LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);
-
-
-/* }====================================================== */
-
-
-/* compatibility with ref system */
-
-/* pre-defined references */
-#define LUA_NOREF (-2)
-#define LUA_REFNIL (-1)
-
-#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \
- (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0))
-
-#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref))
-
-#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref))
-
-
-#define luaL_reg luaL_Reg
-
-#endif
diff --git a/src/include64/libopengl32.a b/src/include64/libopengl32.a
deleted file mode 100644
index da36fd93..00000000
Binary files a/src/include64/libopengl32.a and /dev/null differ
diff --git a/src/include64/lua.h b/src/include64/lua.h
deleted file mode 100644
index c83fd3bb..00000000
--- a/src/include64/lua.h
+++ /dev/null
@@ -1,393 +0,0 @@
-/*
-** $Id: lua.h,v 1.218.1.5 2008/08/06 13:30:12 roberto Exp $
-** Lua - An Extensible Extension Language
-** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
-** See Copyright Notice at the end of this file
-*/
-
-
-#ifndef lua_h
-#define lua_h
-
-#include
-#include
-
-
-#include "luaconf.h"
-
-
-#define LUA_VERSION "Lua 5.1"
-#define LUA_RELEASE "Lua 5.1.4"
-#define LUA_VERSION_NUM 501
-#define LUA_COPYRIGHT "Copyright (C) 1994-2008 Lua.org, PUC-Rio"
-#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
-
-
-/* mark for precompiled code (`Lua') */
-#define LUA_SIGNATURE "\033Lua"
-
-/* option for multiple returns in `lua_pcall' and `lua_call' */
-#define LUA_MULTRET (-1)
-
-
-/*
-** pseudo-indices
-*/
-#define LUA_REGISTRYINDEX (-10000)
-#define LUA_ENVIRONINDEX (-10001)
-#define LUA_GLOBALSINDEX (-10002)
-#define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i))
-
-
-/* thread status; 0 is OK */
-#define LUA_YIELD 1
-#define LUA_ERRRUN 2
-#define LUA_ERRSYNTAX 3
-#define LUA_ERRMEM 4
-#define LUA_ERRERR 5
-
-
-typedef struct lua_State lua_State;
-
-typedef int (*lua_CFunction) (lua_State *L);
-
-
-/*
-** functions that read/write blocks when loading/dumping Lua chunks
-*/
-typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz);
-
-typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud);
-
-
-/*
-** prototype for memory-allocation functions
-*/
-typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);
-
-
-/*
-** basic types
-*/
-#define LUA_TNONE (-1)
-
-#define LUA_TNIL 0
-#define LUA_TBOOLEAN 1
-#define LUA_TLIGHTUSERDATA 2
-#define LUA_TNUMBER 3
-#define LUA_TSTRING 4
-#define LUA_TTABLE 5
-#define LUA_TFUNCTION 6
-#define LUA_TUSERDATA 7
-#define LUA_TTHREAD 8
-
-
-
-/* minimum Lua stack available to a C function */
-#define LUA_MINSTACK 20
-
-
-/*
-** generic extra include file
-*/
-#if defined(LUA_USER_H)
-#include LUA_USER_H
-#endif
-
-
-/* type of numbers in Lua */
-typedef LUA_NUMBER lua_Number;
-
-
-/* type for integer functions */
-typedef LUA_INTEGER lua_Integer;
-
-
-
-/*
-** state manipulation
-*/
-LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud);
-LUA_API void (lua_close) (lua_State *L);
-LUA_API lua_State *(lua_newthread) (lua_State *L);
-
-LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf);
-
-
-/*
-** basic stack manipulation
-*/
-LUA_API int (lua_gettop) (lua_State *L);
-LUA_API void (lua_settop) (lua_State *L, int idx);
-LUA_API void (lua_pushvalue) (lua_State *L, int idx);
-LUA_API void (lua_remove) (lua_State *L, int idx);
-LUA_API void (lua_insert) (lua_State *L, int idx);
-LUA_API void (lua_replace) (lua_State *L, int idx);
-LUA_API int (lua_checkstack) (lua_State *L, int sz);
-
-LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n);
-
-
-/*
-** access functions (stack -> C)
-*/
-
-LUA_API int (lua_isnumber) (lua_State *L, int idx);
-LUA_API int (lua_isstring) (lua_State *L, int idx);
-LUA_API int (lua_iscfunction) (lua_State *L, int idx);
-LUA_API int (lua_isuserdata) (lua_State *L, int idx);
-LUA_API int (lua_type) (lua_State *L, int idx);
-LUA_API const char *(lua_typename) (lua_State *L, int tp);
-
-LUA_API int (lua_equal) (lua_State *L, int idx1, int idx2);
-LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2);
-LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2);
-
-LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx);
-LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx);
-LUA_API int (lua_toboolean) (lua_State *L, int idx);
-LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len);
-LUA_API size_t (lua_objlen) (lua_State *L, int idx);
-LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx);
-LUA_API void *(lua_touserdata) (lua_State *L, int idx);
-LUA_API lua_State *(lua_tothread) (lua_State *L, int idx);
-LUA_API const void *(lua_topointer) (lua_State *L, int idx);
-
-
-/*
-** push functions (C -> stack)
-*/
-LUA_API void (lua_pushnil) (lua_State *L);
-LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n);
-LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n);
-LUA_API void (lua_pushlstring) (lua_State *L, const char *s, size_t l);
-LUA_API void (lua_pushstring) (lua_State *L, const char *s);
-LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt,
- va_list argp);
-LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...);
-LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);
-LUA_API void (lua_pushboolean) (lua_State *L, int b);
-LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p);
-LUA_API int (lua_pushthread) (lua_State *L);
-
-
-/*
-** get functions (Lua -> stack)
-*/
-LUA_API void (lua_gettable) (lua_State *L, int idx);
-LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k);
-LUA_API void (lua_rawget) (lua_State *L, int idx);
-LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n);
-LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec);
-LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);
-LUA_API int (lua_getmetatable) (lua_State *L, int objindex);
-LUA_API void (lua_getfenv) (lua_State *L, int idx);
-
-
-/*
-** set functions (stack -> Lua)
-*/
-LUA_API void (lua_settable) (lua_State *L, int idx);
-LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k);
-LUA_API void (lua_rawset) (lua_State *L, int idx);
-LUA_API void (lua_rawseti) (lua_State *L, int idx, int n);
-LUA_API int (lua_setmetatable) (lua_State *L, int objindex);
-LUA_API int (lua_setfenv) (lua_State *L, int idx);
-
-
-/*
-** `load' and `call' functions (load and run Lua code)
-*/
-LUA_API void (lua_call) (lua_State *L, int nargs, int nresults);
-LUA_API int (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc);
-LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud);
-LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt,
- const char *chunkname);
-
-LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data);
-
-
-/*
-** coroutine functions
-*/
-LUA_API int (lua_yield) (lua_State *L, int nresults);
-LUA_API int (lua_resume) (lua_State *L, int narg);
-LUA_API int (lua_status) (lua_State *L);
-
-/*
-** garbage-collection function and options
-*/
-
-#define LUA_GCSTOP 0
-#define LUA_GCRESTART 1
-#define LUA_GCCOLLECT 2
-#define LUA_GCCOUNT 3
-#define LUA_GCCOUNTB 4
-#define LUA_GCSTEP 5
-#define LUA_GCSETPAUSE 6
-#define LUA_GCSETSTEPMUL 7
-
-LUA_API int (lua_gc) (lua_State *L, int what, int data);
-
-
-/*
-** miscellaneous functions
-*/
-
-LUA_API int (lua_error) (lua_State *L);
-
-LUA_API int (lua_next) (lua_State *L, int idx);
-
-LUA_API void (lua_concat) (lua_State *L, int n);
-
-LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);
-LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);
-
-
-
-/*
-** ===============================================================
-** some useful macros
-** ===============================================================
-*/
-
-#define lua_pop(L,n) lua_settop(L, -(n)-1)
-
-#define lua_newtable(L) lua_createtable(L, 0, 0)
-
-#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n)))
-
-#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0)
-
-#define lua_strlen(L,i) lua_objlen(L, (i))
-
-#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION)
-#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE)
-#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA)
-#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL)
-#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN)
-#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD)
-#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE)
-#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0)
-
-#define lua_pushliteral(L, s) \
- lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1)
-
-#define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, (s))
-#define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, (s))
-
-#define lua_tostring(L,i) lua_tolstring(L, (i), NULL)
-
-
-
-/*
-** compatibility macros and functions
-*/
-
-#define lua_open() luaL_newstate()
-
-#define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX)
-
-#define lua_getgccount(L) lua_gc(L, LUA_GCCOUNT, 0)
-
-#define lua_Chunkreader lua_Reader
-#define lua_Chunkwriter lua_Writer
-
-
-/* hack */
-LUA_API void lua_setlevel (lua_State *from, lua_State *to);
-
-
-/*
-** {======================================================================
-** Debug API
-** =======================================================================
-*/
-
-
-/*
-** Event codes
-*/
-#define LUA_HOOKCALL 0
-#define LUA_HOOKRET 1
-#define LUA_HOOKLINE 2
-#define LUA_HOOKCOUNT 3
-#define LUA_HOOKTAILRET 4
-
-
-/*
-** Event masks
-*/
-#define LUA_MASKCALL (1 << LUA_HOOKCALL)
-#define LUA_MASKRET (1 << LUA_HOOKRET)
-#define LUA_MASKLINE (1 << LUA_HOOKLINE)
-#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT)
-
-typedef struct lua_Debug lua_Debug; /* activation record */
-
-
-/* Functions to be called by the debuger in specific events */
-typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
-
-
-LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar);
-LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);
-LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);
-LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);
-LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n);
-LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n);
-LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count);
-LUA_API lua_Hook lua_gethook (lua_State *L);
-LUA_API int lua_gethookmask (lua_State *L);
-LUA_API int lua_gethookcount (lua_State *L);
-
-/* From Lua 5.2. */
-LUA_API void *lua_upvalueid (lua_State *L, int idx, int n);
-LUA_API void lua_upvaluejoin (lua_State *L, int idx1, int n1, int idx2, int n2);
-LUA_API int lua_loadx (lua_State *L, lua_Reader reader, void *dt,
- const char *chunkname, const char *mode);
-
-
-struct lua_Debug {
- int event;
- const char *name; /* (n) */
- const char *namewhat; /* (n) `global', `local', `field', `method' */
- const char *what; /* (S) `Lua', `C', `main', `tail' */
- const char *source; /* (S) */
- int currentline; /* (l) */
- int nups; /* (u) number of upvalues */
- int linedefined; /* (S) */
- int lastlinedefined; /* (S) */
- char short_src[LUA_IDSIZE]; /* (S) */
- /* private part */
- int i_ci; /* active function */
-};
-
-/* }====================================================================== */
-
-
-/******************************************************************************
-* Copyright (C) 1994-2008 Lua.org, PUC-Rio. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-******************************************************************************/
-
-
-#endif
diff --git a/src/include64/lua.hpp b/src/include64/lua.hpp
deleted file mode 100644
index 07e9002d..00000000
--- a/src/include64/lua.hpp
+++ /dev/null
@@ -1,9 +0,0 @@
-// C++ wrapper for LuaJIT header files.
-
-extern "C" {
-#include "lua.h"
-#include "lauxlib.h"
-#include "lualib.h"
-#include "luajit.h"
-}
-
diff --git a/src/include64/luaconf.h b/src/include64/luaconf.h
deleted file mode 100644
index 8e3a7aaa..00000000
--- a/src/include64/luaconf.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
-** Configuration header.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
-*/
-
-#ifndef luaconf_h
-#define luaconf_h
-
-#include
-#include
-
-/* Default path for loading Lua and C modules with require(). */
-#if defined(_WIN32)
-/*
-** In Windows, any exclamation mark ('!') in the path is replaced by the
-** path of the directory of the executable file of the current process.
-*/
-#define LUA_LDIR "!\\lua\\"
-#define LUA_CDIR "!\\"
-#define LUA_PATH_DEFAULT \
- ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;"
-#define LUA_CPATH_DEFAULT \
- ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
-#else
-/*
-** Note to distribution maintainers: do NOT patch the following line!
-** Please read ../doc/install.html#distro and pass PREFIX=/usr instead.
-*/
-#define LUA_ROOT "/usr/local/"
-#define LUA_LDIR LUA_ROOT "share/lua/5.1/"
-#define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
-#ifdef LUA_XROOT
-#define LUA_JDIR LUA_XROOT "share/luajit-2.0.1/"
-#define LUA_XPATH \
- ";" LUA_XROOT "share/lua/5.1/?.lua;" LUA_XROOT "share/lua/5.1/?/init.lua"
-#define LUA_XCPATH LUA_XROOT "lib/lua/5.1/?.so;"
-#else
-#define LUA_JDIR LUA_ROOT "share/luajit-2.0.1/"
-#define LUA_XPATH
-#define LUA_XCPATH
-#endif
-#define LUA_PATH_DEFAULT \
- "./?.lua;" LUA_JDIR"?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua" LUA_XPATH
-#define LUA_CPATH_DEFAULT \
- "./?.so;" LUA_CDIR"?.so;" LUA_XCPATH LUA_CDIR"loadall.so"
-#endif
-
-/* Environment variable names for path overrides and initialization code. */
-#define LUA_PATH "LUA_PATH"
-#define LUA_CPATH "LUA_CPATH"
-#define LUA_INIT "LUA_INIT"
-
-/* Special file system characters. */
-#if defined(_WIN32)
-#define LUA_DIRSEP "\\"
-#else
-#define LUA_DIRSEP "/"
-#endif
-#define LUA_PATHSEP ";"
-#define LUA_PATH_MARK "?"
-#define LUA_EXECDIR "!"
-#define LUA_IGMARK "-"
-#define LUA_PATH_CONFIG \
- LUA_DIRSEP "\n" LUA_PATHSEP "\n" LUA_PATH_MARK "\n" \
- LUA_EXECDIR "\n" LUA_IGMARK
-
-/* Quoting in error messages. */
-#define LUA_QL(x) "'" x "'"
-#define LUA_QS LUA_QL("%s")
-
-/* Various tunables. */
-#define LUAI_MAXSTACK 65500 /* Max. # of stack slots for a thread (<64K). */
-#define LUAI_MAXCSTACK 8000 /* Max. # of stack slots for a C func (<10K). */
-#define LUAI_GCPAUSE 200 /* Pause GC until memory is at 200%. */
-#define LUAI_GCMUL 200 /* Run GC at 200% of allocation speed. */
-#define LUA_MAXCAPTURES 32 /* Max. pattern captures. */
-
-/* Compatibility with older library function names. */
-#define LUA_COMPAT_MOD /* OLD: math.mod, NEW: math.fmod */
-#define LUA_COMPAT_GFIND /* OLD: string.gfind, NEW: string.gmatch */
-
-/* Configuration for the frontend (the luajit executable). */
-#if defined(luajit_c)
-#define LUA_PROGNAME "luajit" /* Fallback frontend name. */
-#define LUA_PROMPT "> " /* Interactive prompt. */
-#define LUA_PROMPT2 ">> " /* Continuation prompt. */
-#define LUA_MAXINPUT 512 /* Max. input line length. */
-#endif
-
-/* Note: changing the following defines breaks the Lua 5.1 ABI. */
-#define LUA_INTEGER ptrdiff_t
-#define LUA_IDSIZE 60 /* Size of lua_Debug.short_src. */
-/*
-** Size of lauxlib and io.* on-stack buffers. Weird workaround to avoid using
-** unreasonable amounts of stack space, but still retain ABI compatibility.
-** Blame Lua for depending on BUFSIZ in the ABI, blame **** for wrecking it.
-*/
-#define LUAL_BUFFERSIZE (BUFSIZ > 16384 ? 8192 : BUFSIZ)
-
-/* The following defines are here only for compatibility with luaconf.h
-** from the standard Lua distribution. They must not be changed for LuaJIT.
-*/
-#define LUA_NUMBER_DOUBLE
-#define LUA_NUMBER double
-#define LUAI_UACNUMBER double
-#define LUA_NUMBER_SCAN "%lf"
-#define LUA_NUMBER_FMT "%.14g"
-#define lua_number2str(s, n) sprintf((s), LUA_NUMBER_FMT, (n))
-#define LUAI_MAXNUMBER2STR 32
-#define LUA_INTFRMLEN "l"
-#define LUA_INTFRM_T long
-
-/* Linkage of public API functions. */
-#if defined(LUA_BUILD_AS_DLL)
-#if defined(LUA_CORE) || defined(LUA_LIB)
-#define LUA_API __declspec(dllexport)
-#else
-#define LUA_API __declspec(dllimport)
-#endif
-#else
-#define LUA_API extern
-#endif
-
-#define LUALIB_API LUA_API
-
-/* Support for internal assertions. */
-#if defined(LUA_USE_ASSERT) || defined(LUA_USE_APICHECK)
-#include
-#endif
-#ifdef LUA_USE_ASSERT
-#define lua_assert(x) assert(x)
-#endif
-#ifdef LUA_USE_APICHECK
-#define luai_apicheck(L, o) { (void)L; assert(o); }
-#else
-#define luai_apicheck(L, o) { (void)L; }
-#endif
-
-#endif
diff --git a/src/include64/luajit.h b/src/include64/luajit.h
deleted file mode 100644
index ed39d014..00000000
--- a/src/include64/luajit.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-** LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/
-**
-** Copyright (C) 2005-2013 Mike Pall. All rights reserved.
-**
-** Permission is hereby granted, free of charge, to any person obtaining
-** a copy of this software and associated documentation files (the
-** "Software"), to deal in the Software without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Software, and to
-** permit persons to whom the Software is furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be
-** included in all copies or substantial portions of the Software.
-**
-** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-**
-** [ MIT license: http://www.opensource.org/licenses/mit-license.php ]
-*/
-
-#ifndef _LUAJIT_H
-#define _LUAJIT_H
-
-#include "lua.h"
-
-#define LUAJIT_VERSION "LuaJIT 2.0.1"
-#define LUAJIT_VERSION_NUM 20001 /* Version 2.0.1 = 02.00.01. */
-#define LUAJIT_VERSION_SYM luaJIT_version_2_0_1
-#define LUAJIT_COPYRIGHT "Copyright (C) 2005-2013 Mike Pall"
-#define LUAJIT_URL "http://luajit.org/"
-
-/* Modes for luaJIT_setmode. */
-#define LUAJIT_MODE_MASK 0x00ff
-
-enum {
- LUAJIT_MODE_ENGINE, /* Set mode for whole JIT engine. */
- LUAJIT_MODE_DEBUG, /* Set debug mode (idx = level). */
-
- LUAJIT_MODE_FUNC, /* Change mode for a function. */
- LUAJIT_MODE_ALLFUNC, /* Recurse into subroutine protos. */
- LUAJIT_MODE_ALLSUBFUNC, /* Change only the subroutines. */
-
- LUAJIT_MODE_TRACE, /* Flush a compiled trace. */
-
- LUAJIT_MODE_WRAPCFUNC = 0x10, /* Set wrapper mode for C function calls. */
-
- LUAJIT_MODE_MAX
-};
-
-/* Flags or'ed in to the mode. */
-#define LUAJIT_MODE_OFF 0x0000 /* Turn feature off. */
-#define LUAJIT_MODE_ON 0x0100 /* Turn feature on. */
-#define LUAJIT_MODE_FLUSH 0x0200 /* Flush JIT-compiled code. */
-
-/* LuaJIT public C API. */
-
-/* Control the JIT engine. */
-LUA_API int luaJIT_setmode(lua_State *L, int idx, int mode);
-
-/* Enforce (dynamic) linker error for version mismatches. Call from main. */
-LUA_API void LUAJIT_VERSION_SYM(void);
-
-#endif
diff --git a/src/include64/lualib.h b/src/include64/lualib.h
deleted file mode 100644
index 18c6234d..00000000
--- a/src/include64/lualib.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-** Standard library header.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
-*/
-
-#ifndef _LUALIB_H
-#define _LUALIB_H
-
-#include "lua.h"
-
-#define LUA_FILEHANDLE "FILE*"
-
-#define LUA_COLIBNAME "coroutine"
-#define LUA_MATHLIBNAME "math"
-#define LUA_STRLIBNAME "string"
-#define LUA_TABLIBNAME "table"
-#define LUA_IOLIBNAME "io"
-#define LUA_OSLIBNAME "os"
-#define LUA_LOADLIBNAME "package"
-#define LUA_DBLIBNAME "debug"
-#define LUA_BITLIBNAME "bit"
-#define LUA_JITLIBNAME "jit"
-#define LUA_FFILIBNAME "ffi"
-
-LUALIB_API int luaopen_base(lua_State *L);
-LUALIB_API int luaopen_math(lua_State *L);
-LUALIB_API int luaopen_string(lua_State *L);
-LUALIB_API int luaopen_table(lua_State *L);
-LUALIB_API int luaopen_io(lua_State *L);
-LUALIB_API int luaopen_os(lua_State *L);
-LUALIB_API int luaopen_package(lua_State *L);
-LUALIB_API int luaopen_debug(lua_State *L);
-LUALIB_API int luaopen_bit(lua_State *L);
-LUALIB_API int luaopen_jit(lua_State *L);
-LUALIB_API int luaopen_ffi(lua_State *L);
-
-LUALIB_API void luaL_openlibs(lua_State *L);
-
-#ifndef lua_assert
-#define lua_assert(x) ((void)0)
-#endif
-
-#endif
diff --git a/src/linux_libs/GL/libGL.so.1.2.0 b/src/linux_libs/GL/libGL.so.1.2.0
deleted file mode 100644
index 16c42e69..00000000
Binary files a/src/linux_libs/GL/libGL.so.1.2.0 and /dev/null differ
diff --git a/src/linux_libs/OpenAL/libopenal.so.1.16.0 b/src/linux_libs/OpenAL/libopenal.so.1.16.0
deleted file mode 100644
index f2ebb3f3..00000000
Binary files a/src/linux_libs/OpenAL/libopenal.so.1.16.0 and /dev/null differ
diff --git a/src/linux_libs/glut/64/libglut.a b/src/linux_libs/glut/64/libglut.a
deleted file mode 100644
index c6167877..00000000
Binary files a/src/linux_libs/glut/64/libglut.a and /dev/null differ
diff --git a/src/linux_libs/glut/64/libglut.so b/src/linux_libs/glut/64/libglut.so
deleted file mode 100644
index 5be40770..00000000
Binary files a/src/linux_libs/glut/64/libglut.so and /dev/null differ
diff --git a/src/linux_libs/glut/64/libglut.so.3.9.0 b/src/linux_libs/glut/64/libglut.so.3.9.0
deleted file mode 100644
index 5be40770..00000000
Binary files a/src/linux_libs/glut/64/libglut.so.3.9.0 and /dev/null differ
diff --git a/src/linux_libs/udev/libudev.so.1.6.4 b/src/linux_libs/udev/libudev.so.1.6.4
deleted file mode 100644
index 23b683bb..00000000
Binary files a/src/linux_libs/udev/libudev.so.1.6.4 and /dev/null differ
diff --git a/src/third_party/luajit/CMakeLists.txt b/src/third_party/luajit/CMakeLists.txt
index 211a9cb7..13665c19 100644
--- a/src/third_party/luajit/CMakeLists.txt
+++ b/src/third_party/luajit/CMakeLists.txt
@@ -9,27 +9,32 @@ if ("${lua_version}" STREQUAL "")
endif()
set(build_options "")
-if (UNIX AND NOT APPLE)
-elseif (WIN32)
- set(build_options "CC=gcc" "CROSS=${TOOLCHAIN_PREFIX}-" "TARGET_SYS=Windows")
-elseif (APPLE)
- set(build_options "CC=clang" "CROSS=${TOOLCHAIN_PREFIX}-" "TARGET_SYS=Darwin")
-endif ()
+if (NOT CMAKE_SYSTEM_NAME STREQUAL CMAKE_HOST_SYSTEM_NAME)
+ # We are cross-compiling: set appropriate toolchain options for LuaJIT.
+ if (WIN32)
+ set(build_options "CC=gcc" "CROSS=${TOOLCHAIN_PREFIX}-" "TARGET_SYS=Windows")
+ elseif (APPLE)
+ set(build_options "CC=clang" "CROSS=${TOOLCHAIN_PREFIX}-" "TARGET_SYS=Darwin")
+ endif ()
+endif()
set(luajit_prefix ${CMAKE_CURRENT_BINARY_DIR}/luajit-${luajit_version})
+find_package(Patch REQUIRED)
+find_program(Make_EXECUTABLE NAMES make mingw32-make REQUIRED)
+
ExternalProject_Add(project_luajit
URL http://luajit.org/download/LuaJIT-${luajit_version}.tar.gz
PREFIX ${luajit_prefix}
CONFIGURE_COMMAND ""
- PATCH_COMMAND patch -p1 -t -N < ${CMAKE_CURRENT_SOURCE_DIR}/x-plane-luajit.patch
- BUILD_COMMAND make -j4 ${build_options}
+ PATCH_COMMAND ${Patch_EXECUTABLE} -p1 -t -N < ${CMAKE_CURRENT_SOURCE_DIR}/x-plane-luajit.patch
+ BUILD_COMMAND ${CMAKE_COMMAND} -E env MACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} ${Make_EXECUTABLE} -j ${build_options}
BUILD_IN_SOURCE 1
INSTALL_COMMAND ""
BUILD_BYPRODUCTS ${luajit_prefix}/lib/libluajit-5.1.a
)
-ExternalProject_Get_Property(project_luajit install_dir)
+ExternalProject_Get_Property(project_luajit install_dir source_dir)
add_custom_command(
TARGET project_luajit POST_BUILD
@@ -41,3 +46,5 @@ add_library(LuaJIT STATIC IMPORTED GLOBAL)
add_library(luajit::LuaJIT ALIAS LuaJIT)
add_dependencies(LuaJIT project_luajit)
set_property(TARGET LuaJIT PROPERTY IMPORTED_LOCATION "${install_dir}/lib/libluajit-5.1.a")
+target_include_directories(LuaJIT INTERFACE "${source_dir}/src")
+file(MAKE_DIRECTORY "${source_dir}/src") # CMake doesn't like if include dir doesn't exist at configure time.
\ No newline at end of file
diff --git a/src/third_party/luajit/x-plane-luajit.patch b/src/third_party/luajit/x-plane-luajit.patch
index 6fd491b0..cc34328b 100644
--- a/src/third_party/luajit/x-plane-luajit.patch
+++ b/src/third_party/luajit/x-plane-luajit.patch
@@ -82,3 +82,8 @@ diff -Naur a/src/Makefile b/src/Makefile
#
##############################################################################
+@@ -211,3 +211,3 @@
+ TARGET_LD= $(CROSS)$(CC)
+-TARGET_AR= $(CROSS)ar rcus 2>/dev/null
++TARGET_AR= $(CROSS)ar rcus
+ TARGET_STRIP= $(CROSS)strip
\ No newline at end of file
diff --git a/src/third_party/luasocket/CMakeLists.txt b/src/third_party/luasocket/CMakeLists.txt
index 698aa5aa..8ada6f1b 100644
--- a/src/third_party/luasocket/CMakeLists.txt
+++ b/src/third_party/luasocket/CMakeLists.txt
@@ -7,8 +7,7 @@ set(LUASOCKET_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/upstream/src)
add_library(LuaSocket_Mime STATIC
${LUASOCKET_SRC_DIR}/mime.c
${LUASOCKET_SRC_DIR}/compat.c)
-
-target_include_directories(LuaSocket_Mime PRIVATE ${CMAKE_SOURCE_DIR}/include64)
+target_link_libraries(LuaSocket_Mime luajit::LuaJIT)
# "socket/core" module.
add_library(LuaSocket_Socket STATIC
@@ -24,6 +23,7 @@ add_library(LuaSocket_Socket STATIC
${LUASOCKET_SRC_DIR}/select.c
${LUASOCKET_SRC_DIR}/tcp.c
${LUASOCKET_SRC_DIR}/udp.c)
+target_link_libraries(LuaSocket_Socket luajit::LuaJIT)
if(WIN32)
target_sources(LuaSocket_Socket PRIVATE ${LUASOCKET_SRC_DIR}/wsocket.c)
@@ -32,8 +32,6 @@ else()
target_sources(LuaSocket_Socket PRIVATE ${LUASOCKET_SRC_DIR}/usocket.c)
endif()
-target_include_directories(LuaSocket_Socket PRIVATE ${CMAKE_SOURCE_DIR}/include64)
-
# "socket/unix" module.
if(UNIX)
add_library(LuaSocket_Unix STATIC
@@ -48,7 +46,7 @@ if(UNIX)
${LUASOCKET_SRC_DIR}/compat.c
${LUASOCKET_SRC_DIR}/unix.c)
- target_include_directories(LuaSocket_Unix PRIVATE ${CMAKE_SOURCE_DIR}/include64)
+ target_link_libraries(LuaSocket_Unix luajit::LuaJIT)
else()
# Add a stub, since it's not supported on non-UNIX platforms.
add_library(LuaSocket_Unix INTERFACE)
@@ -64,7 +62,7 @@ if(UNIX)
${LUASOCKET_SRC_DIR}/usocket.c
${LUASOCKET_SRC_DIR}/serial.c)
- target_include_directories(LuaSocket_Serial PRIVATE ${CMAKE_SOURCE_DIR}/include64)
+ target_link_libraries(LuaSocket_Serial luajit::LuaJIT)
target_compile_definitions(LuaSocket_Serial PRIVATE LUASOCKET_API=extern)
else()
# Add a stub, since it's not supported on non-UNIX platforms.
diff --git a/src/third_party/luaxml/CMakeLists.txt b/src/third_party/luaxml/CMakeLists.txt
index 6259f641..711d1418 100644
--- a/src/third_party/luaxml/CMakeLists.txt
+++ b/src/third_party/luaxml/CMakeLists.txt
@@ -2,4 +2,4 @@ cmake_minimum_required(VERSION 3.9)
project(LuaXML VERSION 10.10.12.2 DESCRIPTION "A module that maps between Lua and XML without much ado.")
add_library(LuaXML_lib STATIC upstream/LuaXML_lib.c)
-target_include_directories(LuaXML_lib PRIVATE ${CMAKE_SOURCE_DIR}/include64)
+target_link_libraries(LuaXML_lib luajit::LuaJIT)
\ No newline at end of file