Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor cpp #49

Merged
merged 6 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
./tests/unit-tests/LibUnitTests --gtest_output=xml:./test-report.xml

- name: Upload Test Report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: gtest-report
path: build/test-report.xml
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set(CMAKE_CXX_STANDARD 20)

project(search_engine VERSION 1.0)

add_subdirectory(lib)
add_subdirectory(search_engine_cpp/lib)

option(BUILD_TESTS "Build and enable tests" ON)

Expand Down
25 changes: 25 additions & 0 deletions Examples/cpp_examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 3.10)
project(TestSearchEngineCpp)

set(CMAKE_CXX_STANDARD 17)

# Library directory
# Set here your env path to search_engine_cpp/lib
set(LIB_DIR "/home/pedro/projects/teste_search_engine/env/lib/python3.12/site-packages/search_engine_cpp/lib")

# Header directory (change to the correct path if necessary)
# Set here your env path to search_engine_cpp/lib/include
set(INCLUDE_DIR "/home/pedro/projects/teste_search_engine/env/lib/python3.12/site-packages/search_engine_cpp/lib/include")

# Include headers
include_directories(${INCLUDE_DIR})

# Add the main executable
add_executable(main_test main.cpp)

# Add the shared library
add_library(search_engine SHARED IMPORTED)
set_target_properties(search_engine PROPERTIES IMPORTED_LOCATION ${LIB_DIR}/libsearch_engine.so)

# Link the library to the executable
target_link_libraries(main_test PRIVATE search_engine)
7 changes: 7 additions & 0 deletions Examples/cpp_examples/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <hello.h>

