Selaa lähdekoodia

Automake: fix the build for Android

Do not link with hidapi* but link with libandroid.
Set the DRIVER_ANDROID preprocessor variable and the link flags for the
driver.
Adrien Maglo 7 vuotta sitten
vanhempi
commit
c2210743fe
3 muutettua tiedostoa jossa 11 lisäystä ja 1 poistoa
  1. 7 0
      configure.ac
  2. 1 1
      pkg-config/openhmd.pc.in
  3. 3 0
      src/Makefile.am

+ 7 - 0
configure.ac

@@ -20,16 +20,23 @@ PKG_PROG_PKG_CONFIG([0.24])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
 hidapi="hidapi"
+deps_ld_flags="-lhidapi"
 AC_SUBST(hidapi)
+AC_SUBST(deps_ld_flags)
 
 AC_SUBST(PKG_CONFIG_EXTRA_PATH, "")
 AC_SUBST(EXTRA_LD_FLAGS, "")
 
 AC_MSG_CHECKING([operating system])
 AS_CASE(["$host"],
+	[*-androideabi],
+		[hidapi=""
+		deps_ld_flags="-landroid"
+		AC_SUBST(EXTRA_LD_FLAGS, "-lm")],
 	[*-linux*],
 		[AC_MSG_RESULT([$host (Linux)])
 		hidapi="hidapi-libusb"
+		deps_ld_flags="-lhidapi-libusb"
 
 		#link with realtime lib on linux for clock_gettime, and libm for math functions such as sincosf
 		AC_SUBST(EXTRA_LD_FLAGS, "-lrt -lpthread -lm")],

+ 1 - 1
pkg-config/openhmd.pc.in

@@ -7,5 +7,5 @@ Description: API and drivers for immersive technology devices such as HMDs
 Version: 0.3.0
 Requires: @hidapi@
 Conflicts:
-Libs: -L${libdir} -lopenhmd -l@hidapi@
+Libs: -L${libdir} -lopenhmd @deps_ld_flags@
 Cflags: -I${includedir}

+ 3 - 0
src/Makefile.am

@@ -92,6 +92,9 @@ if BUILD_DRIVER_ANDROID
 
 libopenhmd_la_SOURCES += \
 	drv_android/android.c
+
+libopenhmd_la_CPPFLAGS += -DDRIVER_ANDROID
+libopenhmd_la_LDFLAGS += -landroid
 endif
 
 libopenhmd_la_LDFLAGS += $(EXTRA_LD_FLAGS)