Skip to content

Commit b419ac3

Browse files
authored
Merge pull request #49 from BianchTech/refactor_cpp
Refactor cpp
2 parents 787c737 + e48db9f commit b419ac3

File tree

311 files changed

+34263
-1189
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

311 files changed

+34263
-1189
lines changed

.github/workflows/cmake-multi-platform.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
./tests/unit-tests/LibUnitTests --gtest_output=xml:./test-report.xml
4545
4646
- name: Upload Test Report
47-
uses: actions/upload-artifact@v3
47+
uses: actions/upload-artifact@v4
4848
with:
4949
name: gtest-report
5050
path: build/test-report.xml

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set(CMAKE_CXX_STANDARD 20)
55

66
project(search_engine VERSION 1.0)
77

8-
add_subdirectory(lib)
8+
add_subdirectory(search_engine_cpp/lib)
99

1010
option(BUILD_TESTS "Build and enable tests" ON)
1111

Examples/cpp_examples/CMakeLists.txt

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
cmake_minimum_required(VERSION 3.10)
2+
project(TestSearchEngineCpp)
3+
4+
set(CMAKE_CXX_STANDARD 17)
5+
6+
# Library directory
7+
# Set here your env path to search_engine_cpp/lib
8+
set(LIB_DIR "/home/pedro/projects/teste_search_engine/env/lib/python3.12/site-packages/search_engine_cpp/lib")
9+
10+
# Header directory (change to the correct path if necessary)
11+
# Set here your env path to search_engine_cpp/lib/include
12+
set(INCLUDE_DIR "/home/pedro/projects/teste_search_engine/env/lib/python3.12/site-packages/search_engine_cpp/lib/include")
13+
14+
# Include headers
15+
include_directories(${INCLUDE_DIR})
16+
17+
# Add the main executable
18+
add_executable(main_test main.cpp)
19+
20+
# Add the shared library
21+
add_library(search_engine SHARED IMPORTED)
22+
set_target_properties(search_engine PROPERTIES IMPORTED_LOCATION ${LIB_DIR}/libsearch_engine.so)
23+
24+
# Link the library to the executable
25+
target_link_libraries(main_test PRIVATE search_engine)

Examples/cpp_examples/main.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <hello.h>
2+
3+
int main(int argc, char const* argv[]) {
4+
auto hello = Hello();
5+
std::cout << hello.greet("Pedro") << std::endl;
6+
return 0;
7+
}

build.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def build_lib_cpp(path: str):
3333
def copy_lib(root_path, path_lib):
3434
extensions = [".so*", ".dll*", ".dylib*"]
3535
for ext in extensions:
36-
path_so = root_path.glob(f"{BUILD_FOLDER}/lib/*{ext}")
36+
path_so = root_path.glob(f"{BUILD_FOLDER}/search_engine_cpp/lib/*{ext}")
3737
path_lib.mkdir(exist_ok=True, parents=True)
3838
# Copy each .so file
3939
for lib in path_so:
@@ -68,9 +68,9 @@ def build(setup_kwargs):
6868
f"search_engine_cpp.{lib}",
6969
language="c++",
7070
sources=[
71-
f"lib/src/{lib_pyx}.pyx"
71+
f"search_engine_cpp/lib/src/{lib_pyx}.pyx"
7272
],
73-
include_dirs=["lib/include"],
73+
include_dirs=["search_engine_cpp/lib/include"],
7474
library_dirs=[library_dir],
7575
runtime_library_dirs=[library_dir],
7676
libraries=["search_engine"],

docs/html/__hello_8cpp.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
66
<meta name="generator" content="Doxygen 1.9.8"/>
77
<meta name="viewport" content="width=device-width, initial-scale=1"/>
8-
<title>Search Engine: lib/src/_hello.cpp File Reference</title>
8+
<title>Search Engine: search_engine_cpp/lib/src/_hello.cpp File Reference</title>
99
<link href="tabs.css" rel="stylesheet" type="text/css"/>
1010
<script type="text/javascript" src="jquery.js"></script>
1111
<script type="text/javascript" src="dynsections.js"></script>
@@ -100,8 +100,8 @@
100100
</div><div class="textblock"><div class="dynheader">
101101
Include dependency graph for _hello.cpp:</div>
102102
<div class="dyncontent">
103-
<div class="center"><img src="__hello_8cpp__incl.png" border="0" usemap="#alib_2src_2__hello_8cpp" alt=""/></div>
104-
<map name="alib_2src_2__hello_8cpp" id="alib_2src_2__hello_8cpp">
103+
<div class="center"><img src="__hello_8cpp__incl.png" border="0" usemap="#asearch__engine__cpp_2lib_2src_2__hello_8cpp" alt=""/></div>
104+
<map name="asearch__engine__cpp_2lib_2src_2__hello_8cpp" id="asearch__engine__cpp_2lib_2src_2__hello_8cpp">
105105
<area shape="rect" title=" " alt="" coords="5,5,125,31"/>
106106
<area shape="rect" title=" " alt="" coords="28,79,103,104"/>
107107
<area shape="poly" title=" " alt="" coords="68,31,68,65,63,65,63,31"/>
@@ -133,7 +133,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#ac9efdaac9411d0868b715edc
133133
<!-- start footer part -->
134134
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
135135
<ul>
136-
<li class="navelem"><a class="el" href="dir_97aefd0d527b934f1d99a682da8fe6a9.html">lib</a></li><li class="navelem"><a class="el" href="dir_a065c5f60305fee3569f887679366939.html">src</a></li><li class="navelem"><a class="el" href="__hello_8cpp.html">_hello.cpp</a></li>
136+
<li class="navelem"><a class="el" href="dir_b4f24b687d3039d1f6957e629435aa8b.html">search_engine_cpp</a></li><li class="navelem"><a class="el" href="dir_25511d843faa0c1e21bb03403209d707.html">lib</a></li><li class="navelem"><a class="el" href="dir_1c56e417f4fa2c5924f6908ea89055d7.html">src</a></li><li class="navelem"><a class="el" href="__hello_8cpp.html">_hello.cpp</a></li>
137137
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8 </li>
138138
</ul>
139139
</div>

