Skip to content

Commit

Permalink
move torch
Browse files Browse the repository at this point in the history
  • Loading branch information
chengcli committed Jul 8, 2024
1 parent b4ce973 commit 0c267d1
Show file tree
Hide file tree
Showing 20 changed files with 42 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ endif()
message(STATUS "Include ${CMAKE_CURRENT_SOURCE_DIR}/cmake/parameters.cmake")
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/parameters.cmake)
find_package(Eigen3 REQUIRED)
find_package(Torch REQUIRED)
find_package(Cantera)
#find_package(Torch)

## 3. set up project system libraries ##
message(STATUS "3. Set up system libraries")
Expand Down
8 changes: 6 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ add_subdirectory(special)
add_subdirectory(single_column)
add_subdirectory(diagnostics)
add_subdirectory(forcing)
add_subdirectory(modules)

if (${Torch_FOUND})
add_subdirectory(torch)
add_subdirectory(modules)
endif()
#add_subdirectory(nbody)

set(CANOE_LIBRARY_${buildu}
Expand All @@ -86,7 +90,7 @@ set(CANOE_LIBRARY_${buildu}
"scm_${buildl}"
"diagnostics_${buildl}"
"forcing_${buildl}"
"modules_${buildl}"
#"modules_${buildl}"
${YAML_CPP_LIBRARIES}
${CPPDISORT_LIBRARY_${buildu}}
${PYTHON_LIBRARY_RELEASE}
Expand Down
28 changes: 28 additions & 0 deletions src/torch/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
set(namel torch)
string(TOUPPER ${namel} nameu)

file(GLOB src_files
eos/*.cpp
hydro/*.cpp
riemann/*.cpp
recon/*.cpp
column/*.cpp
)

string(TOLOWER ${CMAKE_BUILD_TYPE} buildl)
string(TOUPPER ${CMAKE_BUILD_TYPE} buildu)

add_library(${namel}_${buildl}
OBJECT
${src_files}
)

set_target_properties(${namel}_${buildl}
PROPERTIES
COMPILE_FLAGS ${CMAKE_CXX_FLAGS_${buildu}}
)

target_include_directories(${namel}_${buildl}
PRIVATE
${EIGEN3_INCLUDE_DIR}
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 7 additions & 5 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ configure_file(globals.cpp.in globals.cpp @ONLY)
enable_testing()

# torch tests
setup_test(test_eos)
setup_test(test_weno)
setup_test(test_reconstruct)
setup_test(test_riemann)
setup_test(test_hydro)
if (${Torch_FOUND})
setup_test(test_eos)
setup_test(test_weno)
setup_test(test_reconstruct)
setup_test(test_riemann)
setup_test(test_hydro)
endif()

# athena tests
setup_test(test_mesh)
Expand Down

0 comments on commit 0c267d1

Please sign in to comment.