浏览代码

Merge branch 'master' of https://github.com/odin-lang/Odin

gingerBill 1 年之前
父节点
当前提交
f4c74a9f32
共有 2 个文件被更改,包括 80 次插入11 次删除
  1. 19 11
      .github/workflows/nightly.yml
  2. 61 0
      vendor/egl/egl.odin

+ 19 - 11
.github/workflows/nightly.yml

@@ -63,11 +63,13 @@ jobs:
           cp -r core dist
           cp -r core dist
           cp -r vendor dist
           cp -r vendor dist
           cp -r examples dist
           cp -r examples dist
+          # Zipping so executable permissions are retained, see https://github.com/actions/upload-artifact/issues/38
+          zip -r dist.zip dist
       - name: Upload artifact
       - name: Upload artifact
         uses: actions/upload-artifact@v1
         uses: actions/upload-artifact@v1
         with:
         with:
           name: ubuntu_artifacts
           name: ubuntu_artifacts
-          path: dist
+          path: dist.zip
   build_macos:
   build_macos:
     name: MacOS Build
     name: MacOS Build
     if: github.repository == 'odin-lang/Odin'
     if: github.repository == 'odin-lang/Odin'
@@ -76,15 +78,13 @@ jobs:
       - uses: actions/checkout@v1
       - uses: actions/checkout@v1
       - name: Download LLVM and setup PATH
       - name: Download LLVM and setup PATH
         run: |
         run: |
-          brew install llvm@13
+          brew install llvm@13 dylibbundler
           echo "/usr/local/opt/llvm@13/bin" >> $GITHUB_PATH
           echo "/usr/local/opt/llvm@13/bin" >> $GITHUB_PATH
           TMP_PATH=$(xcrun --show-sdk-path)/user/include
           TMP_PATH=$(xcrun --show-sdk-path)/user/include
           echo "CPATH=$TMP_PATH" >> $GITHUB_ENV
           echo "CPATH=$TMP_PATH" >> $GITHUB_ENV
       - name: build odin
       - name: build odin
         run: make nightly
         run: make nightly
-      - name: Odin run
-        run: ./odin run examples/demo
-      - name: Copy artifacts
+      - name: Bundle
         run: |
         run: |
           mkdir dist
           mkdir dist
           cp odin dist
           cp odin dist
@@ -94,11 +94,16 @@ jobs:
           cp -r core dist
           cp -r core dist
           cp -r vendor dist
           cp -r vendor dist
           cp -r examples dist
           cp -r examples dist
+          dylibbundler -b -x dist/odin -d dist/libs -od -p @executable_path/libs
+          # Zipping so executable permissions are retained, see https://github.com/actions/upload-artifact/issues/38
+          zip -r dist.zip dist
+      - name: Odin run
+        run: ./dist/odin run examples/demo
       - name: Upload artifact
       - name: Upload artifact
         uses: actions/upload-artifact@v1
         uses: actions/upload-artifact@v1
         with:
         with:
           name: macos_artifacts
           name: macos_artifacts
-          path: dist
+          path: dist.zip
   build_macos_arm:
   build_macos_arm:
     name: MacOS ARM Build
     name: MacOS ARM Build
     if: github.repository == 'odin-lang/Odin'
     if: github.repository == 'odin-lang/Odin'
@@ -107,15 +112,13 @@ jobs:
       - uses: actions/checkout@v1
       - uses: actions/checkout@v1
       - name: Download LLVM and setup PATH
       - name: Download LLVM and setup PATH
         run: |
         run: |
-          brew install llvm@13
+          brew install llvm@13 dylibbundler
           echo "/opt/homebrew/opt/llvm@13/bin" >> $GITHUB_PATH
           echo "/opt/homebrew/opt/llvm@13/bin" >> $GITHUB_PATH
           TMP_PATH=$(xcrun --show-sdk-path)/user/include
           TMP_PATH=$(xcrun --show-sdk-path)/user/include
           echo "CPATH=$TMP_PATH" >> $GITHUB_ENV
           echo "CPATH=$TMP_PATH" >> $GITHUB_ENV
       - name: build odin
       - name: build odin
         run: make nightly
         run: make nightly