docs/html/__hello_8cpp__incl.dot

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
digraph "search_engine_cpp/lib/src/_hello.cpp"
2+
{
3+
// LATEX_PDF_SIZE
4+
bgcolor="transparent";
5+
edge [fontname=Helvetica,fontsize=10,labelfontname=Helvetica,labelfontsize=10];
6+
node [fontname=Helvetica,fontsize=10,shape=box,height=0.2,width=0.4];
7+
Node1 [id="Node000001",label="search_engine_cpp/lib\l/src/_hello.cpp",height=0.2,width=0.4,color="gray40", fillcolor="grey60", style="filled", fontcolor="black",tooltip=" "];
8+
Node1 -> Node2 [id="edge1_Node000001_Node000002",color="steelblue1",style="solid",tooltip=" "];
9+
Node2 [id="Node000002",label="Python.h",height=0.2,width=0.4,color="grey60", fillcolor="#E0E0E0", style="filled",tooltip=" "];
10+
}

docs/html/__inverted__index_8cpp.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
66
<meta name="generator" content="Doxygen 1.9.8"/>
77
<meta name="viewport" content="width=device-width, initial-scale=1"/>
8-
<title>Search Engine: lib/src/_inverted_index.cpp File Reference</title>
8+
<title>Search Engine: search_engine_cpp/lib/src/_inverted_index.cpp File Reference</title>
99
<link href="tabs.css" rel="stylesheet" type="text/css"/>
1010
<script type="text/javascript" src="jquery.js"></script>
1111
<script type="text/javascript" src="dynsections.js"></script>
@@ -100,8 +100,8 @@
100100
</div><div class="textblock"><div class="dynheader">
101101
Include dependency graph for _inverted_index.cpp:</div>
102102
<div class="dyncontent">
103-
<div class="center"><img src="__inverted__index_8cpp__incl.png" border="0" usemap="#alib_2src_2__inverted__index_8cpp" alt=""/></div>
104-
<map name="alib_2src_2__inverted__index_8cpp" id="alib_2src_2__inverted__index_8cpp">
103+
<div class="center"><img src="__inverted__index_8cpp__incl.png" border="0" usemap="#asearch__engine__cpp_2lib_2src_2__inverted__index_8cpp" alt=""/></div>
104+
<map name="asearch__engine__cpp_2lib_2src_2__inverted__index_8cpp" id="asearch__engine__cpp_2lib_2src_2__inverted__index_8cpp">
105105
<area shape="rect" title=" " alt="" coords="5,5,183,31"/>
106106
<area shape="rect" title=" " alt="" coords="57,79,131,104"/>
107107
<area shape="poly" title=" " alt="" coords="97,31,97,65,91,65,91,31"/>
@@ -133,7 +133,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#ac9efdaac9411d0868b715edc
133133
<!-- start footer part -->
134134
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
135135
<ul>
136-
<li class="navelem"><a class="el" href="dir_97aefd0d527b934f1d99a682da8fe6a9.html">lib</a></li><li class="navelem"><a class="el" href="dir_a065c5f60305fee3569f887679366939.html">src</a></li><li class="navelem"><a class="el" href="__inverted__index_8cpp.html">_inverted_index.cpp</a></li>
136+
<li class="navelem"><a class="el" href="dir_b4f24b687d3039d1f6957e629435aa8b.html">search_engine_cpp</a></li><li class="navelem"><a class="el" href="dir_25511d843faa0c1e21bb03403209d707.html">lib</a></li><li class="navelem"><a class="el" href="dir_1c56e417f4fa2c5924f6908ea89055d7.html">src</a></li><li class="navelem"><a class="el" href="__inverted__index_8cpp.html">_inverted_index.cpp</a></li>
137137
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8 </li>
138138
</ul>
139139
</div>
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
digraph "search_engine_cpp/lib/src/_inverted_index.cpp"
2+
{
3+
// LATEX_PDF_SIZE
4+
bgcolor="transparent";
5+
edge [fontname=Helvetica,fontsize=10,labelfontname=Helvetica,labelfontsize=10];
6+
node [fontname=Helvetica,fontsize=10,shape=box,height=0.2,width=0.4];
7+
Node1 [id="Node000001",label="search_engine_cpp/lib\l/src/_inverted_index.cpp",height=0.2,width=0.4,color="gray40", fillcolor="grey60", style="filled", fontcolor="black",tooltip=" "];
8+
Node1 -> Node2 [id="edge1_Node000001_Node000002",color="steelblue1",style="solid",tooltip=" "];
9+
Node2 [id="Node000002",label="Python.h",height=0.2,width=0.4,color="grey60", fillcolor="#E0E0E0", style="filled",tooltip=" "];
10+
}

