You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there are two possibilities to include matplot++ in the code. First is external lib installed before and second have all the files in working dir. The second option works, but not the first. The motivation was trying the OpenGL run, but I was not successful even with the basic stuff. Do you have an idea what could go wrong?
Here is my CMakeLists.txt ; it first downloads CPM and then decides whether download Matplot++ as well, or just includes the one in the system. I copied most of it from manuals:
cmake_minimum_required(VERSION 3.14.0)
project(partdyn VERSION 0.1.0)
## FROM CPM WEBSITE ########
set(CPM_DOWNLOAD_VERSION 0.35.0)
if(CPM_SOURCE_CACHE)
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
elseif(DEFINED ENV{CPM_SOURCE_CACHE})
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
else()
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
endif()
if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
file(DOWNLOAD
https://github.com/TheLartians/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
${CPM_DOWNLOAD_LOCATION}
)
endif()
include(${CPM_DOWNLOAD_LOCATION})
## FROM MATPLOT++ WEBSITE ########
find_package(Matplot++ QUIET)
if(NOT Matplot++_FOUND)
CPMAddPackage(
NAME matplotplusplus
GITHUB_REPOSITORY alandefreitas/matplotplusplus
GIT_TAG origin/master # or whatever tag you want
)
endif()
##########
include(CTest)
enable_testing()
##########
add_executable(partdyn
src/test/graph.cpp
#src/test/opengl.cpp#src/main.cpp src/particle.cpp src/include/particle.h
)
##########
target_link_libraries(partdyn PUBLIC matplot) ## FROM MATPLOT++ WEBSITE ########
target_link_libraries(partdyn PUBLIC tbb)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
# specify the C++ standard
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O2")
The code above works unless I try to build Matplot++ separately
Here are steps for compiling Matplot++ :
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi there are two possibilities to include matplot++ in the code. First is external lib installed before and second have all the files in working dir. The second option works, but not the first. The motivation was trying the OpenGL run, but I was not successful even with the basic stuff. Do you have an idea what could go wrong?
Here is my CMakeLists.txt ; it first downloads CPM and then decides whether download Matplot++ as well, or just includes the one in the system. I copied most of it from manuals:
The code above works unless I try to build Matplot++ separately
Here are steps for compiling Matplot++ :
And this is terminal output:
and I get this error when building in VS Code:
Beta Was this translation helpful? Give feedback.
All reactions