int main(int argc, char const* argv[]) {
auto hello = Hello();
std::cout << hello.greet("Pedro") << std::endl;
return 0;
}
6 changes: 3 additions & 3 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def build_lib_cpp(path: str):
def copy_lib(root_path, path_lib):
extensions = [".so*", ".dll*", ".dylib*"]
for ext in extensions:
path_so = root_path.glob(f"{BUILD_FOLDER}/lib/*{ext}")
path_so = root_path.glob(f"{BUILD_FOLDER}/search_engine_cpp/lib/*{ext}")
path_lib.mkdir(exist_ok=True, parents=True)
# Copy each .so file
for lib in path_so:
Expand Down Expand Up @@ -68,9 +68,9 @@ def build(setup_kwargs):
f"search_engine_cpp.{lib}",
language="c++",
sources=[
f"lib/src/{lib_pyx}.pyx"
f"search_engine_cpp/lib/src/{lib_pyx}.pyx"
],
include_dirs=["lib/include"],
include_dirs=["search_engine_cpp/lib/include"],
library_dirs=[library_dir],
runtime_library_dirs=[library_dir],
libraries=["search_engine"],
Expand Down
8 changes: 4 additions & 4 deletions docs/html/__hello_8cpp.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Search Engine: lib/src/_hello.cpp File Reference</title>
<title>Search Engine: search_engine_cpp/lib/src/_hello.cpp File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
Expand Down Expand Up @@ -100,8 +100,8 @@
</div><div class="textblock"><div class="dynheader">
Include dependency graph for _hello.cpp:</div>
<div class="dyncontent">
<div class="center"><img src="__hello_8cpp__incl.png" border="0" usemap="#alib_2src_2__hello_8cpp" alt=""/></div>
<map name="alib_2src_2__hello_8cpp" id="alib_2src_2__hello_8cpp">
<div class="center"><img src="__hello_8cpp__incl.png" border="0" usemap="#asearch__engine__cpp_2lib_2src_2__hello_8cpp" alt=""/></div>
<map name="asearch__engine__cpp_2lib_2src_2__hello_8cpp" id="asearch__engine__cpp_2lib_2src_2__hello_8cpp">
<area shape="rect" title=" " alt="" coords="5,5,125,31"/>
<area shape="rect" title=" " alt="" coords="28,79,103,104"/>
<area shape="poly" title=" " alt="" coords="68,31,68,65,63,65,63,31"/>
Expand Down Expand Up @@ -133,7 +133,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#ac9efdaac9411d0868b715edc
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<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>
<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>
<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>
</ul>
</div>
Expand Down
10 changes: 10 additions & 0 deletions docs/html/__hello_8cpp__incl.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
digraph "search_engine_cpp/lib/src/_hello.cpp"
{
// LATEX_PDF_SIZE
bgcolor="transparent";
edge [fontname=Helvetica,fontsize=10,labelfontname=Helvetica,labelfontsize=10];
node [fontname=Helvetica,fontsize=10,shape=box,height=0.2,width=0.4];
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=" "];
Node1 -> Node2 [id="edge1_Node000001_Node000002",color="steelblue1",style="solid",tooltip=" "];
Node2 [id="Node000002",label="Python.h",height=0.2,width=0.4,color="grey60", fillcolor="#E0E0E0", style="filled",tooltip=" "];
}
8 changes: 4 additions & 4 deletions docs/html/__inverted__index_8cpp.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Search Engine: lib/src/_inverted_index.cpp File Reference</title>
<title>Search Engine: search_engine_cpp/lib/src/_inverted_index.cpp File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
Expand Down Expand Up @@ -100,8 +100,8 @@
</div><div class="textblock"><div class="dynheader">
Include dependency graph for _inverted_index.cpp:</div>
<div class="dyncontent">
<div class="center"><img src="__inverted__index_8cpp__incl.png" border="0" usemap="#alib_2src_2__inverted__index_8cpp" alt=""/></div>
<map name="alib_2src_2__inverted__index_8cpp" id="alib_2src_2__inverted__index_8cpp">
<div class="center"><img src="__inverted__index_8cpp__incl.png" border="0" usemap="#asearch__engine__cpp_2lib_2src_2__inverted__index_8cpp" alt=""/></div>
<map name="asearch__engine__cpp_2lib_2src_2__inverted__index_8cpp" id="asearch__engine__cpp_2lib_2src_2__inverted__index_8cpp">
<area shape="rect" title=" " alt="" coords="5,5,183,31"/>
<area shape="rect" title=" " alt="" coords="57,79,131,104"/>
<area shape="poly" title=" " alt="" coords="97,31,97,65,91,65,91,31"/>
Expand Down Expand Up @@ -133,7 +133,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#ac9efdaac9411d0868b715edc
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<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>
<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>
<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>
</ul>
</div>
Expand Down
10 changes: 10 additions & 0 deletions docs/html/__inverted__index_8cpp__incl.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
digraph "search_engine_cpp/lib/src/_inverted_index.cpp"
{
// LATEX_PDF_SIZE
bgcolor="transparent";
edge [fontname=Helvetica,fontsize=10,labelfontname=Helvetica,labelfontsize=10];
node [fontname=Helvetica,fontsize=10,shape=box,height=0.2,width=0.4];
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=" "];
Node1 -> Node2 [id="edge1_Node000001_Node000002",color="steelblue1",style="solid",tooltip=" "];
Node2 [id="Node000002",label="Python.h",height=0.2,width=0.4,color="grey60", fillcolor="#E0E0E0", style="filled",tooltip=" "];
}
8 changes: 4 additions & 4 deletions docs/html/__page__rank_8cpp.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Search Engine: lib/src/_page_rank.cpp File Reference</title>
<title>Search Engine: search_engine_cpp/lib/src/_page_rank.cpp File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
Expand Down Expand Up @@ -100,8 +100,8 @@
</div><div class="textblock"><div class="dynheader">
Include dependency graph for _page_rank.cpp:</div>
<div class="dyncontent">
<div class="center"><img src="__page__rank_8cpp__incl.png" border="0" usemap="#alib_2src_2__page__rank_8cpp" alt=""/></div>
<map name="alib_2src_2__page__rank_8cpp" id="alib_2src_2__page__rank_8cpp">
<div class="center"><img src="__page__rank_8cpp__incl.png" border="0" usemap="#asearch__engine__cpp_2lib_2src_2__page__rank_8cpp" alt=""/></div>
<map name="asearch__engine__cpp_2lib_2src_2__page__rank_8cpp" id="asearch__engine__cpp_2lib_2src_2__page__rank_8cpp">
<area shape="rect" title=" " alt="" coords="5,5,159,31"/>
<area shape="rect" title=" " alt="" coords="45,79,119,104"/>
<area shape="poly" title=" " alt="" coords="85,31,85,65,79,65,79,31"/>
Expand Down Expand Up @@ -133,7 +133,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#ac9efdaac9411d0868b715edc
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<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>
<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>
<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>
</ul>
</div>
Expand Down
10 changes: 10 additions & 0 deletions docs/html/__page__rank_8cpp__incl.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
digraph "search_engine_cpp/lib/src/_page_rank.cpp"
{
// LATEX_PDF_SIZE
bgcolor="transparent";
edge [fontname=Helvetica,fontsize=10,labelfontname=Helvetica,labelfontsize=10];
node [fontname=Helvetica,fontsize=10,shape=box,height=0.2,width=0.4];
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=" "];
Node1 -> Node2 [id="edge1_Node000001_Node000002",color="steelblue1",style="solid",tooltip=" "];
Node2 [id="Node000002",label="Python.h",height=0.2,width=0.4,color="grey60", fillcolor="#E0E0E0", style="filled",tooltip=" "];
}
Loading
Loading