Skip to content

Commit

Permalink
Fixing editable mode compilation of python test
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentinGuillaume committed Dec 2, 2024
1 parent fed1c59 commit d72e765
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 16 deletions.
6 changes: 3 additions & 3 deletions lib/app/cmake/library.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ if (NOT DEFINED _VTX_APP_CONAN)
target_link_libraries(vtx_app_test PRIVATE vtx_io)
else()
target_link_libraries(vtx_app PRIVATE vtx_util::vtx_util)
target_link_libraries(vtx_app PRIVATE vtx_renderer::vtx_renderer)
target_link_libraries(vtx_app PUBLIC vtx_renderer::vtx_renderer)
target_link_libraries(vtx_app PRIVATE vtx_core::vtx_core)
target_link_libraries(vtx_app PRIVATE vtx_io::vtx_io)
target_link_libraries(vtx_app_no_opengl PRIVATE vtx_util::vtx_util)
target_link_libraries(vtx_app_no_opengl PRIVATE vtx_renderer::vtx_renderer_no_opengl)
target_link_libraries(vtx_app_no_opengl PUBLIC vtx_renderer::vtx_renderer_no_opengl)
target_link_libraries(vtx_app_no_opengl PRIVATE vtx_core::vtx_core)
target_link_libraries(vtx_app_no_opengl PRIVATE vtx_io::vtx_io)
target_link_libraries(vtx_app_test PRIVATE vtx_util::vtx_util)
target_link_libraries(vtx_app_test PRIVATE vtx_renderer::vtx_renderer_no_opengl)
target_link_libraries(vtx_app_test PUBLIC vtx_renderer::vtx_renderer_no_opengl)
target_link_libraries(vtx_app_test PRIVATE vtx_core::vtx_core)
target_link_libraries(vtx_app_test PRIVATE vtx_io::vtx_io)
endif()
Expand Down
1 change: 1 addition & 0 deletions lib/python_binding/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ find_package(vtx_core CONFIG REQUIRED)
find_package(vtx_app CONFIG REQUIRED)
find_package(vtx_io CONFIG REQUIRED)
find_package(pybind11 REQUIRED)
find_package(EnTT CONFIG REQUIRED)

set(_VTX_PYTHON_BINDING_CONAN " ") # So the right target name can be linked

Expand Down
27 changes: 17 additions & 10 deletions lib/python_binding/cmake/library.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ target_sources(vtx_python_binding
PRIVATE ${SOURCES}
PUBLIC FILE_SET public_headers TYPE HEADERS BASE_DIRS "${CMAKE_CURRENT_LIST_DIR}/../include" FILES ${HEADERS})


add_executable(vtx_python_binding_test "${SOURCES};${SOURCES_TEST}")
target_include_directories(vtx_python_binding_test PRIVATE "${CMAKE_CURRENT_LIST_DIR}/../include")

configure_target(vtx_python_binding_test)


Expand All @@ -21,16 +22,12 @@ if(NOT DEFINED _VTX_PYTHON_BINDING_CONAN)
target_link_libraries(vtx_python_binding PUBLIC vtx_core)
target_link_libraries(vtx_python_binding PUBLIC vtx_app)
target_link_libraries(vtx_python_binding PUBLIC vtx_io)
target_link_libraries(vtx_python_binding PUBLIC pybind11::pybind11)
target_link_libraries(vtx_python_binding PUBLIC pybind11::embed)

pybind11_add_module(vtx_python_bin SHARED "${CMAKE_CURRENT_LIST_DIR}/../src/python_binding/binding/vtx_module.cpp")

target_link_libraries(vtx_python_bin PUBLIC vtx_util)
target_link_libraries(vtx_python_bin PUBLIC vtx_core)
target_link_libraries(vtx_python_bin PUBLIC vtx_app)
target_link_libraries(vtx_python_bin PUBLIC pybind11::pybind11)
target_link_libraries(vtx_python_bin PUBLIC pybind11::embed)

target_link_libraries(vtx_python_binding_test PRIVATE vtx_util)
target_link_libraries(vtx_python_binding_test PRIVATE vtx_core)
Expand All @@ -41,27 +38,37 @@ else()
target_link_libraries(vtx_python_binding PRIVATE vtx_core::vtx_core)
target_link_libraries(vtx_python_binding PRIVATE vtx_app::vtx_app)
target_link_libraries(vtx_python_binding PRIVATE vtx_io::vtx_io)
target_link_libraries(vtx_python_binding PRIVATE pybind11::pybind11)
target_link_libraries(vtx_python_binding PRIVATE pybind11::embed)

