Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build native libraries for Mac OS X and Windows on aarch64 machines #135

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion config/config_cc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,20 @@
LDFLAGS += -G
EOS
when 'Windows'
if w64build?
case os_arch
when 'aarch64'
Path.check_cmd(WARM64_PREFIX + 'gcc', 'make', W64_PREFIX + 'ld')
Path.check_cmd('cygpath')
JblasConfig::CONFIG << <<EOS
CC = #{WARM64_PREFIX}gcc
CFLAGS = -ggdb -D__int64='long long'
INCDIRS += -I"#{dir java_home}/include" -I"#{dir java_home}/include/win32" -Iinclude
LDFLAGS += -shared -Wl
SO = dll
LIB =
RUBY = ruby
EOS
when 'amd64'
Path.check_cmd(W64_PREFIX + 'gcc', 'make', W64_PREFIX + 'ld')
Path.check_cmd('cygpath')
JblasConfig::CONFIG << <<EOS
Expand Down
6 changes: 5 additions & 1 deletion config/config_fortran.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@
CONFIG['F77'] = 'gfortran'
CONFIG['CCC'] = 'c99'
elsif CONFIG['OS_NAME'] == 'Windows'
if CONFIG['OS_ARCH'] == 'amd64'
if CONFIG['OS_ARCH'] == 'aarch64'
CONFIG['LD'] = '/clangarm64/bin/flang-new'
CONFIG['F77'] = '/clangarm64/bin/flang-new'
CONFIG['CCC'] = 'c99'
elsif CONFIG['OS_NAME'] == 'amd64'
CONFIG['LD'] = W64_PREFIX + 'gfortran'
CONFIG['F77'] = W64_PREFIX + 'gfortran'
CONFIG['CCC'] = 'c99'
Expand Down
27 changes: 19 additions & 8 deletions config/config_libs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,23 @@
configure :libpath => ['OS_NAME', 'OS_ARCH'] do
if $opts.defined? :libpath
CONFIG[:libpath] = $opts[:libpath].split(':')
elsif CONFIG['OS_NAME'] == 'Windows'
case CONFIG['OS_ARCH']
when 'aarch64'
CONFIG[:libpath] = ['/clangarm64/lib']
when 'amd64'
CONFIG[:libpath] = ['/mingw64/lib']
else
CONFIG[:libpath] = ['/mingw32/lib']
end
elsif CONFIG['OS_NAME'] == 'Mac\ OS\ X'
CONFIG[:libpath] = ['/opt/local/lib']
else
if CONFIG['OS_NAME'] == 'Mac\ OS\ X'
CONFIG[:libpath] = ['/opt/local/lib']
#CONFIG[:libpath] = %w(/usr/lib /lib /usr/lib/sse2)
if CONFIG['OS_ARCH'] == 'aarch64'
CONFIG[:libpath] = %w(/usr/lib/aarch64-linux-gnu)
else
#CONFIG[:libpath] = %w(/usr/lib /lib /usr/lib/sse2)
if CONFIG['OS_ARCH'] == 'aarch64'
CONFIG[:libpath] = %w(/usr/lib/aarch64-linux-gnu)
else
CONFIG[:libpath] = %w(/usr/lib/x86_64-linux-gnu)
end
CONFIG[:libpath] = %w(/usr/lib/x86_64-linux-gnu)
end
end
ok(CONFIG[:libpath].inspect)
Expand Down Expand Up @@ -182,6 +189,10 @@
libgfortran_path = %x(gfortran -print-file-name=libgfortran.a).strip
puts "(#{libgfortran_path})"
CONFIG['LOADLIBES'] += [libgfortran_path]
print "Looking for where libquadmath.a is... "
libgfortran_path = %x(gfortran -print-file-name=libquadmath.a).strip
puts "(#{libgfortran_path})"
CONFIG['LOADLIBES'] += [libgfortran_path]
else
CONFIG['LOADLIBES'] += ['-l:libgfortran.a']
end
Expand Down
7 changes: 4 additions & 3 deletions config/windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@
require 'config/config'

W64_PREFIX = 'x86_64-w64-mingw32-'
W32_PREFIX = 'i686-pc-mingw32-'
W32_PREFIX = 'i686-w64-mingw32-'
WARM64_PREFIX = 'aarch64-w64-mingw32-'

def w64build?
JblasConfig::CONFIG['OS_NAME'] == 'Windows' and JblasConfig::CONFIG['OS_ARCH'] == 'amd64'
def os_arch
JblasConfig::CONFIG['OS_ARCH']
end
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.