Skip to content

Commit

Permalink
Merge branch '2decomp-integration' of github.com:Nanoseb/x3d2 into 2d…
Browse files Browse the repository at this point in the history
…ecomp-integration
  • Loading branch information
Nanoseb committed Oct 24, 2024
2 parents 01403a9 + 56f2b44 commit ea2218e
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
27 changes: 27 additions & 0 deletions cmake/Finddecomp2d.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# - Find the 2decomp-fft library
find_package(decomp2d
PATHS ${CMAKE_SOURCE_DIR}/decomp2d/build)
if (decomp2d_FOUND)
message(STATUS "2decomp-fft FOUND")
else(decomp2d_FOUND)
message(STATUS "2decomp-fft PATH not available we'll try to download and install")
configure_file(${CMAKE_SOURCE_DIR}/cmake/decomp2d/downloadBuild2decomp.cmake.in decomp2d-build/CMakeLists.txt)
#message("Second CMAKE_GENERATOR ${CMAKE_GENERATOR}")
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/decomp2d-build )
if(result)
message(FATAL_ERROR "CMake step for 2decomp-fft failed: ${result}")
else()
message("CMake step for 2decomp-fft completed (${result}).")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/decomp2d-build )
if(result)
message(FATAL_ERROR "Build step for 2decomp-fft failed: ${result}")
endif()
set(D2D_ROOT ${CMAKE_CURRENT_BINARY_DIR}/decomp2d-build/downloadBuild2decomp-prefix/src/downloadBuild2decomp-build)
find_package(decomp2d REQUIRED
PATHS ${D2D_ROOT})
endif(decomp2d_FOUND)
26 changes: 26 additions & 0 deletions cmake/decomp2d/downloadBuild2decomp.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# downloadBuild2decomp.cmake.in
#
cmake_minimum_required(VERSION 3.0.2)

project(downloadBuild2decomp NONE)

include(ExternalProject)

ExternalProject_Add(downloadBuild2decomp
GIT_REPOSITORY "https://github.com/xcompact3d/2decomp-fft"
GIT_TAG "v2.0.3"
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/decomp2d-src"
INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/decomp2d-opt"
TEST_COMMAND ""
)

#ExternalProject_Add(downloadBuild2decomp
# GIT_REPOSITORY "https://github.com/xcompact3d/2decomp-fft"
# GIT_TAG "main"
# CONFIGURE_COMMAND "cmake -S ${CMAKE_CURRENT_BINARY_DIR}/decomp2d-src "
# BUILD_COMMAND ""
# INSTALL_COMMAND ""
# TEST_COMMAND ""
# SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/decomp2d-src"
# BINARY_DIR ""
# INSTALL_DIR ""
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ endif()

if (${POISSON_SOLVER} STREQUAL "FFT" AND ${BACKEND} STREQUAL "OMP")
message(STATUS "Using the FFT poisson solver with 2decomp&fft")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
find_package(decomp2d REQUIRED)
include_directories(${decomp2d_INCLUDE_DIRS})
target_link_libraries(decomp2d)
Expand Down

0 comments on commit ea2218e

Please sign in to comment.