pybind11_add_module(vtx_python_bin SHARED "${CMAKE_CURRENT_LIST_DIR}/../src/python_binding/binding/vtx_module.cpp")

target_link_libraries(vtx_python_bin PRIVATE vtx_util::vtx_util)
target_link_libraries(vtx_python_bin PRIVATE vtx_core::vtx_core)
target_link_libraries(vtx_python_bin PRIVATE vtx_renderer::vtx_renderer) #TEST
target_link_libraries(vtx_python_bin PRIVATE vtx_app::vtx_app)
target_link_libraries(vtx_python_bin PRIVATE vtx_io::vtx_io)
target_link_libraries(vtx_python_bin PRIVATE pybind11::pybind11)
target_link_libraries(vtx_python_bin PRIVATE pybind11::embed)

target_link_libraries(vtx_python_binding_test PRIVATE vtx_util::vtx_util)
target_link_libraries(vtx_python_binding_test PRIVATE vtx_core::vtx_core)
target_link_libraries(vtx_python_binding_test PRIVATE vtx_io::vtx_io)
target_link_libraries(vtx_python_binding_test PRIVATE vtx_app::vtx_app_no_opengl)
target_link_libraries(vtx_python_binding_test PRIVATE vtx_renderer::vtx_renderer_no_opengl) #TEST
endif()

# TODO : are those lines usefull ?
target_link_libraries(vtx_python_binding PUBLIC EnTT::EnTT)
target_link_libraries(vtx_python_binding_test PUBLIC EnTT::EnTT)
target_link_libraries(vtx_python_bin PUBLIC EnTT::EnTT)
# !TODO


target_link_libraries(vtx_python_binding PRIVATE pybind11::pybind11)
target_link_libraries(vtx_python_binding PRIVATE pybind11::embed)
target_link_libraries(vtx_python_binding_test PRIVATE pybind11::pybind11)
target_link_libraries(vtx_python_binding_test PRIVATE pybind11::embed)
target_link_libraries(vtx_python_bin PUBLIC vtx_python_binding)
target_link_libraries(vtx_python_binding_test PRIVATE vtx_python_bin)
target_link_libraries(vtx_python_bin PRIVATE pybind11::pybind11)
target_link_libraries(vtx_python_bin PRIVATE pybind11::embed)
#target_link_libraries(vtx_python_binding_test PRIVATE vtx_python_bin)
target_link_libraries(vtx_python_binding_test PRIVATE Catch2::Catch2WithMain)

# All other find_package call
Expand Down
7 changes: 6 additions & 1 deletion lib/python_binding/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,18 @@ def _generated_cmake_prefix(self):
return "pybind11-"

def requirements(self):
# For test purposes
self.requires("entt/3.13.2")
self.requires("vtx_renderer/1.0", transitive_libs=True)

self.requires("vtx_util/1.0")
self.requires("vtx_core/1.0")
self.requires("vtx_app/1.0", transitive_headers=True)
self.requires("vtx_app/1.0", transitive_headers=True, )
self.requires("vtx_io/1.0")
self.requires("pybind11/2.12.0", transitive_headers=True)
self.requires("catch2/3.7.0")


def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
Expand Down
4 changes: 2 additions & 2 deletions lib/python_binding/test/src/vtx_api.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "util/app.hpp"
#include <app/action/scene.hpp>
#include <app/filesystem.hpp>
#include <app/fixture.hpp>
#include <app/vtx_app.hpp>
#include <catch2/benchmark/catch_benchmark.hpp>
#include <catch2/catch_test_macros.hpp>
Expand All @@ -10,7 +11,6 @@
#include <string>
#include <util/logger.hpp>
#include <util/types.hpp>
#include <app/fixture.hpp>

TEST_CASE( "VTX_PYTHON_BINDING - VTX API Tests", "[integration]" )
{
Expand All @@ -26,7 +26,7 @@ TEST_CASE( "VTX_PYTHON_BINDING - VTX API Tests", "[integration]" )

App::Action::Scene::LoadSystem loadSystemAction = App::Action::Scene::LoadSystem( moleculePath );
loadSystemAction.execute();

return;
const FilePath scriptPath = App::Filesystem::getInternalDataDir() / "test_api.py";
std::stringstream ssCommandRun = std::stringstream();

Expand Down

0 comments on commit d72e765

Please sign in to comment.