Sheldon Neuberger
2018-02-01 05:28:59 UTC
I have a repository with multiple modules that have various
inter-dependencies. These modules contain C++ and Java code. I have them
separated into modules so that consuming projects can take dependencies on
only what they need. Is it possible to setup an android project with cmake
in this way? Here's what I would like:
x/
--CMakeLists.txt
--build.gradle
--java/
----x.java
--cpp/
----x.cpp
----x.hpp
y/
--CMakeLists.txt
--build.gradle
--java/
----y.java
--cpp/
----y.cpp
----y.hpp
in this example, suppose that: x and y are modules; each module builds a
shared library (libx.so and liby.so); and x's cpp code depends on y's cpp
code. So now an android app could depend on y/build.gradle and they would
only get module y, or they could depend on x/build.gradle and they would
get both x and y (because x depends on y).
Given that structure, how would I express x's C++-level dependency on y?
I do have a working example that gets me halfway there, but it has one
super build.gradle:
build.gradle
CMakeLists.txt
x/
--CMakeLists.txt
--java/
----x.java
--cpp/
----x.cpp
----x.hpp
y/
--CMakeLists.txt
--java/
----y.java
--cpp/
----y.cpp
----y.hpp
In this example, the top-level build.gradle sets externalNativeBuild to the
top-level CMakeLists.txt. The top-level CMakeLists.txt calls
add_subdirectory for each module. This builds everything as expected and
allows x's C++ to take a dependency on y, but it requires a consumer to
pull all modules in (via the top-level build.gradle).
inter-dependencies. These modules contain C++ and Java code. I have them
separated into modules so that consuming projects can take dependencies on
only what they need. Is it possible to setup an android project with cmake
in this way? Here's what I would like:
x/
--CMakeLists.txt
--build.gradle
--java/
----x.java
--cpp/
----x.cpp
----x.hpp
y/
--CMakeLists.txt
--build.gradle
--java/
----y.java
--cpp/
----y.cpp
----y.hpp
in this example, suppose that: x and y are modules; each module builds a
shared library (libx.so and liby.so); and x's cpp code depends on y's cpp
code. So now an android app could depend on y/build.gradle and they would
only get module y, or they could depend on x/build.gradle and they would
get both x and y (because x depends on y).
Given that structure, how would I express x's C++-level dependency on y?
I do have a working example that gets me halfway there, but it has one
super build.gradle:
build.gradle
CMakeLists.txt
x/
--CMakeLists.txt
--java/
----x.java
--cpp/
----x.cpp
----x.hpp
y/
--CMakeLists.txt
--java/
----y.java
--cpp/
----y.cpp
----y.hpp
In this example, the top-level build.gradle sets externalNativeBuild to the
top-level CMakeLists.txt. The top-level CMakeLists.txt calls
add_subdirectory for each module. This builds everything as expected and
allows x's C++ to take a dependency on y, but it requires a consumer to
pull all modules in (via the top-level build.gradle).
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk+***@googlegroups.com.
To post to this group, send email to android-***@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/cd0c567d-6bca-4861-be32-e5288ee70fda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk+***@googlegroups.com.
To post to this group, send email to android-***@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/cd0c567d-6bca-4861-be32-e5288ee70fda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.