Code Monkey home page Code Monkey logo

glslang_java's Introduction

glslang_Java

Provides JNI-Bindings and other utilities based on glslang. https://github.com/KhronosGroup/glslang

Commit:

f05c076e26b04cbcc9bf2df815bbdc9c620d89ad

Build

Dependencies

Same as glslang:

  • A C++11 compiler. (For MSVS: 2015 is recommended, 2013 is fully supported/tested, and 2010 support is attempted, but not tested.)
  • [CMake][cmake]: for generating compilation targets.
  • make: Linux, ninja is an alternative, if configured.
  • [Python 3.x][python]: for executing SPIRV-Tools scripts. (Optional if not using SPIRV-Tools and the 'External' subdirectory does not exist.)
  • [bison][bison]: optional, but needed when changing the grammar (glslang.y).
  • [googletest][googletest]: optional, but should use if making any changes to glslang.

Additional Notes:

  • On Windows currently Visual Studio Build Tools are needed. vcvarsall.batmust be visible in shell opened by make. Git Bash or similar might fail on execution. Consider using cmd for calling make in that case.

Build steps

The following steps assume a Bash shell. On Windows, that could be the Git Bash shell or some other shell of your choosing.

1) Build glslang-Libraries

Follow the Build steps at https://github.com/KhronosGroup/glslang. Build dir will be refered to as $GLSLANG_BUILD_DIR

2) Check-Out this project

Location of glslang_Java on your local installation will be referred to as $SOURCE_DIR.

cd <parent of where you want glslang_Java to be>
git clone https://github.com/Destranix/glslang_Java.git

3) Copy lib files

Find glslang lib(.lib/.a/.so) files in $GLSLANG_BUILD_DIR. They should lie under $GLSLANG_BUILD_DIR/install or $GLSLANG_BUILD_DIR/$(pwd)/install. Copy them into $SOURCE_DIR/C/lib.

4) Execute make

cd $SOURCE_DIR/C
make Release

Instead of Release there's another existing target called Debug.

Result should be a dynamic library suitable for your system.

Using JNI

Build jars

The script packJar cann be used to generate Jars packing all necessary classes and native libraries. Simply execute the script in $SOURCE_DIR. The following command-line options are available:

  • -f=[DIR]: Allows to specify the outputfile containing the classes and native libraries. DIRis either an absolute path or relative to current working directory.
  • -s=[DIR]: Allows to specify the outputfile containing the sources. DIRis either an absolute path or relative to current working directory.
  • -no-generate-classes: Causes script not to generate a .jar containing classes and native libraries.
  • -no-generate-sources: Causes script not to generate a .jar containing sources.
  • -no-cleanup: Causes script not to cleanup generated folders and files.

Other

To make use of JNI-Bindings, you'll have to add the path of the generated dynamic library to java.library.path. There are several ways to do that. One is, by extending java.library.pathon java execution. i.e.:

java -cp $SOURCE_DIR -Djava.library.path+=$SOURCE_DIR/C $SOURCE_DIR/Test/Test.java

glslang_java's People

Contributors

destranix avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.