Build cglm — cglm 0.9.6 documentation

# Build cglm

cglm does not have any external dependencies.

Note

If you only need to inline versions, you don’t need to build cglm, you don’t need to link it to your program. Just import cglm to your project as dependency / external lib by copy-paste then use it as usual

## CMake (All platforms):

    1$ mkdir build
    2$ cd build
    3$ cmake .. # [Optional] -DCGLM_SHARED=ON
    4$ make
    5$ sudo make install # [Optional]

make will build cglm to build folder. If you don’t want to install cglm to your system’s folder you can get static and dynamic libs in this folder.

CMake Options:

    1option(CGLM_SHARED "Shared build" ON)
    2option(CGLM_STATIC "Static build" OFF)
    3option(CGLM_USE_C99 "" OFF) # C11
    4option(CGLM_USE_TEST "Enable Tests" OFF) # for make check - make test

Use as header-only library with your CMake project example This requires no building or installation of cglm.

    1cmake_minimum_required(VERSION 3.8.2)
    2
    3project(<Your Project Name>)
    4
    5add_executable(${PROJECT_NAME} src/main.c)
    6target_link_libraries(${LIBRARY_NAME} PRIVATE
    7  cglm_headers)
    8
    9add_subdirectory(external/cglm/ EXCLUDE_FROM_ALL)

Use with your CMake project example

    1cmake_minimum_required(VERSION 3.8.2)
    2
    3project(<Your Project Name>)
    4
    5add_executable(${PROJECT_NAME} src/main.c)
    6target_link_libraries(${LIBRARY_NAME} PRIVATE
    7  cglm)
    8
    9add_subdirectory(external/cglm/)

## Meson (All platforms):

    1$ meson build # [Optional] --default-library=static
    2$ cd build
    3$ ninja
    4$ sudo ninja install # [Optional]

Meson Options:

    1c_std=c11
    2buildtype=release
    3default_library=shared
    4enable_tests=false # to run tests: ninja test

Use with your Meson project

    1# Clone cglm or create a cglm.wrap under <source_root>/subprojects
    2project('name', 'c')
    3
    4cglm_dep = dependency('cglm', fallback : 'cglm', 'cglm_dep')
    5
    6executable('exe', 'src/main.c', dependencies : cglm_dep)

## Unix (Autotools):

    1$ sh autogen.sh
    2$ ./configure
    3$ make
    4$ make check            # run tests (optional)
    5$ [sudo] make install   # install to system (optional)

make will build cglm to .libs sub folder in project folder. If you don’t want to install cglm to your system’s folder you can get static and dynamic libs in this folder.

## Windows (MSBuild):

Windows related build files, project files are located in win folder, make sure you are inside in cglm/win folder.

Code Analysis are enabled, it may take awhile to build.

    1$ cd win
    2$ .\build.bat

if msbuild is not worked (because of multi versions of Visual Studio) then try to build with devenv:

    1$ devenv cglm.sln /Build Release

Currently tests are not available on Windows.

## Documentation (Sphinx):

cglm uses sphinx framework for documentation, it allows lot of formats for documentation. To see all options see sphinx build page:

https://www.sphinx-doc.org/en/master/man/sphinx-build.html

Example build:

    1$ cd cglm/docs
    2$ sphinx-build source build