Skip to content

Commit 4b62886

Browse files
committed
re-organize into multiple subprojects
1 parent 9196fb0 commit 4b62886

File tree

17 files changed

+145
-309
lines changed

17 files changed

+145
-309
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,5 @@ of creating our own image for compilation on Linux.
3737
- [ ] Add REPL.it example
3838
- [ ] Add integration documentation on serpapi.com
3939
- [ ] Write a full README to match serpapi-search-results-dotnet
40+
41+
https://rapidjson.org/md_doc_tutorial.html

Rakefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ end
1717

1818
# run application
1919
task :run do
20-
sh('./build/serpapi-cpp')
20+
sh('./build/example/google_example')
21+
sh('./build/oobt/oobt')
2122
end
2223

2324
# tested on AARCH64 and x86

callback.cpp

Lines changed: 0 additions & 16 deletions
This file was deleted.

callback.hpp

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <string>
55
#include <curl/curl.h>
66
#include <serpapi.hpp>
7+
#include <helper.hpp>
78

89
#include "rapidjson/document.h"
910
#include "rapidjson/writer.h"
@@ -14,20 +15,6 @@
1415
using namespace rapidjson;
1516
using namespace std;
1617

17-
void info(string msg) {
18-
cout << "\nINFO: " << msg << endl;
19-
}
20-
void info(double msg) {
21-
cout << "\nINFO: " << msg << endl;
22-
}
23-
24-
void info(const Document& document) {
25-
StringBuffer buffer;
26-
PrettyWriter<StringBuffer> writer(buffer);
27-
document.Accept(writer);
28-
cout << "\nINFO: " << buffer.GetString();
29-
}
30-
3118
// RapidJSON parser documentation is available: https://rapidjson.org
3219
int main()
3320
{

example/helper.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <cstdint>
2+
#include <iostream>
3+
#include <memory>
4+
#include <string>
5+
#include <curl/curl.h>
6+
7+
#include "rapidjson/document.h"
8+
#include "rapidjson/stringbuffer.h"
9+
#include "rapidjson/prettywriter.h"
10+
11+
using namespace std;
12+
using namespace rapidjson;
13+
14+
void info(string msg) {
15+
cout << "\nINFO: " << msg << endl;
16+
}
17+
18+
void info(double msg) {
19+
cout << "\nINFO: " << msg << endl;
20+
}
21+
22+
void info(const Document& document) {
23+
StringBuffer buffer;
24+
PrettyWriter<StringBuffer> writer(buffer);
25+
document.Accept(writer);
26+
cout << "\nINFO: " << buffer.GetString();
27+
}

example/helper.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include <cstdint>
2+
#include <iostream>
3+
#include <memory>
4+
#include <string>
5+
#include <curl/curl.h>
6+
7+
#include "rapidjson/document.h"
8+
9+
void info(string msg);
10+
void info(double msg);
11+
void info(const rapidjson::Document& document);

example/meson.build

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
executable('google_example',
3+
'google_example.cpp',
4+
'helper.cpp',
5+
install : true,
6+
link_with : [libserpapi],
7+
include_directories : incdirs,
8+
dependencies : [
9+
dependency('libcurl'),
10+
dependency('RapidJSON')
11+
]
12+
)

main.cpp

Lines changed: 0 additions & 59 deletions
This file was deleted.

meson.build

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,24 @@ project('serpapi', 'cpp',
22
version : '0.1.0',
33
default_options : ['warning_level=3', 'cpp_std=c++17'])
44

5+
compiler = meson.get_compiler('cpp')
56
add_project_arguments(['-Wno-deprecated-declarations', '-funsigned-char'], language : 'cpp')
67

7-
dep = [
8-
dependency('libcurl'),
9-
dependency('RapidJSON')
10-
]
8+
incdirs = include_directories('src')
119

12-
executable('serpapi-cpp',
13-
'serpapi.cpp',
14-
'callback.cpp',
15-
'main.cpp',
16-
install : true,
17-
dependencies : dep,
18-
)
10+
libserpapi = static_library('serpapi',
11+
[
12+
'src/serpapi.cpp',
13+
'src/callback.cpp'
14+
],
15+
dependencies : [
16+
dependency('libcurl'),
17+
dependency('RapidJSON')
18+
],
19+
include_directories : incdirs)
20+
21+
libserpapi_dep = declare_dependency(include_directories : incdirs, link_with :
22+
libserpapi)
23+
24+
subdir('oobt')
25+
subdir('example')

0 commit comments

Comments
 (0)