stbimage 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db813db9f8656c1b4e4ab644d47f97c561bcca2099ef6983ade9bc28a16f5579
4
- data.tar.gz: 5668270ce32c8305e358cc35626c810fd58a69094b67be24c2afe67858e133ec
3
+ metadata.gz: 8c7e3cbdd4dccecf5bf9a5c6ebc0365b6466fde88658ba4cc55d9b8d723217b5
4
+ data.tar.gz: 32f870bd08f340ac675e3d1a68bced77b0201b9fe7c73ea58bcee53314df131c
5
5
  SHA512:
6
- metadata.gz: 3ffab71c7a5bb8f28af4c67b0fd3add92a031f74b36a2c5d0aa24d587996ea7bc93d166b812215fcf6ac87965358f483c2c5ac7ecea9ecc13bb239f22302d90a
7
- data.tar.gz: 26a238c2444b93a137b720fac42b0cdf6c0780120b0c3870f3d63a179d1e47d99f111c8b72867e2ce484a9f11a55e5d8b0fa699c016784b10ff8a2d149a0709f
6
+ metadata.gz: 3a1e041c4080ea9a88292ee5b5b8882a228b0a3ce485ab5eea544cca27576f8e4ccd05e2858e1b0d77b517c004658db6a5d62845b409d44dd0b7d0a4dbdaf313
7
+ data.tar.gz: 9507fa97a2455e1280d402ebe1419eca0db673e8b7c9001253d7070ddfc1be99e130a31e12eba38f26c6f68f34fe5438a07623bf8c73ae29820243029c7c986c
data/README.md CHANGED
@@ -5,6 +5,7 @@
5
5
  Ruby binding of stb-image.h
6
6
 
7
7
  **Works well on windows!!!**
8
+ **Added support for Linux (32, 64, arm)**
8
9
 
9
10
  * ### Supports (so far): ###
10
11
  <br>
@@ -41,7 +42,7 @@ Ruby binding of stb-image.h
41
42
  * Linux/macOs:\
42
43
  `gem install stbimage`
43
44
 
44
- *Note: In Linux/macOs you have to compile the dynamic libary (.so) yourself. Although I planned to include it in the future*
45
+ *Note: In macOs you have to compile the dynamic libary (.so) yourself. Although I planned to include it in the future*
45
46
 
46
47
  <br>
47
48
 
