LibusbJava

libusb for Java

User Tools

Site Tools


building:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
building:start [2022/06/17 16:17] – [Building] ursgrafbuilding:start [2022/06/30 13:52] – [C++ Code] ursgraf
Line 1: Line 1:
 ====== Building ====== ====== Building ======
-The dll (from C sources) and jar-file (from java sources) must be built separately.  +The dll (from C sources) and jar-file (from java sources) must be built separately. Checkout from [[https://gitlab.ost.ch/tech/inf/public/libusb-java]]. More detailed information for the maintainers can be reached under [[https://wiki.bu.ost.ch/inf/libusbjava/start]] (for internal usage only).
-===== Java Part ===== +
-Checkout from [[https://gitlab.ost.ch/tech/inf/public/libusb-java]]. +
  
-In Eclipse with Plugin Development capability: +===== C++ Code ===== 
-  * File -> Import -> Existing Projects into Workspace +Source code is under /LibusbJava_C.
-  * Browse -> LibusbJava_Java +
-  * Finish +
-  * Export -> jar file+
  
-Falls Änderungen an Libusb.java gemacht wurden, muss das Headerfile für die libusbJava_C Bibliothek neu erstellt werden. 
-  * Project -> Build All 
-Konsole öffnen und zum bin-Ordner im aktuellen Java Workspace wechseln. 
-Unter Windows folgenden command ausführen: 
-<code> 
-"Pfad zu aktuellem JDK\bin\javah.exe" ch.ntb.inf.libusb.Libusb 
-</code> 
-Für Linux: 
-<code> 
-$javah ch.ntb.inf.libusb.Libusb 
-</code> 
- 
-Anmerkung: javah wurde bei neuern JDKs durch ''javac -h'' ersetzt. Es ist darauf zu achten, dass javac den PFad zur ''.java'' Datei und nicht den class name. Dementsprechend muss dieser Befehl auch im ''src'' und nicht im ''bin'' Ordner ausgeführt werden. 
-<code> 
-javac -h . ch\ntb\inf\libusb\Libusb.java 
-</code> 
- 
-Das generierte Headerfile nun nach LibusbJava_C kopieren kopieren. 
- 
-===== C++ Code ===== 
-  * Eclipse C starten 
-  * File -> Import -> Existing Projects into Workspace 
-  * Browse -> LibusbJava_C 
-  * Finish 
 ==== Windows ==== ==== Windows ====
-MinGW installieren: +  * install MinGW or similar 
-[[https://sourceforge.net/projects/mingw-w64/|MinGW Sourceforge]]\\ +  * use cmake to build the project
-  * Architektur auswählen +
-  * für Threads "Win32" auswählen +
-  * next +
-  * installieren und finish+
  
-CMake:\\ 
-  * cmake gui starten 
-  * Bei source code Pfad zu LibusbJava_C eintragen 
-  * Bei build the binaries: Pfad zu ./build (32 oder 64) 
-  * Configure -> MinGW Makefile auswählen und bestätigen 
-  * Configure 
-  * Generate 
  
  
-Rechtsklick auf Projekt: +==== Linux ==== 
-  * Properties -C/C++ Build -> Settings +  * <code>g++ -shared -o libLibusbJava-"VERSION".so -fPIC LibusbJava.cpp -I"/usr/lib/jvm/java-"JAVA-VERSION"-openjdk-"ARCHITECTURE"/include" -I"/usr/lib/jvm/java-"JAVA-VERSION"-openjdk-"ARCHITECTURE"/include/linux" -I"./-std=c++0x</code
-  * Unter GCC C++ Compiler -> Includes -> Include Paths -> Add +  * Copy so-file to /usr/lib
-     * <file>C:\Program Files\Java\jdk1.x.x_xxx\include</file> +
-     * <file>C:\Program Files\Java\jdk1.x.x_xxx\include\win32</file> +
-  * Unter MinGW C++ Linker -> Libraries +
-     * Libraries -> Add  +
-        * <code>libusb-1.0</code> +
-     * Library search path -> Add  +
-        * <code>${workspace_loc:/${ProjName}/libusb/x64/dll}</code> +
-  * Änderungen am Code vornehmen +
-  * Rechtsklick auf Projekt -> Build Project +
-  * Alternativ: mit der Konsole zum Ordner -> libusbJava_C/build64 wechseln +
-     * <file>C:\Program Files\minGW_w64\x86_64-VERSION\mingw64\bin\mingw32-make.exe"</file> +
-     * Je nach Kompiler könnte es beim Cast von bool zu jboolean Probleme geben +
-  * Erstellte .dll kopieren nach <file>c:\Windows\System32</file>+
  
- +===== Java Part ===== 
-==== Linux ==== +  * Checkout from [[https://gitlab.ost.ch/tech/inf/public/libusb-java]].  
-  * Änderungen machen +  * Create jar file from LibusbJava_Java 
-  * Bash zu LibusbJava_C Ordner +  * If changes were made in //Libusb.java// -> remake header file for LibusbJava_C with <code> 
-  * <code>g++ -shared -o libLibusbJava-"VERSION".so -fPIC LibusbJava.cpp -I"/usr/lib/jvm/java-"JAVA-VERSION"-openjdk-"ARCHITECTURE"/include" -I"/usr/lib/jvm/java-"JAVA-VERSION"-openjdk-"ARCHITECTURE"/include/linux" -I"./" -std)c++0x</code> +$javah ch.ntb.inf.libusb.Libusb 
-  * Erstellte .so nach /usr/lib kopieren (oder symlink)+</code>Copy new header file to LibusbJava_C.
  
  
building/start.txt · Last modified: 2022/06/30 13:53 by ursgraf