瀏覽代碼

Add build instructions (MacOS UNTESTED)

Evgeniy Parfenyuk 2 月之前
父節點
當前提交
ab87554e2e
共有 3 個文件被更改,包括 240 次插入1 次删除
  1. 52 1
      README.md
  2. 51 0
      docs/working_from_Linux.md
  3. 137 0
      docs/working_from_MacOS.md

+ 52 - 1
README.md

@@ -10,8 +10,59 @@ average user.
 But if you are a programmer -- you are welcome to 
 [contribute](CONTRIBUTING.md).
 
+## Table of Contents
+- [Installation](#installation)
+- [Design](#design)
+- [Contributing](CONTRIBUTING.md)
+- [License](LICENSE.md)
 
-## General design
+## Installation
+
+### Installing raylib
+
+You have two options here: build raylib manually or get it automatically
+from Github. They are both easy to do, but for building you need to install 
+additional dependencies, which is not really cool and for auto download you
+need to rely on Github.
+
+It's up for you what to choose.
+
+##### Manually building
+
+If you want build raylib manually, you need to prepare some dependencies:
+
+- [Linux](docs/working_from_Linux.md)
+- [MacOS](docs/working_from_MacOS.md)
+- Windows
+- ChromeOS
+- FreeBSD
+- Raspberry Pi 
+- Android
+
+##### Auto download Vinora 
+
+So, you need some C99 compiler (we use `gcc`), `make`, `git` and `wget`.
+
+`sudo apt install build-essential git wget`
+
+After you installed this, run: 
+
+    make fetch-raylib
+
+It would download raylib from Github instead of building it. 
+
+### Building Vinora 
+
+Simply run: 
+
+    make
+
+It would Vinora Engine.  
+That's all, you've done!
+
+___
+
+## Design 
 
 ### Game structure
 Visual novel on Vinora Engine looks like this:

+ 51 - 0
docs/working_from_Linux.md

@@ -0,0 +1,51 @@
+# Working from Linux
+
+raylib has several dependencies that you need in order to work with it.
+
+#### Install required tools
+You need a **GCC** (or alternative C99 compiler), **make** and **git**. 
+
+    sudo apt install build-essential git
+
+#### Install required libraries
+You need to install some required libraries; **ALSA** for audio,
+**Mesa** for OpenGL accelerated graphics and **X11** for windowing system.
+
+##### Ubuntu
+    sudo apt install libasound2-dev libx11-dev libxrandr-dev libxi-dev 
+    libgl1-mesa-dev libglu1-mesa-dev libxcursor-dev libxinerama-dev 
+    libwayland-dev libxkbcommon-dev
+
+##### Fedora
+    sudo dnf install alsa-lib-devel mesa-libGL-devel libX11-devel
+    libXrandr-devel libXi-devel libXcursor-devel libXinerama-devel
+    libatomic
+
+- ##### `rpm-ostree`-based spins
+      rpm-ostree install alsa-lib-devel mesa-libGL-devel libX11-devel
+      libXrandr-devel libXi-devel libXcursor-devel libXinerama-devel
+      libatomic
+
+##### Asahi Remix (Apple Silicon)
+    sudo dnf install libX11-devel libXrandr-devel libXi-devel libXcursor-devel
+    mesa-libGL-devel pulseaudio-libs-devel libdrm-devel libXinerama-devel
+
+##### Arch Linux
+    sudo pacman -S alsa-lib mesa libx11 libxrandr libxi libxcursor libxinerama
+
+##### Void Linux
+    sudo xbps-install make alsa-lib-devel libglvnd-devel libX11-devel
+    libXrandr-devel libXi-devel libXcursor-devel libXinerama-devel mesa
+    MesaLib-devel
+
+ - ##### For intel drivers
+       sudo xbps-install mesa-dri mesa-intel-dri
+
+## Build raylib 
+
+Simply run 
+
+    make 
+
+It will build raylib, then Vinora Engine.  
+Congrats, you've done!

+ 137 - 0
docs/working_from_MacOS.md

@@ -0,0 +1,137 @@
+# Working on MacOS 
+Copied from here: <https://github.com/raysan5/raylib/wiki/Working-on-macOS>
+
+# Building raylib without Xcode (statically) 
+
+Building statically means you can run this application on other machines with
+ease - users won't have to have any of the frameworks installed that are
+required. Also, this will work on mac's 10.9 and up.
+
+## Here's the quick instructions:
+
+1. From the command line 
+```
+export MACOSX_DEPLOYMENT_TARGET=10.9
+```
+2. Install XCode tools (don't forget to then update the tools in the Mac App
+Store after!)
+````
+xcode-select --install
+````
+3. Build Vinora and raylib (Again, this is so the export line takes effect) 
+
+```
+make
+```
+
+You may do the otool check with the file in external/raylib/libraylib.a here 
+if you like. (LC_VERSION_MIN_MACOSX should be version 10.4), and we're good!
+
+4. Build your project! (TODO: THIS NEED TO BE INCLUDED IN MAKEFILE)
+```
+clang -framework CoreVideo -framework IOKit -framework Cocoa -framework\
+GLUT -framework OpenGL libraylib.a my_app.c -o my_app
+```
+
+Note: If you are compiling a C++ project, you will need to make sure your
+compiler supports C++11 standards. With clang you can enable this by passing
+`-std=c++11`, see https://clang.llvm.org/cxx_status.html for more details.
+
+Check for warnings! This can tell you if a library you're linking to was
+not built for OSX 10.9, in which case you'll need to rebuild that too. 
+
+Check otool one last time for the LC_VERSION_MIN_MACOSX version:
+```
+otool -l my_app
+```
+
+Last thing, let me show you something cool:
+
+````
+otool -L my_app
+````
+
+This shows you everything your application links to. Basically, if 
+anything is pointing to anything but /usr/lib/* or /System/Library/*,
+your application will throw an error if you run it on any other Mac. 
+It's not portable. 
+For example if it's linking to something in /usr/local/lib, or a relative
+folder, that would be bad. But after the above, you should be clear of 
+dynamic dependencies!
+
+# Bundle your app in an Application
+
+````
+mkdir standard.app/Contents
+mkdir standard.app/Contents/MacOS
+mkdir standard.app/Contents/Resources
+touch standard.app/Contents/Info.plist
+````
+
+The app you just created, "my_app" should go in the MacOS folder.
+
+````
+mv my_app standard.app/Contents/MacOS
+````
+
+
+Info.plist should read like this:
+````
+<?xml version="1.0" encoding="UTF-8"?>
+    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
+        "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+    <plist version="1.0">
+    <dict>
+      <key>CFBundleExecutable</key>
+      <string>my_app</string>
+    </dict>
+    </plist>
+````
+
+See more fields you can add here: 
+<https://stackoverflow.com/questions/1596945/building-osx-app-bundle>
+
+Now you can double click on standard.app and it will run your application!
+Note that some things will be cached by the OS. If you want to refresh your
+application bundle run this:
+
+````
+/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -f standard.app
+````
+
+This has a whole lot of potentially useful info on all the apps on your
+system, you can use this to determine if the version is correct I suppose:
+
+````
+ /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump > dump.txt
+````
+
+Just search for your app in dump.txt.
+
+# Creating a DMG image for sharing your app
+
+You could just as easily do a zip I suppose, but DMGs are fashionable
+aren't they?
+
+Here's a 32 megabyte dmg:
+1. Create the writeable dmg.
+```
+hdiutil create -size 32m -fs HFS+ -volname "My App" my_app_writeable.dmg
+```
+2. Attach `my_app_writeable.dmg`. This should tell you something like
+`/dev/disk3` or something. Make a note of that, you'll need it for the
+next step.
+```
+hdiutil attach my_app_writeable.dmg
+```
+3. Drag your app into the dmg. Then run this, replacing `disk999` with
+whatever `/dev/disk` was specified in the previous step.
+```
+hdiutil detach /dev/disk999
+```
+4. Convert to `my_app.dmg`.
+```
+hdiutil convert my_app_writeable.dmg -format UDZO -o my_app.dmg
+```
+5. Share it. Congratulations, `my_app.dmg` is ready to be sent to all
+your most trusted game critics.