Code Monkey home page Code Monkey logo

cglfw3's Introduction

Swift Graphics Libraries

This is an Xcode project used to develop SwiftGL.

If you are here to use the libraries, you can find them here. There are also tutorials to get you started.

To use this Xcode project you must have GLFW3 installed. For homebrew, brew install --HEAD glfw3 does the trick. Currently due to a bug in GLFW 3.2.1 on macos, you have to use the master branch to get the bug fix.

cglfw3's People

Contributors

ae9rb avatar gazibekov avatar jkolb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cglfw3's Issues

Use pkg-config to find headers and libraries on macOS?

I tried to run the hello-window-1 example from the examples repository by naively typing swift run but got the following error:

[...]/01-hello-window-1$ swift run
[...]
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "shim.h"
        ^
[...]/01-hello-window-1/.build/checkouts/CGLFW3.git-2014552659416122263/shim.h:5:10: error: 'GLFW/glfw3.h' file not found
#include "GLFW/glfw3.h"
         ^
[...]/01-hello-window-1/main.swift:4:8: error: could not build Objective-C module 'CGLFW3'
import CGLFW3
       ^
error: terminated(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f [...]/01-hello-window-1/.build/debug.yaml example.exe

I installed glfw using MacPorts. Adding the include and library directories on the command line solves the problem and let's the example run without modification: swift run -Xswiftc -I/opt/local/include -Xlinker -L/opt/local/lib. But this kinda sucks because I have to remember adding those options whenever I want to build or run my projects and Xcode does not automatically know about those directories either and I have to configure it there too.

I'm a complete novice when it comes to Swift package management but I noticed that adding pkgConfig: "glfw3" to CGLFW3's Package.swift allows me to run the example with just swift run and from within the generated Xcode project without any adjustments.

diff --git a/Package.swift b/Package.swift
index e1f46ee..cc1bbd3 100644
--- a/Package.swift
+++ b/Package.swift
@@ -1,5 +1,6 @@
 import PackageDescription
 
 let package = Package(
-    name: "CGLFW3"
+    name: "CGLFW3",
+    pkgConfig: "glfw3"
 )

Is there any downside to this? Otherwise it would IMHO greatly improve the experience of using this library on macOS.

Empty manifest file is not supported anymore

When I try to build the example at http://www.swiftgl.org/learn/01-hello-window.html, using the
swift build -Xcc -I/usr/local/include -Xlinker -L/usr/local/lib
then I get this

Empty manifest file is not supported anymore. Use `swift package init` to autogenerate.
error: The package at `/Volumes/P3/OpenGL/HelloSwift/Packages/CGLFW3.git' has no Package.swift for the specific version: 1.0.0

I have tried this on two different Macs, with OSX 10.11.6 and 10.12. Same results.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.