Skip to content

How to compile GLVis for Windows? #271

Open

Description

@rozerinyildiz23

In our project, we want to call GLVis as a library and compile it on Windows. It is recommended to compile it with CMake for Windows, but sufficient explanation is not given. What solution would you suggest regarding this?

Activity

  1. justinlaughlin commented on Feb 7, 2024

    @justinlaughlin
    Contributor

    Hello and welcome! What steps have you tried so far? I think CMake-gui or VSC + CMake would be the simplest route. One thing to note is that the GLVis makefile sets some useful environmental variables such as MFEM_DIR which might not be set if only using CMake.

    Personally I use WSL for almost everything code related, which has improved significantly over the past several years. Through WSL I can run any graphical application, including GLVis, and it feels like a native Windows tool. I know that is kind of an indirect answer but it is maybe an option to consider.

    Cheers,
    Justin

  2. v-dobrev commented on Feb 7, 2024

    @v-dobrev
    Member

    Did you see this section:

    glvis/INSTALL

    Lines 140 to 172 in 84c4ebb

    - On Windows, GLVis can be built in two ways:
    1) Via a Linux-compatible environment, such as Cygwin or Windows Subsystem for
    Linux (WSL).
    Install the required dependencies, following the directions above for your
    WSL environment's Linux distribution, then continue with the build method
    of your choice.
    For WSL, you may also need to install an X server to run GLVis, such as
    VcXsrv (https://sourceforge.net/projects/vcxsrv/).
    2) As a native Windows executable. This enables support for platform-native
    visualization windows, as well as the modern OpenGL backend.
    Visual Studio or another Windows-compatible compiler is required.
    It is recommended to install dependencies via vcpkg:
    vcpkg install fontconfig freetype sdl2 glew glm libpng \
    --triplet=x64-windows
    After installing, proceed with the CMake configuration process, making sure
    to point the CMake variable CMAKE_TOOLCHAIN_FILE to the correct path, based
    on the directory where you installed vcpkg. More directions can be found in
    the link below:
    https://vcpkg.readthedocs.io/en/latest/examples/installing-and-using-packages/#cmake
    You may then open the generated Visual Studio project files to build GLVis,
    or call the following command from the GLVis project root directory:
    cmake --build [build directory] --parallel

  3. v-dobrev commented on Feb 7, 2024

    @v-dobrev
    Member

    Old issues regarding Windows may also be helpful: https://github.com/GLVis/glvis/issues?q=is%3Aissue+windows.

  4. altineller commented on Feb 8, 2024

    @altineller

    I am very interested to see the solution of this one as well. Is it possible to see the compilation instructions of the binary published?

  5. tzanio commented on Feb 8, 2024

    @tzanio
    Member

    @publixsubfan can confirm, but I believe the build is happening in the GitHub CI: https://github.com/GLVis/glvis/blob/master/.github/workflows/builds.yml

  6. v-dobrev commented on Feb 12, 2024

    @v-dobrev
    Member

    Actually, I think the action that creates binaries is this: https://github.com/GLVis/glvis/blob/master/.github/workflows/release.yml. This action builds macOS and Windows binaries and uploads them as artifacts, e.g. see here: https://github.com/GLVis/glvis/actions/runs/6814543178, at the bottom of the page -- unfortunately, the artifacts are kept just for a short time, so the binaries from that build are not available anymore.

    Maybe we can upload them as GitHub packages when build, so they can be downloaded from GitHub from the "Packages" section on the right of the main GLVis/glvis repo page. @jandrej is this something that can be easily done? This way we can always have the latest binaries from master available.

    By the way, the macOS and Windows binaries available on the GLVis website, https://glvis.org, are stored in the repo https://github.com/GLVis/releases and correspond to the latest release, v4.2, at the moment.

  7. altineller commented on Feb 14, 2024

    @altineller

    Actually, I think the action that creates binaries is this: https://github.com/GLVis/glvis/blob/master/.github/workflows/release.yml. This action builds macOS and Windows binaries and uploads them as artifacts, e.g. see here: https://github.com/GLVis/glvis/actions/runs/6814543178, at the bottom of the page -- unfortunately, the artifacts are kept just for a short time, so the binaries from that build are not available anymore.

    Maybe we can upload them as GitHub packages when build, so they can be downloaded from GitHub from the "Packages" section on the right of the main GLVis/glvis repo page. @jandrej is this something that can be easily done? This way we can always have the latest binaries from master available.

    By the way, the macOS and Windows binaries available on the GLVis website, https://glvis.org, are stored in the repo https://github.com/GLVis/releases and correspond to the latest release, v4.2, at the moment.

    Hello VDobrev,

    We are running glVis on windows from the binary package download, but we are looking for ways to compile glVis under windows. I am a linux user of 25+ years, and I have been lost in windows build process. Almost passed the glew dependency issue, but there are number of dependencies that make this very diffucult in windows. In linux what is just one command, takes hours of blind research on windows.

    Best Regards,
    Can

  8. v-dobrev commented on Feb 14, 2024

    @v-dobrev
    Member

    @altineller, are you using vcpkg to build the dependencies? This is what we recommend in the INSTALL file for windows-native build:

    glvis/INSTALL

    Lines 152 to 172 in 84c4ebb

    2) As a native Windows executable. This enables support for platform-native
    visualization windows, as well as the modern OpenGL backend.
    Visual Studio or another Windows-compatible compiler is required.
    It is recommended to install dependencies via vcpkg:
    vcpkg install fontconfig freetype sdl2 glew glm libpng \
    --triplet=x64-windows
    After installing, proceed with the CMake configuration process, making sure
    to point the CMake variable CMAKE_TOOLCHAIN_FILE to the correct path, based
    on the directory where you installed vcpkg. More directions can be found in
    the link below:
    https://vcpkg.readthedocs.io/en/latest/examples/installing-and-using-packages/#cmake
    You may then open the generated Visual Studio project files to build GLVis,
    or call the following command from the GLVis project root directory:
    cmake --build [build directory] --parallel

    Are the issues with the vcpkg installation of the dependencies, or after that when building GLVis with cmake?

  9. altineller commented on Feb 15, 2024

    @altineller

    @v-dobrev that indeed worked. thank you. the problem was we were trying to install all these dependencies by hand instead of a toolchain file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions