Built and linked nlohmann::json package

This commit is contained in:
kdeng00
2019-09-29 22:02:06 -04:00
parent 356f75d0c5
commit eb749a7b37
11 changed files with 215 additions and 56 deletions
+1
Submodule app/src/main/cpp/3rdparty/json added at 99d7518d21
+8 -1
View File
@@ -15,6 +15,11 @@ set (HEADERS
model/Song.h
)
set(JSON_BuildTests OFF CACHE INTERNAL "")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/json)
add_library( # Sets the name of the library.
native-lib
@@ -47,7 +52,9 @@ find_library( # Sets the name of the path variable.
target_link_libraries( # Specifies the target library.
native-lib
PRIVATE nlohmann_json::nlohmann_json
# Links the target library to the log library
# included in the NDK.
${log-lib} )
${log-lib}
)
+45 -2
View File
@@ -15,17 +15,50 @@
#include <android/sharedmem.h>
#include <sys/mman.h>
#include "nlohmann/json.hpp"
#include "model/Song.h"
int demoCall()
model::Song initSong();
int demoCall();
void printSong(const model::Song&);
model::Song initSong()
{
model::Song song;
song.title = "hello";
song.artist = "some artist";
return song;
}
int demoCall()
{
model::Song song = initSong();
std::cout << "testing" << std::endl;
printSong(song);
return 0;
}
void printSong(const model::Song& song)
{
std::cout << "\nsong information" << std::endl;
std::cout << "title: " << song.title << std::endl;
std::cout << "artist: " << song.artist << std::endl;
std::cout << "album: " << song.album << std::endl;
std::cout << "genre: " << song.genre << std::endl;
std::cout << "year: " << song.year << std::endl;
}
extern "C"
JNIEXPORT void
JNICALL
@@ -34,4 +67,14 @@ Java_com_example_mear_activities_MainActivity_test(
jobject /* this */) {
demoCall();
}
}
extern "C"
JNIEXPORT void
JNICALL
Java_com_example_mear_activities_DemoStreamActivity_test(
JNIEnv *env,
jobject /* this */) {
demoCall();
}