Skip to content

Commit

Permalink
with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lobis committed Nov 29, 2023
1 parent 7b67463 commit fd10866
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
cd application
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=${CONDA_PREFIX}
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWITH_TESTS=ON -DCMAKE_PREFIX_PATH=${CONDA_PREFIX}
make
cd tests
ctest
Expand Down
10 changes: 4 additions & 6 deletions application/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,8 @@ file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS
add_library(${PROJECT_NAME} SHARED ${SOURCES})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)

target_include_directories(
${PROJECT_NAME}
PUBLIC ${PROJECT_SOURCE_DIR}/include
PRIVATE ${Geant4_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS}
${PyBind11_INCLUDE_DIRS})
target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/include
${Geant4_INCLUDE_DIRS})

target_link_libraries(
${PROJECT_NAME} PUBLIC ${Geant4_LIBRARIES} awkward::layout-builder
Expand All @@ -64,7 +61,8 @@ file(GLOB_RECURSE PYTHON_SOURCES CONFIGURE_DEPENDS
pybind11_add_module(${PYTHON_MODULE_NAME} ${PYTHON_SOURCES})
target_link_libraries(${PYTHON_MODULE_NAME} PUBLIC ${PROJECT_NAME})

if (CMAKE_BUILD_TYPE MATCHES Debug)
# -DWITH_TESTS=ON
if (WITH_TESTS)
message(STATUS "Building tests")
add_subdirectory(tests)
endif ()
4 changes: 4 additions & 0 deletions application/src/python/module.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@

#include "geant4/Application.h"

#include "pybind11/chrono.h"
#include "pybind11/complex.h"
#include "pybind11/functional.h"
#include "pybind11/pybind11.h"
#include "pybind11/stl.h"

using namespace geant4;
namespace py = pybind11;
Expand Down
3 changes: 2 additions & 1 deletion application/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ add_executable(${TEST_EXECUTABLE_NAME})
target_sources(${TEST_EXECUTABLE_NAME} PRIVATE ${TEST_SOURCES})
target_include_directories(${TEST_EXECUTABLE_NAME}
PRIVATE ${PROJECT_SOURCE_DIR}/include)
target_link_libraries(${TEST_EXECUTABLE_NAME} ${PROJECT_NAME} GTest::gtest_main)
target_link_libraries(${TEST_EXECUTABLE_NAME} ${PROJECT_NAME} GTest::gtest_main
pybind11::embed)

include(GoogleTest)
gtest_discover_tests(${TEST_EXECUTABLE_NAME})

0 comments on commit fd10866

Please sign in to comment.