Merge 8db0819860417f608153d9f63d0cf8778f83c11f into 83f541a5db8747b1d2a7c019655071b2f4c7aa9e

This commit is contained in:
Noel Eck 2018-03-19 20:26:53 +00:00 committed by GitHub
commit 712a4f0fff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 49 additions and 0 deletions

View File

@ -75,6 +75,8 @@ jobs:
- docker-compose run ${TARGET}
- <<: *run-additional-jobs
env: TARGET=android
- <<: *run-additional-jobs
env: TARGET=cordova
- <<: *run-additional-jobs
env: TARGET=examples
- <<: *run-additional-jobs

View File

@ -8,6 +8,7 @@ option (BUILDFTI "Build Funtion Table Interface (FTI) in C sensor libraries" OFF
option (BUILDSWIGPYTHON "Build swig python modules" ON)
option (BUILDSWIGNODE "Build swig node modules" ON)
option (BUILDSWIGJAVA "Build swig java modules" OFF)
option (BUILDCORDOVA "Build cordova bindings" OFF)
option (BUILDEXAMPLES "Build C/C++/JAVA examples" OFF)
option (IPK "Generate IPK using CPack" OFF)
option (RPM "Generate RPM using CPack" OFF)
@ -169,6 +170,17 @@ if (BUILDSWIGJAVA)
find_library(MRAAJAVA_LIBRARY NAMES mraajava HINTS ${MRAA_LIBDIR})
endif (BUILDSWIGJAVA)
# Cordova binding
if (BUILDCORDOVA)
if (NOT BUILDSWIGJAVA)
message(FATAL_ERROR "Cordova bindings require JAVA packages, please enable BUILDSWIGJAVA (-DBUILDSWIGJAVA=on).")
endif()
find_package (Node REQUIRED)
find_package (Npm REQUIRED)
find_package (UpmCordovaGenerator REQUIRED)
endif (BUILDCORDOVA)
# Find swig if any wrapper is enabled
if (BUILDSWIGPYTHON OR BUILDSWIGNODE OR BUILDSWIGJAVA)
find_package (SWIG 3.0.5 REQUIRED)

View File

@ -0,0 +1,8 @@
find_program(UPM_CORDOVA_BINDING NAMES upm-cordova-binding
)
if(UPM_CORDOVA_BINDING)
message(STATUS "The npm package to build cordova bindings found at ${UPM_CORDOVA_BINDING}")
else()
message(FATAL_ERROR "Unable to find the npm package for building cordova bindings, please install by 'npm install -g upm-cordova-binding'")
endif()

View File

@ -13,6 +13,7 @@ services:
- BUILDFTI=${BUILDFTI:-ON}
- BUILDSWIGPYTHON=${BUILDSWIGPYTHON:-OFF}
- BUILDSWIGJAVA=${BUILDSWIGJAVA:-OFF}
- BUILDCORDOVA=${BUILDCORDOVA:-OFF}
- BUILDSWIGNODE=${BUILDSWIGNODE:-OFF}
- BUILDEXAMPLES=${BUILDEXAMPLES:-OFF}
- IPK=${IPK:-OFF}
@ -113,6 +114,13 @@ services:
- BUILDTESTS=OFF
command: bash -c "./scripts/build-android.sh"
cordova:
extends: all
environment:
- BUILDSWIGJAVA=ON
- BUILDCORDOVA=ON
command: bash -c "./scripts/run-cmake.sh && cd build && make -j8 && make -j8"
node4:
extends: base
image: inteliotdevkit/upm-node4

View File

@ -12,6 +12,7 @@ cmake \
-DBUILDSWIGPYTHON=$BUILDSWIGPYTHON \
-DBUILDSWIGNODE=$BUILDSWIGNODE \
-DBUILDSWIGJAVA=$BUILDSWIGJAVA \
-DBUILDCORDOVA=$BUILDCORDOVA \
-DBUILDEXAMPLES=$BUILDEXAMPLES \
-DIPK=$IPK \
-DRPM=$RPM \

View File

@ -668,6 +668,17 @@ if (BUILDSWIGNODE)
endmacro(createpackagejson)
endif(BUILDSWIGNODE)
# Cordova binding
if (BUILDCORDOVA)
add_custom_target(cordova_binding ALL
COMMAND upm-cordova-binding ${CMAKE_BINARY_DIR}/src ${CMAKE_BINARY_DIR}/cordova ${VERSION}
COMMENT "Building cordova bindings based on swig java modules")
install(DIRECTORY ${CMAKE_BINARY_DIR}/cordova
DESTINATION ${CMAKE_INSTALL_PREFIX}
COMPONENT ${CMAKE_PROJECT_NAME}-cordova)
endif (BUILDCORDOVA)
# Process C/C++ sensor modules
# This function pre-processes sensor library input and hands off the
# necessary global variables to upm_module_init for library creation,
@ -821,6 +832,13 @@ function(upm_module_init)
endif (BUILDSWIGJAVA)
endif (NOT IS_C_LIBRARY)
# Skip if the libname is in the blacklist
if (BUILDCORDOVA)
if (NOT IS_C_LIBRARY AND NOT ";${JAVASWIG_BLACKLIST};" MATCHES ";${libname};")
add_dependencies(cordova_binding javaupm_${libname})
endif()
endif (BUILDCORDOVA)
# Add additional properties to this target (used later for .pc/pom file creation)
set_target_properties(${libname} PROPERTIES PKG_CONFIG_NAME "${libprefix}${basename}")
set_target_properties(${libname} PROPERTIES PKG_CONFIG_DESCRIPTION "${libdescription}")