Permalink
Browse files

Add project files

  • Loading branch information...
1 parent d3cbf71 commit 4ff981e62b2b87d5fa847851c3c8eabcf42f125b @xerial committed Mar 18, 2013
View
@@ -1,7 +1,9 @@
*.class
*.log
+*~
# sbt specific
+bin/.lib
dist/*
target/
lib_managed/
@@ -10,4 +12,7 @@ project/boot/
project/plugins/project/
# Scala-IDE specific
-.scala_dependencies
+.scala_dependencies
+
+# IntelliJ specific
+.idea*
View
@@ -0,0 +1,97 @@
+
+include Makefile.common
+
+all: larray
+
+SRC:=src/main/scala
+
+LARRAY_OUT:=$(TARGET)/larray-$(os_arch)
+LARRAY_SRC_DIR:=$(SRC)/xerial/larray/impl
+LARRAY_SRC:=$(shell find $(LARRAY_SRC_DIR))
+LARRAY_OBJ:=$(LARRAY_OUT)/LArrayNative.o
+
+VERSION:=$(shell perl -npe "s/version in ThisBuild\s+:=\s+\"(.*)\"/\1/" version.sbt | sed -e "/^$$/d")
+
+
+CFLAGS:=$(CFLAGS) -I$(LARRAY_SRC_DIR)
+
+LARRAY_HEADER:=$(SRC)/xerial/larray/impl/LArrayNative.h
+
+$(TARGET)/classes/xerial/larray/impl/LArrayNative.class : $(LARRAY_SRC_DIR)/LArrayNative.java
+ $(JAVAC) -d $(TARGET)/classes $<
+
+jni-header: $(LARRAY_HEADER)
+
+$(LARRAY_HEADER): $(SRC)/xerial/larray/impl/LArrayNative.java $(TARGET)/classes/xerial/larray/impl/LArrayNative.class
+ @mkdir -p $(TARGET)/classes
+ $(JAVAH) -classpath $(TARGET)/classes -o $@ xerial.larray.impl.LArrayNative
+
+bytecode: src/main/resources/xerial/larray/impl/LArrayNativeLoader.bytecode
+
+src/main/resources/xerial/larray/impl/LArrayNativeLoader.bytecode: src/main/resources/xerial/larray/impl/LArrayNativeLoader.java
+ @mkdir -p $(TARGET)/temp
+ $(JAVAC) -source 1.5 -target 1.5 -d $(TARGET)/temp $<
+ cp $(TARGET)/temp/xerial/larray/impl/LArrayNativeLoader.class $@
+
+$(LARRAY_OUT)/%.o : $(LARRAY_SRC_DIR)/%.c
+ @mkdir -p $(@D)
+ $(CC) $(CFLAGS) -c $< -o $@
+
+$(LARRAY_OUT)/$(LIBNAME): $(LARRAY_OBJ)
+ $(CC) $(CFLAGS) -o $@ $+ $(LINKFLAGS)
+ $(STRIP) $@
+
+clean-native:
+ rm -rf $(LARRAY_OUT)
+
+clean:
+ rm -rf $(TARGET)
+
+NATIVE_DIR:=src/main/resources/xerial/larray/native/$(OS_NAME)/$(OS_ARCH)
+NATIVE_TARGET_DIR:=$(TARGET)/classes/xerial/native/$(OS_NAME)/$(OS_ARCH)
+NATIVE_DLL:=$(NATIVE_DIR)/$(LIBNAME)
+
+native: $(NATIVE_DLL)
+larray: native $(TARGET)/larray-$(VERSION).jar
+
+SBT:=bin/sbt
+
+$(NATIVE_DLL): $(LARRAY_OUT)/$(LIBNAME)
+ @mkdir -p $(@D)
+ cp $< $@
+ @mkdir -p $(NATIVE_TARGET_DIR)
+ cp $< $(NATIVE_TARGET_DIR)/$(LIBNAME)
+
+$(TARGET)/larray-$(VERSION).jar: native $(NATIVE_DLL)
+ $(SBT) package
+
+test: $(NATIVE_DLL)
+ $(SBT) test
+
+win32:
+ $(MAKE) native CROSS_PREFIX=i686-w64-mingw32- OS_NAME=Windows OS_ARCH=x86
+
+# for cross-compilation on Ubuntu, install the g++-mingw-w64-x86-64 package
+win64:
+ $(MAKE) native CROSS_PREFIX=x86_64-w64-mingw32- OS_NAME=Windows OS_ARCH=amd64
+
+mac32:
+ $(MAKE) native OS_NAME=Mac OS_ARCH=i386
+
+linux32:
+ $(MAKE) native OS_NAME=Linux OS_ARCH=i386
+
+# for cross-compilation on Ubuntu, install the g++-arm-linux-gnueabi package
+linux-arm:
+ $(MAKE) native CROSS_PREFIX=arm-linux-gnueabi- OS_NAME=Linux OS_ARCH=arm
+
+# for cross-compilation on Ubuntu, install the g++-arm-linux-gnueabihf package
+linux-armhf:
+ $(MAKE) native CROSS_PREFIX=arm-linux-gnueabihf- OS_NAME=Linux OS_ARCH=armhf
+
+clean-native-linux32:
+ $(MAKE) clean-native OS_NAME=Linux OS_ARCH=i386
+
+clean-native-win32:
+ $(MAKE) clean-native OS_NAME=Windows OS_ARCH=x86
+
View
@@ -0,0 +1,125 @@
+TARGET:=target
+SRC:=src/main/scala
+
+ifndef JAVA_HOME
+$(error Set JAVA_HOME environment variable)
+endif
+
+JAVA := "$$JAVA_HOME/bin/java"
+JAVAC := "$$JAVA_HOME/bin/javac"
+JAVAH := "$$JAVA_HOME/bin/javah"
+
+UTIL:=$(TARGET)/util
+
+OSINFO_CLASS := xerial.larray.impl.OSInfo
+OSINFO_PROG := $(UTIL)/xerial/larray/impl/OSInfo.class
+
+## building OSInfo.java
+osinfo: $(OSINFO_PROG)
+
+$(OSINFO_PROG):
+ -mkdir -p $(@D)
+ $(info compiling OSInfo.java)
+ $(JAVAC) $(SRC)/xerial/larray/impl/OSInfo.java -d $(UTIL)
+
+OS_NAME := $(shell $(JAVA) -cp $(UTIL) $(OSINFO_CLASS) --os)
+OS_ARCH := $(shell $(JAVA) -cp $(UTIL) $(OSINFO_CLASS) --arch)
+
+# Windows uses different path separator-)
+ifeq ($(OS_NAME),Windows)
+ sep := ;
+else
+ sep := :
+endif
+
+
+jni_md := $(shell find -L "$(JAVA_HOME)" -name jni_md.h)
+ifneq ($(jni_md),)
+jni_include := $(shell dirname "$(jni_md)")
+endif
+
+
+# os=Default is meant to be generic unix/linux
+
+known_os_archs := Linux-i386 Linux-amd64 Linux-arm Linux-armhf Mac-i386 Mac-x86_64 Windows-x86 Windows-amd64
+os_arch := $(OS_NAME)-$(OS_ARCH)
+
+ifeq (,$(findstring $(strip $(os_arch)),$(known_os_archs)))
+ os_arch := Default
+endif
+
+# cross-compilation toolchain prefix (e.g. "arm-linux-gnueabi-")
+CROSS_PREFIX :=
+
+Default_CC := $(CROSS_PREFIX)gcc
+Default_STRIP := $(CROSS_PREFIX)strip
+Default_CFLAGS := -I$(JAVA_HOME)/include -Iinclude/inc_mac -O2 -fPIC -fvisibility=hidden
+Default_LINKFLAGS := -shared -static
+Default_LIBNAME := liblarray.so
+
+Linux-i386_CC := $(CROSS_PREFIX)gcc
+Linux-i386_STRIP := $(CROSS_PREFIX)strip
+Linux-i386_CFLAGS := -include include/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden -m32
+Linux-i386_LINKFLAGS := -shared -static-libgcc
+Linux-i386_LIBNAME := liblarray.so
+
+Linux-amd64_CC := $(CROSS_PREFIX)gcc
+Linux-amd64_STRIP := $(CROSS_PREFIX)strip
+Linux-amd64_CFLAGS := -include include/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden -m64
+Linux-amd64_LINKFLAGS := -shared -static-libgcc
+Linux-amd64_LIBNAME := liblarray.so
+
+# '-include lib/inc_linux/jni_md.h' is used to force the use of our version,
+# which defines JNIEXPORT differently; otherwise, since OpenJDK includes
+# jni_md.h in same directory as jni.h, the include path is ignored when
+# jni_md.h is included from jni.h
+
+Linux-arm_C := $(CROSS_PREFIX)gcc
+Linux-arm_STRIP := $(CROSS_PREFIX)strip
+Linux-arm_CFLAGS := -include include/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden -mfloat-abi=softfp
+Linux-arm_LINKFLAGS := -shared -static-libgcc
+Linux-arm_LIBNAME := liblarray.so
+
+Linux-armhf_CC := $(CROSS_PREFIX)gcc
+Linux-armhf_STRIP := $(CROSS_PREFIX)strip
+Linux-armhf_CFLAGS := -include include/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden -mfloat-abi=hard
+Linux-armhf_LINKFLAGS := -shared -static-libgcc
+Linux-armhf_LIBNAME := liblarray.so
+
+Mac-i386_CC := g++ -arch $(OS_ARCH)
+Mac-i386_STRIP := strip -x
+Mac-i386_CFLAGS := -Iinclude/inc_mac -I$(JAVA_HOME)/include -O2 -fPIC -mmacosx-version-min=10.4 -fvisibility=hidden
+Mac-i386_LINKFLAGS := -dynamiclib -static-libgcc
+Mac-i386_LIBNAME := liblarray.jnilib
+
+Mac-x86_64_CC := g++ -arch $(OS_ARCH)
+Mac-x86_64_STRIP := strip -x
+Mac-x86_64_CFLAGS := -Iinclude/inc_mac -I$(JAVA_HOME)/include -O2 -fPIC -mmacosx-version-min=10.5 -fvisibility=hidden
+Mac-x86_64_LINKFLAGS := -dynamiclib -static-libgcc
+Mac-x86_64_LIBNAME := liblarray.jnilib
+
+Windows-x86_CC := $(CROSS_PREFIX)gcc
+Windows-x86_STRIP := $(CROSS_PREFIX)strip
+Windows-x86_CFLAGS := -Iinclude/inc_win -O2
+Windows-x86_LINKFLAGS := -Wl,--kill-at -shared -static
+Windows-x86_LIBNAME := larray.dll
+
+Windows-amd64_CC := $(CROSS_PREFIX)gcc
+Windows-amd64_STRIP := $(CROSS_PREFIX)strip
+Windows-amd64_CFLAGS := -Iinclude/inc_win -O2
+Windows-amd64_LINKFLAGS := -Wl,--kill-at -shared -static
+Windows-amd64_LIBNAME := larray.dll
+
+
+CC := $($(os_arch)_CC)
+STRIP := $($(os_arch)_STRIP)
+CFLAGS := $($(os_arch)_CFLAGS)
+LINKFLAGS := $($(os_arch)_LINKFLAGS)
+LIBNAME := $($(os_arch)_LIBNAME)
+
+
+CFLAGS := $(CFLAGS) -Iinclude
+ifneq ($(jni_include),)
+CFLAGS := $(CFLAGS) -I"$(jni_include)"
+endif
+
View
@@ -1,4 +1,9 @@
-larray
-======
+LArray
+===
+A library for managing large arrays that can hold more than 2G (2^31) entries in Java and Scala.
+
+## Features
+ * 2^31 (2GB) entries is the limitation of the default Java/Scala arrays. LArray uses Long (2^63) type indexes and for example the entire human genome (3GB) data can be stored in LArray.
+ * LArray can be released from the main memory at any time.
+ * The default arrays in Scala(Java) consumes JVM heaps heavily and often causes OutOfMemory error when using large amount of genomic data. LArray uses memory space outside of the default JVM heap, and can be releaseed immedeately.
-Large array library for Java/Scala
Oops, something went wrong.

0 comments on commit 4ff981e

Please sign in to comment.