java: added auto build java examples in cmake

Signed-off-by: Stefan Andritoiu <stefan.andritoiu@intel.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
Stefan Andritoiu
2015-12-11 19:44:04 +02:00
committed by Mihai Tudor Panu
parent 8273556539
commit 9516e0720c
5 changed files with 121 additions and 6 deletions

View File

@ -40,4 +40,4 @@ public class A110XSample {
}
//! [Interesting]
}
}
}

View File

@ -0,0 +1,112 @@
find_package(Java REQUIRED)
include(UseJava)
macro(add_example example_name jar_name)
set(example_src "${example_name}.java")
set(example_jar "${PROJECT_SOURCE_DIR}/build/src/${jar_name}/upm_${jar_name}.jar")
add_jar(${example_name} SOURCES ${example_src} INCLUDE_JARS ${example_jar})
endmacro()
macro(add_example_with_path example_name jar_path)
set(example_src "${example_name}.java")
set(example_jar "${PROJECT_SOURCE_DIR}/build/src/${jar_path}")
add_jar(${example_name} SOURCES ${example_src} INCLUDE_JARS ${example_jar})
endmacro()
add_example(A110X_intrSample a110x)
add_example(A110XSample a110x)
add_example(ADC121C021Sample adc121c021)
add_example(Adxl345Sample adxl345)
add_example(Apds9002 apds9002)
add_example(BISS0001Sample biss0001)
add_example(BMPX8XSample bmpx8x)
add_example(BuzzerSample buzzer)
add_example(Buzzer_soundSample buzzer)
add_example(CJQ4435Sample cjq4435)
add_example(DS1307Sample ds1307)
add_example(ENC03RSample enc03r)
add_example(ES08ASample servo)
add_example(GroveButtonSample grove)
add_example(GroveCollision grovecollision)
add_example(GroveEHRSample groveehr)
add_example(GroveEmg groveemg)
add_example(GroveGsr grovegsr)
add_example(GroveLed_multiSample grove)
add_example(GroveLEDSample grove)
add_example(GroveLightSample grove)
add_example(GroveLineFinderSample grovelinefinder)
add_example(GroveMDSample grovemd)
add_example(GroveMoistureSample grovemoisture)
add_example(GroveMQ3 gas)
add_example(GroveMQ9 gas)
add_example(GroveO2Example groveo2)
add_example(GroveQTouch at42qt1070)
add_example(GroveRelaySample grove)
add_example(GroveRotarySample grove)
add_example(GROVESCAMSample grovescam)
add_example(GroveSlideSample grove)
add_example(GroveSpeakerSample grovespeaker)
add_example(GroveTempSample grove)
add_example(GroveVDivSample grovevdiv)
add_example(GroveWaterSample grovewater)
add_example(GroveWFSSample grovewfs)
add_example(GUVAS12DSample guvas12d)
add_example(H3LIS331DLSample h3lis331dl)
add_example(HCSR04Sample hcsr04)
add_example(HM11Sample hm11)
add_example(Hmc5883lSample hmc5883l)
add_example(HMTRPSample hmtrp)
add_example(HP20xExample hp20x)
add_example(HTU21DSample htu21d)
add_example(Itg3200Sample itg3200)
add_example(Joystick12_exampleSample joystick12)
add_example(LDT0028Sample ldt0028)
add_example(LoL_exampleSample lol)
add_example(LSM303Sample lsm303)
add_example(M24LR64ESample m24lr64e)
add_example(MAX44000Sample max44000)
add_example(MHZ16Sample mhz16)
add_example(MicrophoneSample mic)
add_example(MMA7455Sample mma7455)
add_example(MMA7660Sample mma7660)
add_example(MPL3115A2Sample mpl3115a2)
add_example(MPR121Sample mpr121)
add_example(MPU9150Sample mpu9150)
add_example(MQ2Sample gas)
add_example(MQ303ASample mq303a)
add_example(MQ5Sample gas)
add_example(MY9221_ledbarSample my9221)
add_example(MY9221Sample my9221)
add_example(NRF24L01_receiverSample nrf24l01)
add_example(NRF24L01_transmitterSample nrf24l01)
add_example(NUNCHUCKSample nunchuck)
add_example(OTP538USample otp538u)
add_example(PPD42NSSample ppd42ns)
add_example(PulsensorSample pulsensor)
add_example(RFR359FSample rfr359f)
add_example(RotaryEncoderSample rotaryencoder)
add_example(RPR220_intrSample rpr220)
add_example(RPR220Sample rpr220)
add_example(ST7735Sample st7735)
add_example(StepMotorSample stepmotor)
add_example(TM1637Sample tm1637)
add_example(TP401Sample gas)
add_example(TSL2561Sample tsl2561)
add_example(TTP223Sample ttp223)
add_example(Ublox6Sample ublox6)
add_example(ULN200XASample uln200xa)
add_example(WaterLevelSensor waterlevel)
add_example(WT5001Sample wt5001)
add_example(YG1006Sample yg1006)
add_example(ZFM20Sample zfm20)
add_example_with_path(Jhd1313m1_lcdSample lcd/upm_i2clcd.jar)
add_example_with_path(Jhd1313m1Sample lcd/upm_i2clcd.jar)
add_example_with_path(Lcm1602_i2cSample lcd/upm_i2clcd.jar)
add_example_with_path(Lcm1602_parallelSample lcd/upm_i2clcd.jar)
add_example_with_path(SSD1308_oledSample lcd/upm_i2clcd.jar)
add_example_with_path(SSD1327_oledSample lcd/upm_i2clcd.jar)

View File

@ -27,13 +27,12 @@ import upm_grovecollision.*;
public class GroveCollision {
public static void main(String[] args) {
// TODO Auto-generated method stub
// Initializing the sensor on D2 on the Base Shield
upm_grovecollision.GroveCollision collision = new upm_grovecollision.GroveCollision(2);
boolean collisionState = false;
// ! [Interesting]
while(shouldRun){
while(true){
if(collision.isColliding() && !collisionState){
System.out.println("Collision!!");
collisionState = true;
@ -44,7 +43,6 @@ public class GroveCollision {
}
}
// ! [Interesting]
System.out.println("Exiting");
}
}

View File

@ -38,7 +38,7 @@ public class Lcm1602_parallelSample {
// 10K trimmer potentiometer:
// ends to +5V and ground
// wiper to LCD VO pin (pin 3)
upm_i2clcd.Lcm1602 lcd = new upm_i2clcd.Lcm1602(8, 13, 2, 3, 4, 5, 20, 2);
upm_i2clcd.Lcm1602 lcd = new upm_i2clcd.Lcm1602((short) 8, (short) 13, (short) 2, (short) 3, (short) 4, (short) 5, (short) 20, (short) 2);
lcd.setCursor(0, 0);
lcd.write("Hello World");
@ -49,4 +49,4 @@ public class Lcm1602_parallelSample {
Thread.sleep(5000);
// ! [Interesting]
}
}
}