Added variable for using polyscope or not. When its not used static linking is used.

This commit is contained in:
iasonmanolas 2021-03-15 19:56:02 +02:00
parent e14a43bb26
commit bde1e029bb
1 changed files with 38 additions and 28 deletions

View File

@ -14,15 +14,21 @@ endif()
##Create directory for the external libraries
file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/build/external)
#find_package(OpenMP REQUIRED)
##matplot++ lib
download_project(PROJ MATPLOTPLUSPLUS
GIT_REPOSITORY https://github.com/alandefreitas/matplotplusplus
##Polyscope
set(USE_POLYSCOPE FALSE)
if(${USE_POLYSCOPE})
download_project(PROJ POLYSCOPE
GIT_REPOSITORY https://github.com/nmwsharp/polyscope.git
GIT_TAG master
PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/build/external/
${UPDATE_DISCONNECTED_IF_AVAILABLE}
)
add_subdirectory(${MATPLOTPLUSPLUS_SOURCE_DIR})
)
add_subdirectory(${POLYSCOPE_SOURCE_DIR})
add_compile_definitions(POLYSCOPE_DEFINED)
endif()
set(MYSOURCES_SOURCE_DIR "/home/iason/Coding/Libraries/MySources")
if (EXISTS ${MYSOURCES_SOURCE_DIR})
@ -34,24 +40,14 @@ download_project(PROJ MYSOURCES
PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/build/external/
${UPDATE_DISCONNECTED_IF_AVAILABLE}
)
endif()
add_subdirectory(${MYSOURCES_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/MySourcesBinDir)
##Polyscope
download_project(PROJ POLYSCOPE
GIT_REPOSITORY https://github.com/nmwsharp/polyscope.git
GIT_TAG master
PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/build/external/
${UPDATE_DISCONNECTED_IF_AVAILABLE}
)
add_subdirectory(${POLYSCOPE_SOURCE_DIR})
add_compile_definitions(POLYSCOPE_DEFINED)
#dlib
##dlib
download_project(PROJ DLIB
GIT_REPOSITORY https://github.com/davisking/dlib.git
GIT_TAG master
PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/build/external/
PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/build/external/
${UPDATE_DISCONNECTED_IF_AVAILABLE}
)
add_subdirectory(${DLIB_SOURCE_DIR})
@ -66,11 +62,20 @@ download_project(PROJ vcglib_devel
)
file(GLOB EXT_SOURCES ${vcglib_devel_SOURCE_DIR}/wrap/ply/plylib.cpp)
##threed-beam-fea
download_project(PROJ threed-beam-fea
GIT_REPOSITORY https://github.com/IasonManolas/threed-beam-fea.git
GIT_TAG master
PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/build/external/
${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)
file(GLOB MYSOURCES ${MYSOURCES_SOURCE_DIR}/*.hpp ${MYSOURCES_SOURCE_DIR}/*.cpp
)
#find_package(OpenMP REQUIRED)
#Add the project sources
file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
@ -78,15 +83,20 @@ if(MSVC)
add_compile_definitions(_HAS_STD_BYTE=0)
endif(MSVC)
add_executable(${PROJECT_NAME} ${SOURCES} ${MYSOURCES} ${EXT_SOURCES} )
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20)
add_executable(${PROJECT_NAME} ${SOURCES} ${EXT_SOURCES})
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20)
target_include_directories(${PROJECT_NAME}
PRIVATE ${vcglib_devel_SOURCE_DIR}
PRIVATE ${MYSOURCES_SOURCE_DIR}
PRIVATE ${MYSOURCES_SOURCE_DIR}/boost_graph
PUBLIC ${vcglib_devel_SOURCE_DIR}
PUBLIC ${threed-beam-fea_SOURCE_DIR}/include
PUBLIC ${MYSOURCES_SOURCE_DIR}
PUBLIC ${MYSOURCES_SOURCE_DIR}/boost_graph
)
link_directories(${MYSOURCES_SOURCE_DIR}/boost_graph/libs)
target_link_libraries(${PROJECT_NAME} polyscope Eigen3::Eigen matplot dlib::dlib)
#target_link_libraries(${PROJECT_NAME} -static Eigen3::Eigen matplot dlib::dlib)
target_link_directories(${PROJECT_NAME} PRIVATE ${MYSOURCES_SOURCE_DIR}/boost_graph/libs/)
if(${USE_POLYSCOPE})
target_link_libraries(${PROJECT_NAME} polyscope Eigen3::Eigen matplot dlib::dlib ThreedBeamFEA MySources)
else()
target_link_libraries(${PROJECT_NAME} -static Eigen3::Eigen matplot dlib::dlib ThreedBeamFEA MySources)
endif()