@@ -56,11 +57,11 @@ You can find it under [dlls](dlls) folder
56
57
  ```ruby
57
58
  require 'stbimage'
58
59
 
59
- # use this to load the dll (from gem version 0.2.3 and above)! Only For windows yet
60
+ # use this to load the dll (from gem version 0.2.3 and above)! Only For windows and linux yet
60
61
  STBIMAGE.load_lib()
61
62
 
62
- # In linux and macOs you have to provide a dynamic libary (.so)
63
- # STBIMAGE.load_lib('your_name.so', 'absolute_path_to_file')
63
+ # In macOs you have to provide a dynamic libary (.so) by yourself
64
+ # STBIMAGE.load_lib('your_name.so', 'absolute_path_to_file')
64
65
 
65
66
 
66
67
  width = ' ' * 4
@@ -34,14 +34,48 @@ module STBIMAGE
34
34
  # Load native dll libary
35
35
  def self.load_lib(lib = nil, path = nil, output_error = false)
36
36
  if lib == nil && path == nil
37
- if RUBY_PLATFORM == "x64-mswin64_140" || RUBY_PLATFORM == "x64-mingw32"
38
- lib, path = 'stbDLL_x64.dll', "#{__dir__}/../dlls"
39
- elsif RUBY_PLATFORM == "x86-mingw32"
40
- lib, path = 'stbDLL_x86.dll', "#{__dir__}/../dlls"
41
- # elsif RUBY_PLATFORM == ""
42
- else
43
-
37
+
38
+ if RUBY_PLATFORM =~ /x86/
39
+
40
+ # puts "You have a 32-bit Architecture ruby"
41
+ if RUBY_PLATFORM =~ /mswin/ || RUBY_PLATFORM =~ /mingw/
42
+ # puts "With Windows"
43
+ lib, path = 'stbDLL_x86.dll', "#{__dir__}/../dlls"
44
+ elsif RUBY_PLATFORM =~ /linux/ || RUBY_PLATFORM =~ /cygwin/
45
+ # puts "With Linux"
46
+ lib, path = 'libstb_x86.so', "#{__dir__}/../dlls"
47
+ elsif RUBY_PLATFORM =~ /darwin/
48
+ # puts "With macOS"
49
+ else
50
+ # puts "I have no idea what os are you using, so it's possible that stbimage wont't work"
51
+ end
52
+
53
+ elsif RUBY_PLATFORM =~ /arm/
54
+
55
+ # puts "You have a arm architecture"
56
+ lib, path = 'libstb_arm.so', "#{__dir__}/../dlls"
57
+
58
+ elsif RUBY_PLATFORM =~ /java/
59
+
60
+ # puts "You have jruby!"
61
+
62
+ else
63
+
64
+ # puts "You have a 64-bit Architecture ruby"
65
+ if RUBY_PLATFORM =~ /mswin/ || RUBY_PLATFORM =~ /mingw/
66
+ # puts "With Windows"
67
+ lib, path = 'stbDLL_x64.dll', "#{__dir__}/../dlls"
68
+ elsif RUBY_PLATFORM =~ /linux/ || RUBY_PLATFORM =~ /cygwin/
69
+ # puts "With Linux"
70
+ lib, path = 'libstb_x64.so', "#{__dir__}/../dlls"
71
+ elsif RUBY_PLATFORM =~ /darwin/
72
+ # puts "With macOS"
73
+ else
74
+ # puts "I have no idea what os are you using, so it's possible that stbimage wont't work"
75
+ end
76
+
44
77
  end
78
+
45
79
  end
46
80
 
47
81
  if path
@@ -0,0 +1,51 @@
1
+ RUBY_PLATFORM = x86-mingw32
2
+
3
+ if RUBY_PLATFORM =~ /x86/
4
+
5
+ puts "You have a 32-bit Architecture ruby"
6
+ if RUBY_PLATFORM =~ /mswin/ || RUBY_PLATFORM =~ /mingw/
7
+ puts "With Windows"
8
+ lib, path = 'stbDLL_x86.dll', "#{__dir__}/../dlls"
9
+ elsif RUBY_PLATFORM =~ /linux/ || RUBY_PLATFORM =~ /cygwin/
10
+ puts "With Linux"
11
+ lib, path = 'libstb_x86.so', "#{__dir__}/../dlls"
12
+ elsif RUBY_PLATFORM =~ /darwin/
13
+ puts "With macOS"
14
+ else
15
+ puts "I have no idea what os are you using, so it's possible that stbimage wont't work"
16
+ end
17
+
18
+ elsif RUBY_PLATFORM =~ /arm/
19
+
20
+ puts "You have a arm architecture"
21
+ lib, path = 'libstb_arm.so', "#{__dir__}/../dlls"
22
+
23
+ elsif RUBY_PLATFORM =~ /java/
24
+
25
+ puts "You have jruby!"
26
+
27
+ else
28
+
29
+ puts "You have a 64-bit Architecture ruby"
30
+ if RUBY_PLATFORM =~ /mswin/ || RUBY_PLATFORM =~ /mingw/
31
+ puts "With Windows"
32
+ lib, path = 'stbDLL_x64.dll', "#{__dir__}/../dlls"
33
+ elsif RUBY_PLATFORM =~ /linux/ || RUBY_PLATFORM =~ /cygwin/
34
+ puts "With Linux"
35
+ lib, path = 'libstb_x64.so', "#{__dir__}/../dlls"
36
+ elsif RUBY_PLATFORM =~ /darwin/
37
+ puts "With macOS"
38
+ else
39
+ puts "I have no idea what os are you using, so it's possible that stbimage wont't work"
40
+ end
41
+
42
+ end
43
+
44
+
45
+ # if RUBY_PLATFORM == "x64-mswin64_140" || RUBY_PLATFORM == "x64-mingw32"
46
+ # lib, path = 'stbDLL_x64.dll', "#{__dir__}/../dlls"
47
+ # elsif RUBY_PLATFORM == "x86-mingw32"
48
+ # lib, path = 'stbDLL_x86.dll', "#{__dir__}/../dlls"
49
+ # elsif RUBY_PLATFORM =~ /x86_linux/
50
+ # lib, path = 'libstd_x86.so', "#{__dir__}/../dlls"
51
+ # else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stbimage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Keresztes
@@ -12,9 +12,9 @@ date: 2021-01-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: "!Beta Version! A practical image importer/loader. It wraps stb_image.h
14
14
  (ver:2.26 -2020.07.13-). Supported image formats are: JPEG, PNG, TGA, BMP, PSD,
15
- GIF(not animation), HDR, PIC, PNM. Only works well with windows so far (win32/win64),
16
- but linux/macOs users also can use it. Checkout the Homepage for more info (installation,
17
- usage and other information)"
15
+ GIF(not animation), HDR, PIC, PNM. Only works well with windows (win32/win64) and
16
+ with linux so far, but for macOS, users have to include . Checkout the Homepage
17
+ for more info (installation, usage and other information)"
18
18
  email: ''
19
19
  executables: []
20
20
  extensions: []
@@ -24,6 +24,7 @@ files:
24
24
  - dlls/stbDLL_x64.dll
25
25
  - dlls/stbDLL_x86.dll
26
26
  - lib/stbimage.rb
27
+ - utils/system_check.rb
27
28
  homepage: https://github.com/fellowchap-samuel/stbimage-ruby
28
29
  licenses:
29
30
  - MIT