Skip to content

Commit 77e69f8

Browse files
committed
Merge remote-tracking branch 'origin/fix/linux-compilation' into main
2 parents 8d50346 + 001ef33 commit 77e69f8

File tree

7 files changed

+21
-12
lines changed

7 files changed

+21
-12
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,9 @@
3030
*.exe
3131
*.out
3232
*.app
33+
34+
# Build
35+
build
36+
37+
# Editor
38+
.vscode

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,25 @@ all: build run
77

88
# initialize meson build
99
init:
10-
-rm -rf build/
10+
rm -rf build/
1111
meson setup build
1212

1313
# build application
1414
build:
1515
meson compile -C build -v
16+
cd build && ninja
1617

1718
# run application
1819
run:
1920
./build/serpapi-search-cpp
2021

2122
# tested on AARCH64 and x86
2223
install_linux:
23-
sudo apt-get install -f libcurl4-openssl-dev libjsoncpp-dev
24-
brew curl jsoncpp
24+
sudo apt update -y && sudo apt install -f -y build-essential meson pkg-config curl cmake meson ninja-build libcurl4-openssl-dev rapidjson-dev
2525

2626
# tested on Apple M1 aarch64
2727
install_apple:
2828
brew install meson pkg-config curl cmake meson ninja rapidjson
29+
30+
# reset build directory
31+
reset: init

Rakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ task :default do
77
'googlesearch.hpp',
88
]
99
source = 'google'
10-
names = %w(bing baidu homedepot yahoo yandex wallmart youtube linkedin)
10+
names = %w(bing baidu homedepot yahoo yandex walmart youtube linkedin)
1111
names.each do |name|
1212
files.each do |fn|
1313
buf = File.read(fn)
@@ -27,4 +27,4 @@ task :default do
2727
names.each do |name|
2828
puts "serpapi::#{name.capitalize}Search search(parameter, apiKey);"
2929
end
30-
end
30+
end

main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ int main()
4343
std::map<string, string> parameter;
4444
parameter["q"] = "coffee";
4545
parameter["location"] = "Austin,TX";
46-
char* env_p = std::getenv("API_KEY");
46+
const char* env_p = std::getenv("API_KEY");
4747
std::string apiKey(env_p);
4848
std::string engine = "google";
4949

meson.build

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
project('serpapi-search-cpp', 'cpp',
22
version : '0.1',
3-
default_options : ['warning_level=3', 'cpp_std=c++14'])
3+
default_options : ['warning_level=3', 'cpp_std=c++17'])
44

55
dep = [
6-
dependency('curl'),
7-
dependency('rapidjson')
6+
dependency('libcurl'),
7+
dependency('RapidJSON')
88
]
99

1010
executable('serpapi-search-cpp',

serpapisearch.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ string SerpApiSearch::GetHtml()
7272
return getRawResult("/search", GetParameter(false));
7373
}
7474

75-
string SerpApiSearch::getRawResult(string uri, string parameter)
75+
string SerpApiSearch::getRawResult(string uri, string parameter)
7676
{
7777
curl_global_init(CURL_GLOBAL_DEFAULT);
7878
curl = curl_easy_init();
@@ -121,4 +121,4 @@ Document SerpApiSearch::GetSearchArchive(string searchID)
121121
{
122122
return SerpApiSearch::getJsonResult("/searches/" + searchID + ".json", SerpApiSearch::GetParameter(true));
123123
};
124-
};
124+
};

serpapisearch.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ class SerpApiSearch {
5151
};
5252
}
5353

54-
#endif
54+
#endif

0 commit comments

Comments
 (0)