From 31b8553b3944a058098ed3968def24b8b8f3c664 Mon Sep 17 00:00:00 2001 From: iasonmanolas Date: Thu, 23 Dec 2021 20:54:33 +0200 Subject: [PATCH] windows refactoring --- CMakeLists.txt | 66 +++++++++++++++++++++++++++++++------------------- polymesh.hpp | 4 +-- 2 files changed, 43 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 88c7aab..8e68454 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,14 +10,19 @@ 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 "/home/iason/Coding/build/external dependencies") +if(NOT EXISTS EXTERNAL_DEPS_DIR) set(EXTERNAL_DEPS_DIR ${CMAKE_CURRENT_BINARY_DIR}) + message("External dependencies directory set:" ${EXTERNAL_DEPS_DIR}) endif() ##Create directory for the external libraries file(MAKE_DIRECTORY ${EXTERNAL_DEPS_DIR}) #message(${POLYSCOPE_ALREADY_COMPILED}) +if(NOT DEFINED USE_POLYSCOPE) + message(FATAL_ERROR "Use polyscope was not defined") +endif() + if(${USE_POLYSCOPE}) download_project(PROJ POLYSCOPE GIT_REPOSITORY https://github.com/nmwsharp/polyscope.git @@ -40,7 +45,6 @@ endif() # ${UPDATE_DISCONNECTED_IF_AVAILABLE} #) #add_subdirectory(${DLIB_SOURCE_DIR} ${DLIB_BINARY_DIR}) - ##vcglib devel branch download_project(PROJ vcglib_devel GIT_REPOSITORY https://github.com/IasonManolas/vcglib.git @@ -49,18 +53,25 @@ download_project(PROJ vcglib_devel ${UPDATE_DISCONNECTED_IF_AVAILABLE} ) add_subdirectory(${vcglib_devel_SOURCE_DIR} ${vcglib_devel_BINARY_DIR}) +###Eigen 3 NOTE: Eigen is required on the system the code is ran +#find_package(Eigen3 3.3 REQUIRED) +download_project(PROJ EIGEN + GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git + GIT_TAG master + PREFIX ${EXTERNAL_DEPS_DIR} + ${UPDATE_DISCONNECTED_IF_AVAILABLE} +) +add_subdirectory(${EIGEN_SOURCE_DIR} ${EIGEN_BINARY_DIR}) ##threed-beam-fea download_project(PROJ threed-beam-fea - GIT_REPOSITORY https://github.com/IasonManolas/threed-beam-fea.git + GIT_REPOSITORY https://gitea-s2i2s.isti.cnr.it/manolas/threed-beam-fea.git GIT_TAG master PREFIX ${EXTERNAL_DEPS_DIR} ${UPDATE_DISCONNECTED_IF_AVAILABLE} ) add_subdirectory(${threed-beam-fea_SOURCE_DIR} ${threed-beam-fea_BINARY_DIR}) -###Eigen 3 NOTE: Eigen is required on the system the code is ran -find_package(Eigen3 3.3 REQUIRED) if(MSVC) add_compile_definitions(_HAS_STD_BYTE=0) @@ -100,13 +111,18 @@ if(USE_ENSMALLEN) ) add_subdirectory(${ENSMALLEN_SOURCE_DIR} ${ENSMALLEN_BINARY_DIR}) + download_project(PROJ ARMADILLO + GIT_REPOSITORY https://gitlab.com/conradsnicta/armadillo-code.git + GIT_TAG 10.8.x + PREFIX ${EXTERNAL_DEPS_DIR} + ${UPDATE_DISCONNECTED_IF_AVAILABLE} + ) + add_subdirectory(${ARMADILLO_SOURCE_DIR} ${ARMADILLO_BINARY_DIR}) + target_include_directories(${PROJECT_NAME} PUBLIC armadillo ) - set(ARMADILLO_SOURCE_DIR "/home/iason/Coding/Libraries/armadillo") - add_subdirectory(${ARMADILLO_SOURCE_DIR} ${EXTERNAL_DEPS_DIR}/armadillo_build) if(${MYSOURCES_STATIC_LINK}) target_link_libraries(${PROJECT_NAME} PUBLIC "-static" ensmallen ${EXTERNAL_DEPS_DIR}/armadillo_build/libarmadillo.a) else() - target_link_libraries(${PROJECT_NAME} PUBLIC) target_link_libraries(${PROJECT_NAME} PUBLIC armadillo ensmallen) endif() @@ -123,17 +139,17 @@ target_include_directories(${PROJECT_NAME} if(${MYSOURCES_STATIC_LINK} AND NOT ${USE_POLYSCOPE}) message("Linking statically") - target_link_libraries(${PROJECT_NAME} PRIVATE -static lapack blas gfortran quadmath pthread) + target_link_libraries(${PROJECT_NAME} PRIVATE -static gfortran quadmath pthread) target_link_libraries(${PROJECT_NAME} PUBLIC -static Eigen3::Eigen #[[dlib::dlib]] ThreedBeamFEA #[[${TBB_BINARY_DIR}/libtbb_static.a]]) else() + if (UNIX) + target_link_libraries(${PROJECT_NAME} PRIVATE lapack blas ) + endif() if(${USE_POLYSCOPE}) - target_link_libraries(${PROJECT_NAME} PRIVATE lapack blas gfortran quadmath pthread) - target_link_libraries(${PROJECT_NAME} PUBLIC polyscope xcb Xau) - target_include_directories(${PROJECT_NAME} - PUBLIC ${POLYSCOPE_SOURCE_DIR} - ) + target_link_libraries(${PROJECT_NAME} PUBLIC gfortran quadmath pthread ) + target_link_libraries(${PROJECT_NAME} PUBLIC polyscope xcb Xau) + target_include_directories(${PROJECT_NAME} PUBLIC ${POLYSCOPE_SOURCE_DIR}) endif() - target_link_libraries(${PROJECT_NAME} PRIVATE pthread) target_link_libraries(${PROJECT_NAME} PUBLIC Eigen3::Eigen #[[dlib::dlib]] ThreedBeamFEA matplot) endif() @@ -157,13 +173,13 @@ else() endif() #endif() -download_project(PROJ GSL - GIT_REPOSITORY https://github.com/microsoft/GSL.git - GIT_TAG master - PREFIX ${EXTERNAL_DEPS_DIR} - ${UPDATE_DISCONNECTED_IF_AVAILABLE} - ) -add_subdirectory(${GSL_SOURCE_DIR} ${GSL_BINARY_DIR}) -target_link_libraries(${PROJECT_NAME} PUBLIC GSL) -target_include_directories(${PROJECT_NAME} PUBLIC GSL) +#download_project(PROJ GSL +# GIT_REPOSITORY https://github.com/microsoft/GSL.git +# GIT_TAG master +# PREFIX ${EXTERNAL_DEPS_DIR} +# ${UPDATE_DISCONNECTED_IF_AVAILABLE} +# ) +#add_subdirectory(${GSL_SOURCE_DIR} ${GSL_BINARY_DIR}) +#target_link_libraries(${PROJECT_NAME} PUBLIC GSL) +#target_include_directories(${PROJECT_NAME} PUBLIC GSL) diff --git a/polymesh.hpp b/polymesh.hpp index aa50d47..99bfeef 100755 --- a/polymesh.hpp +++ b/polymesh.hpp @@ -128,7 +128,7 @@ public: mask |= vcg::tri::io::Mask::IOM_VERTNORMAL; mask |= vcg::tri::io::Mask::IOM_FACEINDEX; mask |= vcg::tri::io::Mask::IOM_FACECOLOR; - if (vcg::tri::io::ExporterOBJ::Save(*this, filePath.c_str(), mask) != 0) { + if (vcg::tri::io::ExporterOBJ::Save(*this, filePath.string().c_str(), mask) != 0) { return false; } return true; @@ -149,7 +149,7 @@ public: mask |= vcg::tri::io::Mask::IOM_VERTNORMAL; mask |= vcg::tri::io::Mask::IOM_FACEINDEX; mask |= vcg::tri::io::Mask::IOM_FACECOLOR; - if (vcg::tri::io::ExporterPLY::Save(*this, filePath.c_str(), mask, false) != 0) { + if (vcg::tri::io::ExporterPLY::Save(*this, filePath.string().c_str(), mask, false) != 0) { return false; } return true;