sciapp / gr

GR framework: a graphics library for visualisation applications
Other
328 stars 54 forks source link

How can I use C library GR on Windows via Visual Studio 2019? #127

Open xiangong-code opened 3 years ago

xiangong-code commented 3 years ago

In the documentation on the GR Home Page, there is only the tutorial of how to compile and link C language source file on Linux or macOS. However, I want to use it on Windows10 via Visual Studio 2019. So what should I do to link my source file to the GR library? Thanks.

IngoMeyer441 commented 3 years ago

We don't have any developers who use Visual Studio on Windows, so I don't know any Visual Studio specific solution to this. But if you use CMake with Visual Studio and you compiled and installed GR with CMake as well, you can use our GRConfig.cmake file to include GR in your project. A simple CMakeLists.txt of your project could look like this:

cmake_minimum_required(VERSION 3.1...3.18)

project(GR_TEST LANGUAGES C)

list(APPEND CMAKE_PREFIX_PATH "<PATH-TO-GR-INSTALLATION>")
find_package(GR NO_MODULE)

add_executable(main main.c)
target_link_libraries(main PRIVATE GR::GR)