Skip to content

Commit 84dd8ef

Browse files
committed
Attempted build - WIP
1 parent c983429 commit 84dd8ef

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ install(FILES "${CMAKE_BINARY_DIR}/modules/ftorch.mod"
8484

8585
# Build integration tests
8686
if(CMAKE_BUILD_TESTS)
87+
# Unit tests
88+
add_subdirectory(test/unit)
89+
# Integration tests
8790
file(MAKE_DIRECTORY test/examples)
8891
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../examples/CMakeLists.txt
8992
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/test/examples

src/test/unit/CMakeLists.txt

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
find_package(FTorch)
2+
find_package(MPI REQUIRED)
3+
message(STATUS "Building with Fortran PyTorch coupling")
4+
5+
# Include PFUNIT directories
6+
include_directories(${PFUNIT}/include)
7+
8+
set(pf_tests
9+
test_constructors.pf)
10+
11+
add_pfunit_tests(new_tests ${pf_tests})
12+
add_library(new_pftests EXCLUDE_FROM_ALL ${pf_tests})
13+
target_link_libraries(new_ptests PRIVATE FTorch::ftorch MPI::MPI_Fortran ${PFUNIT}/lib/libpfunit.a)
14+
15+
16+
# Integration testing
17+
if(CMAKE_BUILD_TESTS)
18+
include(CTest)
19+
add_test(NAME constructors COMMAND constructors WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
20+
endif()

0 commit comments

Comments
 (0)