Working with C++ input for WarpX #5062
-
Hi everyone, I am new to WarpX and I want to write a code using the C++ classes, build it using CMAKE then run it. I managed to do all the steps but when I create my own CMake file to build my code, the building process fails because the file WarpXTargets.cmake is not available. I checked the repository online and I could not find here either. I am wondering what am I doing wrong. Any advice? This is my CMakeLists.txt: cmake_minimum_required(VERSION 3.10)
project(WarpXTest)
set(CMAKE_CXX_STANDARD 14)
set(AMREX_DIR //home/USER/WarpX/build/_deps/fetchedamrex-build/lib/cmake/AMReX)
set(WARPX_DIR /home/USER/WarpX)
find_package(AMReX REQUIRED PATHS ${AMREX_DIR})
find_package(WarpX REQUIRED PATHS ${WARPX_DIR})
find_package(HDF5 REQUIRED)
add_executable(WarpXTest main.cpp)
target_include_directories(WarpXTest PRIVATE ${WarpX_INCLUDE_DIRS} ${AMREX_INCLUDE_DIRS} ${HDF5_INCLUDE_DIRS})
target_link_libraries(WarpXTest PRIVATE WarpX::WarpX ${AMREX_LIBRARIES} ${HDF5_LIBRARIES} sz) The error I receive is:
Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @msaadeh0, While you can already use the library ABLASTR inside WarpX to build your own PIC code, e.g., see ImpactX logic for this, WarpX does not yet fully support this. We are working on a C++ library install of WarpX in #5008 . In the meantime, you could simply But more generally, which specific use case are you after? Maybe we can guide you to do something different or contribute to WarpX mainline. Or maybe, you can simply extend WarpX from Python, using our Python bindings. |
Beta Was this translation helpful? Give feedback.
Hi @msaadeh0,
While you can already use the library ABLASTR inside WarpX to build your own PIC code, e.g., see ImpactX logic for this, WarpX does not yet fully support this. We are working on a C++ library install of WarpX in #5008 .
In the meantime, you could simply
add_subdirectory()
to the WarpX source directory and skip thefind_package
. This is called a "superbuild" and will do the same as you are trying to do with the snippet above, but without having WarpX pre-installed as binaries (instead, it will build it on the fly).But more generally, which specific use case are you after? Maybe we can guide you to do something different or contribute to WarpX mainline. Or maybe, you can simp…