dimanche 31 décembre 2023

How to compile an OpenGL project in CMake in Wayland desktop environment?

I'm trying to setup a project that uses OpenGL as library for graphic development; in particular, I want to use CMake for compiling the project to make it cross-platform. I'm running the project on Arch Linux distro with KDE as desktop environment.

This is my CMakeLists.txt:

cmake_minimum_required(VERSION 3.5.0)
project(run VERSION 0.1.0 LANGUAGES C CXX)

include(CTest)
enable_testing()

add_executable(run main.cpp)
target_link_libraries(
    run PUBLIC
    /usr/lib/libglut.so.3
    /usr/lib/libOpenGL.so.0
    /usr/lib/libglfw.so.3.3
    /usr/lib/libGLEW.so.2.2
    /usr/lib/libdecor/plugins-1/libdecor-gtk.so
)
################################################
set(INCLUDE_ROOT_FOLDER "/usr/include")

target_include_directories(
    run PUBLIC
    ${INCLUDE_ROOT_FOLDER}/GL
    ${INCLUDE_ROOT_FOLDER}/GLFW
    ${INCLUDE_ROOT_FOLDER}/libdecor-0
    ${INCLUDE_ROOT_FOLDER}
)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)

and this is main.cpp:

#include <iostream>
#include <glew.h>
#include <glut.h>
#include <GLFW/glfw3.h>

int main()
{
    glutInitDisplayMode(GLUT_RGB);
    glfwInit();
    return 0;
}

When compiling, everything is fine. However, this is the error I get at run-time: xkbcommon: ERROR: couldn't find a Compose file for locale "it_IT..UTF-8" (mapped to "it_IT..UTF-8") libdecor-gtk-WARNING: Failed to initialize GTK Failed to load plugin 'libdecor-gtk.so': failed to init

Aucun commentaire:

Enregistrer un commentaire