├── .gitignore ├── LICENSE.txt ├── Package.swift ├── README.md ├── module.modulemap └── shim.h /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 David Turnbull 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version: 5.4 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "CGLFW3" 7 | ) 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Swift C bindings for GLFW v3 2 | 3 | [GLFW home page] 4 | (http://www.glfw.org) 5 | 6 | This is a package for the open source Swift. Usage: 7 | 8 | - Install GLFW version 3. 9 | - Include dependency in your `Package.swift`: 10 | ```swift 11 | let package = Package( 12 | dependencies: [ 13 | .Package(url: "https://github.com/SwiftGL/CGLFW3.git", majorVersion: 2) 14 | ] 15 | ) 16 | ``` 17 | - `import CGLFW3` in your swift file. 18 | - Use as a C API. [Read the Apple docs to learn how.] 19 | (https://developer.apple.com/library/mac/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithCAPIs.html) 20 | 21 | 22 | *MacOS:* 23 | ```bash 24 | brew install --HEAD glfw3 25 | 26 | swift build -Xswiftc -I/usr/local/include -Xlinker -L/usr/local/lib 27 | ``` 28 | 29 | *Ubuntu:* 30 | ```bash 31 | sudo apt install libglfw3 32 | 33 | swift build 34 | ``` 35 | -------------------------------------------------------------------------------- /module.modulemap: -------------------------------------------------------------------------------- 1 | module CGLFW3 [system] { 2 | header "shim.h" 3 | link "glfw" 4 | export * 5 | } 6 | -------------------------------------------------------------------------------- /shim.h: -------------------------------------------------------------------------------- 1 | // Don't load OpenGL 2 | #define GLFW_INCLUDE_NONE 3 | 4 | // find GLFW using include path 5 | #include "GLFW/glfw3.h" 6 | --------------------------------------------------------------------------------