docs/html/__page__rank_8cpp.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
66
<meta name="generator" content="Doxygen 1.9.8"/>
77
<meta name="viewport" content="width=device-width, initial-scale=1"/>
8-
<title>Search Engine: lib/src/_page_rank.cpp File Reference</title>
8+
<title>Search Engine: search_engine_cpp/lib/src/_page_rank.cpp File Reference</title>
99
<link href="tabs.css" rel="stylesheet" type="text/css"/>
1010
<script type="text/javascript" src="jquery.js"></script>
1111
<script type="text/javascript" src="dynsections.js"></script>
@@ -100,8 +100,8 @@
100100
</div><div class="textblock"><div class="dynheader">
101101
Include dependency graph for _page_rank.cpp:</div>
102102
<div class="dyncontent">
103-
<div class="center"><img src="__page__rank_8cpp__incl.png" border="0" usemap="#alib_2src_2__page__rank_8cpp" alt=""/></div>
104-
<map name="alib_2src_2__page__rank_8cpp" id="alib_2src_2__page__rank_8cpp">
103+
<div class="center"><img src="__page__rank_8cpp__incl.png" border="0" usemap="#asearch__engine__cpp_2lib_2src_2__page__rank_8cpp" alt=""/></div>
104+
<map name="asearch__engine__cpp_2lib_2src_2__page__rank_8cpp" id="asearch__engine__cpp_2lib_2src_2__page__rank_8cpp">
105105
<area shape="rect" title=" " alt="" coords="5,5,159,31"/>
106106
<area shape="rect" title=" " alt="" coords="45,79,119,104"/>
107107
<area shape="poly" title=" " alt="" coords="85,31,85,65,79,65,79,31"/>
@@ -133,7 +133,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#ac9efdaac9411d0868b715edc
133133
<!-- start footer part -->
134134
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
135135
<ul>
136-
<li class="navelem"><a class="el" href="dir_97aefd0d527b934f1d99a682da8fe6a9.html">lib</a></li><li class="navelem"><a class="el" href="dir_a065c5f60305fee3569f887679366939.html">src</a></li><li class="navelem"><a class="el" href="__page__rank_8cpp.html">_page_rank.cpp</a></li>
136+
<li class="navelem"><a class="el" href="dir_b4f24b687d3039d1f6957e629435aa8b.html">search_engine_cpp</a></li><li class="navelem"><a class="el" href="dir_25511d843faa0c1e21bb03403209d707.html">lib</a></li><li class="navelem"><a class="el" href="dir_1c56e417f4fa2c5924f6908ea89055d7.html">src</a></li><li class="navelem"><a class="el" href="__page__rank_8cpp.html">_page_rank.cpp</a></li>
137137
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8 </li>
138138
</ul>
139139
</div>

docs/html/__page__rank_8cpp__incl.dot

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
digraph "search_engine_cpp/lib/src/_page_rank.cpp"
2+
{
3+
// LATEX_PDF_SIZE
4+
bgcolor="transparent";
5+
edge [fontname=Helvetica,fontsize=10,labelfontname=Helvetica,labelfontsize=10];
6+
node [fontname=Helvetica,fontsize=10,shape=box,height=0.2,width=0.4];
7+
Node1 [id="Node000001",label="search_engine_cpp/lib\l/src/_page_rank.cpp",height=0.2,width=0.4,color="gray40", fillcolor="grey60", style="filled", fontcolor="black",tooltip=" "];
8+
Node1 -> Node2 [id="edge1_Node000001_Node000002",color="steelblue1",style="solid",tooltip=" "];
9+
Node2 [id="Node000002",label="Python.h",height=0.2,width=0.4,color="grey60", fillcolor="#E0E0E0", style="filled",tooltip=" "];
10+
}

0 commit comments

Comments
 (0)