-      - name: Odin run
-        run: ./odin run examples/demo
-      - name: Copy artifacts
+      - name: Bundle
         run: |
         run: |
           mkdir dist
           mkdir dist
           cp odin dist
           cp odin dist
@@ -125,11 +128,16 @@ jobs:
           cp -r core dist
           cp -r core dist
           cp -r vendor dist
           cp -r vendor dist
           cp -r examples dist
           cp -r examples dist
+          dylibbundler -b -x dist/odin -d dist/libs -od -p @executable_path/libs
+          # Zipping so executable permissions are retained, see https://github.com/actions/upload-artifact/issues/38
+          zip -r dist.zip dist
+      - name: Odin run
+        run: ./dist/odin run examples/demo
       - name: Upload artifact
       - name: Upload artifact
         uses: actions/upload-artifact@v1
         uses: actions/upload-artifact@v1
         with:
         with:
           name: macos_arm_artifacts
           name: macos_arm_artifacts
-          path: dist
+          path: dist.zip
   upload_b2:
   upload_b2:
     runs-on: [ubuntu-latest]
     runs-on: [ubuntu-latest]
     needs: [build_windows, build_macos, build_macos_arm, build_ubuntu]
     needs: [build_windows, build_macos, build_macos_arm, build_ubuntu]

+ 61 - 0
vendor/egl/egl.odin

@@ -0,0 +1,61 @@
+//+build linux
+package egl
+
+NativeDisplayType :: rawptr
+NativeWindowType  :: rawptr
+Display :: rawptr
+Surface :: rawptr
+Config  :: rawptr
+Context :: rawptr
+
+NO_DISPLAY :: Display(uintptr(0))
+NO_CONTEXT :: Context(uintptr(0))
+NO_SURFACE :: Surface(uintptr(0))
+
+CONTEXT_OPENGL_CORE_PROFILE_BIT :: 0x00000001
+WINDOW_BIT        :: 0x0004
+OPENGL_BIT        :: 0x0008
+
+BLUE_SIZE         :: 0x3022
+GREEN_SIZE        :: 0x3023
+RED_SIZE          :: 0x3024
+DEPTH_SIZE        :: 0x3025
+STENCIL_SIZE      :: 0x3026
+
+SURFACE_TYPE      :: 0x3033
+NONE              :: 0x3038
+COLOR_BUFFER_TYPE :: 0x303F
+RENDERABLE_TYPE   :: 0x3040
+CONFORMANT        :: 0x3042
+
+BACK_BUFFER          :: 0x3084
+RENDER_BUFFER        :: 0x3086
+GL_COLORSPACE_SRGB   :: 0x3089
+GL_COLORSPACE_LINEAR :: 0x308A
+RGB_BUFFER           :: 0x308E
+GL_COLORSPACE        :: 0x309D
+
+CONTEXT_MAJOR_VERSION       :: 0x3098
+CONTEXT_MINOR_VERSION       :: 0x30FB
+CONTEXT_OPENGL_PROFILE_MASK :: 0x30FD
+
+OPENGL_API        :: 0x30A2
+
+foreign import egl "system:EGL"
+@(default_calling_convention="c", link_prefix="egl")
+foreign egl {
+	GetDisplay          :: proc(display: NativeDisplayType) -> Display ---
+	Initialize          :: proc(display: Display, major: ^i32, minor: ^i32) -> i32 ---
+	BindAPI             :: proc(api: u32) -> i32 ---
+	ChooseConfig        :: proc(display: Display, attrib_list: ^i32, configs: ^Context, config_size: i32, num_config: ^i32) -> i32 ---
+	CreateWindowSurface :: proc(display: Display, config: Config, native_window: NativeWindowType, attrib_list: ^i32) -> Surface ---
+	CreateContext       :: proc(display: Display, config: Config, share_context: Context, attrib_list: ^i32) -> Context ---
+	MakeCurrent         :: proc(display: Display, draw: Surface, read: Surface, ctx: Context) -> i32 ---
+	SwapInterval        :: proc(display: Display, interval: i32) -> i32 ---
+	SwapBuffers         :: proc(display: Display, surface: Surface) -> i32 ---
+	GetProcAddress      :: proc(name: cstring) -> rawptr ---
+}
+
+gl_set_proc_address :: proc(p: rawptr, name: cstring) {
+	(^rawptr)(p)^ = GetProcAddress(name)
+}