فهرست منبع

Remove case sensitivity for libraries on windows

Ginger Bill 8 سال پیش
والد
کامیت
ce3582fd89
4فایلهای تغییر یافته به همراه31 افزوده شده و 32 حذف شده
  1. 0 5
      code/demo.odin
  2. 23 23
      core/opengl.odin
  3. 4 4
      core/sys/windows.odin
  4. 4 0
      src/ir.c

+ 0 - 5
code/demo.odin

@@ -10,10 +10,6 @@
 #import "utf8.odin";
 
 main :: proc() {
-	fmt.println("GOOGOLPLEX");
-}
-
-/*
 	foo :: proc(x: ^i32) -> (int, int) {
 		fmt.println("^int");
 		return 123, cast(int)(x^);
@@ -56,4 +52,3 @@ main :: proc() {
 	f = foo;
 	f();
 }
-*/

+ 23 - 23
core/opengl.odin

@@ -1,32 +1,32 @@
-#foreign_system_library "opengl32.lib" when ODIN_OS == "windows";
+#foreign_system_library lib "opengl32.lib" when ODIN_OS == "windows";
 #import win32 "sys/windows.odin" when ODIN_OS == "windows";
 #include "opengl_constants.odin";
 
-Clear         :: proc(mask: u32)                                #foreign opengl32 "glClear";
-ClearColor    :: proc(r, g, b, a: f32)                          #foreign opengl32 "glClearColor";
-Begin         :: proc(mode: i32)                                #foreign opengl32 "glBegin";
-End           :: proc()                                         #foreign opengl32 "glEnd";
-Finish        :: proc()                                         #foreign opengl32 "glFinish";
-BlendFunc     :: proc(sfactor, dfactor: i32)                    #foreign opengl32 "glBlendFunc";
-Enable        :: proc(cap: i32)                                 #foreign opengl32 "glEnable";
-Disable       :: proc(cap: i32)                                 #foreign opengl32 "glDisable";
-GenTextures   :: proc(count: i32, result: ^u32)                 #foreign opengl32 "glGenTextures";
-DeleteTextures:: proc(count: i32, result: ^u32)                 #foreign opengl32 "glDeleteTextures";
-TexParameteri :: proc(target, pname, param: i32)                #foreign opengl32 "glTexParameteri";
-TexParameterf :: proc(target: i32, pname: i32, param: f32)      #foreign opengl32 "glTexParameterf";
-BindTexture   :: proc(target: i32, texture: u32)                #foreign opengl32 "glBindTexture";
-LoadIdentity  :: proc()                                         #foreign opengl32 "glLoadIdentity";
-Viewport      :: proc(x, y, width, height: i32)                 #foreign opengl32 "glViewport";
-Ortho         :: proc(left, right, bottom, top, near, far: f64) #foreign opengl32 "glOrtho";
-Color3f       :: proc(r, g, b: f32)                             #foreign opengl32 "glColor3f";
-Vertex3f      :: proc(x, y, z: f32)                             #foreign opengl32 "glVertex3f";
+Clear         :: proc(mask: u32)                                #foreign lib "glClear";
+ClearColor    :: proc(r, g, b, a: f32)                          #foreign lib "glClearColor";
+Begin         :: proc(mode: i32)                                #foreign lib "glBegin";
+End           :: proc()                                         #foreign lib "glEnd";
+Finish        :: proc()                                         #foreign lib "glFinish";
+BlendFunc     :: proc(sfactor, dfactor: i32)                    #foreign lib "glBlendFunc";
+Enable        :: proc(cap: i32)                                 #foreign lib "glEnable";
+Disable       :: proc(cap: i32)                                 #foreign lib "glDisable";
+GenTextures   :: proc(count: i32, result: ^u32)                 #foreign lib "glGenTextures";
+DeleteTextures:: proc(count: i32, result: ^u32)                 #foreign lib "glDeleteTextures";
+TexParameteri :: proc(target, pname, param: i32)                #foreign lib "glTexParameteri";
+TexParameterf :: proc(target: i32, pname: i32, param: f32)      #foreign lib "glTexParameterf";
+BindTexture   :: proc(target: i32, texture: u32)                #foreign lib "glBindTexture";
+LoadIdentity  :: proc()                                         #foreign lib "glLoadIdentity";
+Viewport      :: proc(x, y, width, height: i32)                 #foreign lib "glViewport";
+Ortho         :: proc(left, right, bottom, top, near, far: f64) #foreign lib "glOrtho";
+Color3f       :: proc(r, g, b: f32)                             #foreign lib "glColor3f";
+Vertex3f      :: proc(x, y, z: f32)                             #foreign lib "glVertex3f";
 TexImage2D    :: proc(target, level, internal_format,
                       width, height, border,
-                      format, _type: i32, pixels: rawptr) #foreign opengl32 "glTexImage2D";
+                      format, _type: i32, pixels: rawptr) #foreign lib "glTexImage2D";
 
-GetError    :: proc() -> i32            #foreign opengl32 "glGetError";
-GetString   :: proc(name: i32) -> ^byte #foreign opengl32 "glGetString";
-GetIntegerv :: proc(name: i32, v: ^i32) #foreign opengl32 "glGetIntegerv";
+GetError    :: proc() -> i32            #foreign lib "glGetError";
+GetString   :: proc(name: i32) -> ^byte #foreign lib "glGetString";
+GetIntegerv :: proc(name: i32, v: ^i32) #foreign lib "glGetIntegerv";
 
 
 string_data :: proc(s: string) -> ^u8 #inline { return ^s[0]; }

+ 4 - 4
core/sys/windows.odin

@@ -294,7 +294,7 @@ WriteBarrier     :: proc() #foreign kernel32;
 ReadBarrier      :: proc() #foreign kernel32;
 
 
-// GDI
+
 BITMAPINFOHEADER :: struct #ordered {
 	size:              u32,
 	width, height:     i32,
@@ -405,10 +405,10 @@ WGL_CONTEXT_PROFILE_MASK_ARB              :: 0x9126;
 WGL_CONTEXT_CORE_PROFILE_BIT_ARB          :: 0x0001;
 WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB :: 0x0002;
 
-wglCreateContext  :: proc(hdc: HDC) -> HGLRC #foreign opengl32;
+wglCreateContext  :: proc(hdc: HDC) -> HGLRC              #foreign opengl32;
 wglMakeCurrent    :: proc(hdc: HDC, hglrc: HGLRC) -> BOOL #foreign opengl32;
-wglGetProcAddress :: proc(c_str: ^u8) -> PROC #foreign opengl32;
-wglDeleteContext  :: proc(hglrc: HGLRC) -> BOOL #foreign opengl32;
+wglGetProcAddress :: proc(c_str: ^u8) -> PROC             #foreign opengl32;
+wglDeleteContext  :: proc(hglrc: HGLRC) -> BOOL           #foreign opengl32;
 
 
 

+ 4 - 0
src/ir.c

@@ -5213,7 +5213,11 @@ void ir_add_foreign_library_path(irModule *m, Entity *e) {
 
 	for_array(path_index, m->foreign_library_paths) {
 		String path = m->foreign_library_paths.e[path_index];
+#if defined(GB_SYSTEM_WINDOWS)
+		if (str_eq_ignore_case(path, library_path)) {
+#else
 		if (str_eq(path, library_path)) {
+#endif
 			return;
 		}
 	}