

GLFW_USE_WAYLAND determines whether to compile the library for Wayland.
Cmake linux driver#
This is disabled by default, letting the operating system and driver decide. These symbols need to be exported by the EXE to be detected by the driver, so the override will not work if GLFW is built as a DLL. GLFW_USE_HYBRID_HPG determines whether to export the NvOptimusEnablement and AmdPowerXpressRequestHighPerformance symbols, which force the use of the high-performance GPU on Nvidia Optimus and AMD PowerXpress systems. On CMake 3.15 and later you can set the standard CMake CMAKE_MSVC_RUNTIME_LIBRARY variable instead of this GLFW-specific option. When enabled, the DLL version of the Visual C++ library is used. USE_MSVC_RUNTIME_LIBRARY_DLL determines whether to use the DLL version or the static library version of the Visual C++ runtime library. GLFW_VULKAN_STATIC determines whether to use the Vulkan loader linked directly with the application. This is enabled by default if Doxygen is found by CMake during configuration. GLFW_BUILD_DOCS determines whether the GLFW documentation is built along with the library. GLFW_BUILD_TESTS determines whether the GLFW test programs are built along with the library. GLFW_BUILD_EXAMPLES determines whether the GLFW examples are built along with the library. This is disabled by default, producing a static GLFW library.

The build directory is created if it doesn't already exist.Ĭmake -S path/to/glfw -B path/to/build -D BUILD_SHARED_LIBS=ONīUILD_SHARED_LIBS determines whether GLFW is built as a static library or as a DLL / shared library / dynamic library. To make a build directory, pass the source and build directories to the cmake command. Generating files with the CMake command-line tool Once you have generated the project files or makefiles for your chosen development environment, move on to Compiling the library. To use Wayland instead, set the GLFW_USE_WAYLAND option in the GLFW section of the variable list, then apply the new value as described above. The variable list will be populated after the first configure step.īy default GLFW will use X11 on Linux and other Unix-like systems other than macOS. If you wish change any CMake variables in the list, press Configure and then Generate to have the new values take effect. Start the CMake GUI and set the paths to the source and build directories described above. They also allow you to have several build directories for different configurations all using the same source tree.Ī common pattern when building a single configuration is to have a build directory named build in the root of the source tree. Out-of-tree builds are recommended as they avoid cluttering up the source tree. If these are the same, it is called an in-tree build, otherwise it is called an out-of-tree build.
Cmake linux install#
Pkg install wayland libxkbcommon wayland-protocols kf5-extra-cmake-modules On Debian and derivates like Ubuntu and Linux Mint the xorg-dev meta-package pulls in the development packages for all of X11. They are not needed to build or run programs that use GLFW. To compile GLFW for X11, you need to have the X11 development packages installed. The C/C++ development environments in Visual Studio, Xcode and MinGW come with all necessary dependencies for compiling GLFW, but on Unix-like systems like Linux and FreeBSD you will need a few extra packages.ĭependencies for X11 on Unix-like systems It may be a useful companion to this one. The CMake project has their own much more detailed CMake user guide that includes everything in this guide not specific to GLFW. If you are on a Unix-like system such as Linux, FreeBSD or Cygwin or have a package system like Fink, MacPorts or Homebrew, you can install its CMake package.ĬMake is a complex tool and this guide will only show a few of the possible ways to set up and compile GLFW.
Cmake linux download#
If you are on Windows and macOS you can download CMake from their site. To compile GLFW, first generate these files with CMake and then use them to compile the GLFW library.

GLFW uses CMake to generate project files or makefiles for your chosen development environment. If you are already familiar with this from other projects, you may want to focus on the Installing dependencies and CMake options sections for GLFW-specific information. Using CMake Note GLFW behaves like most other libraries that use CMake so this guide mostly describes the basic configure/generate/compile sequence.
Cmake linux how to#
For information on how to build applications that use GLFW, see Building applications. This is about compiling the GLFW library itself.
