cmake_minimum_required(VERSION 3.0) project(MySources) file(GLOB MySourcesFiles ${CMAKE_CURRENT_LIST_DIR}/*.hpp ${CMAKE_CURRENT_LIST_DIR}/*.cpp) add_library(${PROJECT_NAME} STATIC ${MySourcesFiles} ) target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20) #Download external dependencies NOTE: If the user has one of these libs it shouldn't be downloaded again. include(${CMAKE_CURRENT_LIST_DIR}/cmake/DownloadProject.cmake) include(FetchContent) if (CMAKE_VERSION VERSION_LESS 3.2) set(UPDATE_DISCONNECTED_IF_AVAILABLE "") else() set(UPDATE_DISCONNECTED_IF_AVAILABLE "UPDATE_DISCONNECTED 1") endif() set(EXTERNAL_DEPS_DIR "/home/iason/Coding/build/external dependencies") if(NOT EXISTS ${EXTERNAL_DEPS_DIR}) set(EXTERNAL_DEPS_DIR ${CMAKE_CURRENT_BINARY_DIR}) endif() ##Create directory for the external libraries file(MAKE_DIRECTORY ${EXTERNAL_DEPS_DIR}) set(DRMSimulationModelDir "/home/iason/Coding/Libraries/DRMSimulationModel") set(DRMSimulationModelBuildDir ${CMAKE_BINARY_DIR}/_deps) add_subdirectory(${DRMSimulationModelDir} ${DRMSimulationModelBuildDir}) target_link_libraries(${PROJECT_NAME} PUBLIC DRMSimulationModel_lib) #target_include_directories(${PROJECT_NAME} PUBLIC DRMSimulationModel_) #target_sources(${PROJECT_NAME} PUBLIC ${DRMSimulationModelDir}/simulationmodel.hpp) if(${USE_DLIB}) FetchContent_Declare(dlib GIT_REPOSITORY https://github.com/davisking/dlib.git GIT_TAG master ) FetchContent_MakeAvailable(dlib) #add_subdirectory(${DLIB_SOURCE_DIR} ${DLIB_BIN_DIR}) if(${MYSOURCES_STATIC_LINK}) target_link_libraries(${PROJECT_NAME} PUBLIC -static dlib::dlib) else() target_link_libraries(${PROJECT_NAME} PUBLIC dlib::dlib) endif() add_compile_definitions(DLIB_DEFINED) endif() ## polyscope if(#[[NOT TARGET polyscope AND]] ${USE_POLYSCOPE}) message("Using polyscope") FetchContent_Declare(polyscope GIT_REPOSITORY https://github.com/nmwsharp/polyscope.git GIT_TAG master ) FetchContent_MakeAvailable(polyscope) target_include_directories(${PROJECT_NAME} PUBLIC ${polyscope_SOURCE_DIR}/include) # target_include_directories(${PROJECT_NAME} PUBLIC ${polyscope_SOURCE_DIR}/deps/imgui) target_sources(${PROJECT_NAME} PUBLIC ${polyscope_SOURCE_DIR}/deps/imgui/imgui/misc/cpp/imgui_stdlib.h ${polyscope_SOURCE_DIR}/deps/imgui/imgui/misc/cpp/imgui_stdlib.cpp) target_link_libraries(${PROJECT_NAME} PUBLIC polyscope) endif() #if(NOT TARGET polyscope AND ${USE_POLYSCOPE}) # set(POLYSCOPE_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/polyscope) # download_project(PROJ POLYSCOPE # GIT_REPOSITORY https://github.com/nmwsharp/polyscope.git # GIT_TAG master # PREFIX ${EXTERNAL_DEPS_DIR} # BINARY_DIR ${POLYSCOPE_BINARY_DIR} # ${UPDATE_DISCONNECTED_IF_AVAILABLE} # ) # add_subdirectory(${POLYSCOPE_SOURCE_DIR} ${POLYSCOPE_BINARY_DIR}) # add_compile_definitions(POLYSCOPE_DEFINED) # message("Using polyscope..") # target_include_directories(${PROJECT_NAME} PUBLIC ${POLYSCOPE_SOURCE_DIR}/include) # target_link_libraries(${PROJECT_NAME} PUBLIC polyscope) #endif() ##vcglib devel branch FetchContent_Declare(vcglib GIT_REPOSITORY https://gitea-s2i2s.isti.cnr.it/manolas/vcglib.git GIT_TAG devel ) FetchContent_MakeAvailable(vcglib) target_include_directories(${PROJECT_NAME} PUBLIC ${vcglib_SOURCE_DIR}) target_sources(${PROJECT_NAME} PUBLIC ${vcglib_SOURCE_DIR}/wrap/ply/plylib.cpp) ###matplot++ lib FetchContent_Declare(matplot GIT_REPOSITORY https://github.com/alandefreitas/matplotplusplus GIT_TAG master ) FetchContent_MakeAvailable(matplot) ##threed-beam-fea if(NOT TARGET ThreedBeamFEA) FetchContent_Declare(threed-beam-fea GIT_REPOSITORY https://gitea-s2i2s.isti.cnr.it/manolas/threed-beam-fea.git GIT_TAG master ) FetchContent_MakeAvailable(threed-beam-fea) endif() target_link_libraries(${PROJECT_NAME} PUBLIC ThreedBeamFEA) target_include_directories(${PROJECT_NAME} PUBLIC ${threed-beam-fea_SOURCE_DIR}) #set(threed-beam-fea_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/threed-beam-fea) #download_project(PROJ threed-beam-fea ## GIT_REPOSITORY https://github.com/IasonManolas/threed-beam-fea.git # GIT_TAG master # BINARY_DIR ${threed-beam-fea_BINARY_DIR} # PREFIX ${EXTERNAL_DEPS_DIR} # ${UPDATE_DISCONNECTED_IF_AVAILABLE} #) #add_subdirectory(${threed-beam-fea_SOURCE_DIR} ${threed-beam-fea_BINARY_DIR}) find_package(Eigen3 3.4 REQUIRED) if(MSVC) add_compile_definitions(_HAS_STD_BYTE=0) endif(MSVC) if(${MYSOURCES_STATIC_LINK}) message("STATIC LINK MY SOURCES:" ${MYSOURCES_STATIC_LINK}) endif() if(${MYSOURCES_STATIC_LINK}) message("Linking statically here") target_link_libraries(${PROJECT_NAME} PUBLIC #[[-static]] Eigen3::Eigen pthread gfortran quadmath matplot) else() target_link_libraries(${PROJECT_NAME} PUBLIC Eigen3::Eigen tbb pthread matplot) endif() target_link_directories(MySources PUBLIC ${CMAKE_CURRENT_LIST_DIR}/boost_graph/libs) target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/boost_graph PUBLIC ${vcglib_devel_SOURCE_DIR} # PUBLIC ${threed-beam-fea_SOURCE_DIR} ) #if(USE_ENSMALLEN) set(ARMADILLO_SOURCE_DIR "/home/iason/Coding/Libraries/armadillo") set(ARMADILLO_BIN_DIR "/home/iason/Coding/Libraries/armadillo/build") add_subdirectory(${ARMADILLO_SOURCE_DIR} ${ARMADILLO_BIN_DIR}) target_include_directories(${PROJECT_NAME} PUBLIC ${ARMADILLO_SOURCE_DIR}/include) add_compile_definitions(ARMA_DONT_USE_WRAPPER) target_link_libraries(${PROJECT_NAME} PUBLIC "/home/iason/Coding/Libraries/armadillo/build/libarmadillo.a" #[[blas lapack]]) #find_package(Armadillo REQUIRED) #target_link_libraries(${PROJECT_NAME} PUBLIC ${ARMADILLO_LIBRARIES}) #if(NOT TARGET ThreedBeamFEA) #FetchContent_Declare(armadillo # GIT_REPOSITORY https://gitlab.com/conradsnicta/armadillo-code.git # GIT_TAG "11.2.x" # ) #FetchContent_MakeAvailable(armadillo) #find_package(Armadillo REQUIRED) #endif() #target_link_libraries(${PROJECT_NAME} PUBLIC "/home/iason/Coding/build/FormFInder/Debug/_deps/armadillo-build/libarmadillo.a") if(${USE_ENSMALLEN}) set(ENSMALLEN_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/ensmallen) download_project(PROJ ENSMALLEN GIT_REPOSITORY https://github.com/mlpack/ensmallen.git GIT_TAG master BINARY_DIR ${ENSMALLEN_BINARY_DIR} PREFIX ${EXTERNAL_DEPS_DIR} ${UPDATE_DISCONNECTED_IF_AVAILABLE} ) target_include_directories(${PROJECT_NAME} PUBLIC ${ENSMALLEN_SOURCE_DIR}/include) add_compile_definitions(USE_ENSMALLEN) ###ENSMALLEN #FetchContent_Declare(ensmallen # GIT_REPOSITORY https://github.com/mlpack/ensmallen.git # GIT_TAG master # ) #FetchContent_MakeAvailable(ensmallen) #target_link_libraries(${PROJECT_NAME} PRIVATE ensmallen) #target_include_directories(${PROJECT_NAME} #PUBLIC ${ensmallen_SOURCE_DIR}/include) #add_compile_definitions(USE_ENSMALLEN) endif() ##Chrono ##add_subdirectory("/home/iason/Coding/build/external dependencies/CHRONO-src" "/home/iason/Coding/build/external dependencies/CHRONO-src/build") ##set(Chrono_DIR "/home/iason/Coding/Libraries/chrono-7.0.3/build/Release/cmake") #set(Chrono_DIR "/home/iason/Coding/Libraries/chrono-7.0.3/build/Release/cmake") ##LIST(APPEND CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}/../Chrono/lib") #find_package(Chrono CONFIG # ) #if (NOT Chrono_FOUND) # message("Could not find Chrono or one of its required modules") # return() #endif() #set_target_properties(${PROJECT_NAME} PROPERTIES # COMPILE_FLAGS "${CHRONO_CXX_FLAGS} ${EXTRA_COMPILE_FLAGS}" # COMPILE_DEFINITIONS "CHRONO_DATA_DIR=\"${CHRONO_DATA_DIR}\"" # LINK_FLAGS "${CHRONO_LINKER_FLAGS}") #include_directories(${CHRONO_INCLUDE_DIRS}) #target_link_libraries(${PROJECT_NAME} PUBLIC ${CHRONO_LIBRARIES}) target_include_directories(${PROJECT_NAME} PUBLIC "/home/iason/Coding/Libraries/chrono-7.0.3/src" #[[${CHRONO_INCLUDE_DIRS}]] #[["/home/iason/Coding/Libraries/chrono-7.0.3/src"]] #[["/usr/include/irrlicht"]] ) #target_link_directories(${PROJECT_NAME} PRIVATE "/home/iason/Coding/build/external dependencies/CHRONO-src/build/RelWithDebInfo/lib") #target_link_libraries(${PROJECT_NAME} PUBLIC "/home/iason/Coding/build/external dependencies/CHRONO-src/build/RelWithDebInfo/lib/libChronoEngine.a") target_link_libraries(${PROJECT_NAME} PUBLIC "/home/iason/Coding/Libraries/chrono-7.0.3/build/Release/lib/libChronoEngine.a") #add_subdirectory("/home/iason/Coding/Projects/Approximating shapes with flat patterns/Elastic rods/ElasticRods") #set(MESHFEM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/meshfem) #download_project(PROJ MESHFEM # GIT_REPOSITORY https://github.com/MeshFEM/MeshFEM.git # GIT_TAG 3847ffaeb6e9c4bbe15f0f81f5c773c7c481c059 # BINARY_DIR ${MESHFEM_BINARY_DIR} # PREFIX ${EXTERNAL_DEPS_DIR} # ${UPDATE_DISCONNECTED_IF_AVAILABLE} #) #add_subdirectory(${MESHFEM_SOURCE_DIR} ${MESHFEM_BINARY_DIR}) #target_link_libraries(${PROJECT_NAME} PUBLIC MeshFEM) ##target_include_directories(${PROJECT_NAME} ##PUBLIC ${MESHFEM_SOURCE_DIR}/include) ##add_compile_definitions(USE_ENSMALLEN) ##DER by panetta fork ##set(FETCHCONTENT_SOURCE_DIR_LIBIGL "/home/iason/Coding/Libraries/libigl/cmake" CACHE PATH "not set") #set(LIBIGL_INCLUDE_DIR "/home/iason/Coding/Projects/Approximating shapes with flat patterns/Elastic rods/ElasticRods/3rdparty/libigl/include") ##list(PREPEND CMAKE_MODULE_PATH "/home/iason/Coding/Libraries/libigl/cmake") ##include(libigl) ##add_subdirectory("/home/iason/Coding/Projects/Approximating shapes with flat patterns/Elastic rods/ElasticRods/3rdparty/MeshFEM/" ${EXTERNAL_DEPS_DIR}/MeshFEM) #set(DER_Panetta_dir "/home/iason/Coding/Projects/Approximating shapes with flat patterns/Elastic rods/DER_panneta_fork") #set(DER_Panetta_bin_dir "/home/iason/Coding/build/external dependencies/DER_panetta_fork") #add_subdirectory(${DER_Panetta_dir} ${DER_Panetta_bin_dir}) ##add_subdirectory("/home/iason/Coding/Projects/Approximating shapes with flat patterns/Elastic rods/ElasticRods/3rdparty/MeshFEM" "/home/iason/Coding/build/external dependencies/MeshFEM") ##add_subdirectory("/home/iason/Coding/Projects/Approximating shapes with flat patterns/Elastic rods/ElasticRods/3rdparty/RotationOptimization" "/home/iason/Coding/build/external dependencies/RotationOptimization" ) #target_link_directories(${PROJECT_NAME} PUBLIC "/home/iason/Coding/build/Elastic rods/DER_panneta_fork/Debug") #target_link_libraries(${PROJECT_NAME} PUBLIC RigidRodLinkages ElasticRods rotation_optimization MeshFEM "/home/iason/Coding/build/Elastic rods/DER_panneta_fork/Debug/3rdparty/visvalingam_simplify/src/libVisvalingamSimplify.a") #target_include_directories(${PROJECT_NAME} PUBLIC ${DER_Panetta_dir} ) ##TBB if(NOT TARGET tbb_static AND NOT TARGET tbb) # set(TBB_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/tbb) # download_project(PROJ TBB # GIT_REPOSITORY https://github.com/wjakob/tbb.git # GIT_TAG master # PREFIX ${EXTERNAL_DEPS_DIR} # BINARY_DIR ${TBB_BINARY_DIR} # ${UPDATE_DISCONNECTED_IF_AVAILABLE} # ) # option(TBB_BUILD_TESTS "Build TBB tests and enable testing infrastructure" OFF) # add_subdirectory(${TBB_SOURCE_DIR} ${TBB_BINARY_DIR}) #link_directories(${TBB_BINARY_DIR}) message("Using tbb") FetchContent_Declare(tbb GIT_REPOSITORY https://github.com/wjakob/tbb.git GIT_TAG master ) FetchContent_MakeAvailable(tbb) # target_link_libraries(${PROJECT_NAME} PRIVATE tbb_static) endif() target_link_libraries(${PROJECT_NAME} PRIVATE tbb_static)