Hi Karin,

To do what Radu outlined, you have to install DEME and Chrono, then link 
against those installations. There are a couple of directions you can go:

   1. Follow the instructions in the installing as library section 
   <https://github.com/projectchrono/DEM-Engine#install-as-library>. You 
   will install both Chrono and DEME, then link against both of them using the 
   framework in chrono-project (which are equivalently your own simulation 
   scripts).
   2. Still you have first to install both Chrono and DEME. I attached a 
   more simplistic example in this reply, where you link your simulation 
   script (firstdeme.cpp) against a DEME installation using a simple 
   custom-made CMake script. You can add the linkage to Chrono yourself.
   3. If you don't mind Python, then you can use pyChrono along with 
   pyDEME. No installation or CMake needed.

Thank you,
Ruochun

On Monday, November 6, 2023 at 2:17:31 AM UTC-6 Karin Sugi wrote:

> Hello all,
>
> I wander how can i include thirdparty modules such as DEM-Engine in 
> chrono. When I tried to build demo script of DEM-Engine, it returns an 
> error saying included modules doesn't exist.
>
> I think i should write something related to the DEM in find_package() of 
> CMakeLists as same as using other chrono modlues, but what?
> My find_package() command is following. I added "Thirdparty" or 
> "DEM-Engine" to COMPONENTS, but it doesn't work. Do you have any idea?
>
> find_package(Chrono
>     COMPONENTS Irrlicht Vehicle 
>     OPTIONAL_COMPONENTS PardisoMKL
>     CONFIG)
>
>
>
> Thanks in advance,
> Karin
>

-- 
You received this message because you are subscribed to the Google Groups 
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/61078cb0-0b7d-43e0-8c4f-d087d1019d2bn%40googlegroups.com.
#include <core/ApiVersion.h>
#include <core/utils/ThreadManager.h>
#include <DEM/API.h>
#include <DEM/HostSideHelpers.hpp>
#include <DEM/utils/Samplers.hpp>

#include <cstdio>
#include <chrono>
#include <filesystem>

using namespace deme;
using namespace std::filesystem;

int main() {
    DEMSolver DEMSim;
}
# ------------------------------------------------------------------------------
# Additional include paths and libraries
# ------------------------------------------------------------------------------

# INCLUDE_DIRECTORIES(${ProjectIncludeRoot})

cmake_minimum_required(VERSION 3.18)

project(firstdeme)


#--------------------------------------------------------------
# Add the executable from your project and specify all C++ 
# files in your project. 
#--------------------------------------------------------------

#add_executable(firstdeme firstdeme.cpp)

#--------------------------------------------------------------
        

#=============================================================================
# CMake configuration file for projects using DEM-Engine standalone library.
#=============================================================================

message("\n---- DEME standalone library ----\n")

#--------------------------------------------------------------
# List of all executables
#--------------------------------------------------------------

set(TESTS
    firstdeme
)

#--------------------------------------------------------------
# Find the packages with required components
#--------------------------------------------------------------

find_package(CUDAToolkit REQUIRED)
find_package(ChPF REQUIRED)
find_package(DEME REQUIRED)

# If the required component(s) were not found, return now.

if(NOT DEME_FOUND)
  message("Could not find DEM-Engine library, search DEME install dir for it")
  return()
endif()

if(NOT ChPF_FOUND)
  message("Could not find ChPF library, search DEME install dir for it")
  return()
endif()


#--------------------------------------------------------------
# Include paths and libraries
#--------------------------------------------------------------

# 
# (B) Path to the top of the source tree for this project
# - for access to utility headers

include_directories(
    ${DEME_INCLUDE_DIRS}
    ${CMAKE_SOURCE_DIR}
)

#--------------------------------------------------------------
# Append to the parent's list of DLLs (and make it visible up)
#--------------------------------------------------------------

#set(ALL_DLLS "${ALL_DLLS}" PARENT_SCOPE)

#--------------------------------------------------------------
# DEME requires C++17 to be linked against
#--------------------------------------------------------------

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")

#--------------------------------------------------------------
# Loop over all programs and build them
#--------------------------------------------------------------

MESSAGE(STATUS "Physics programs...")

FOREACH(PROGRAM ${TESTS})
    MESSAGE(STATUS "...add ${PROGRAM}")

    ADD_EXECUTABLE(${PROGRAM}  "${PROGRAM}.cpp")
    SOURCE_GROUP(""  FILES "${PROGRAM}.cpp")
    set_property(TARGET ${PROGRAM} PROPERTY C_STANDARD 17)
    set_property(TARGET ${PROGRAM} PROPERTY C_STANDARD_REQUIRED ON)

    target_compile_definitions(${PROGRAM} PUBLIC 
"DEME_DATA_DIR=\"${DEME_DATA_DIRS}\"") 
    target_link_libraries(${PROGRAM} DEME::simulator_multi_gpu)

ENDFOREACH()

Reply via email to