summaryrefslogtreecommitdiff
path: root/dispatch/CMakeLists.txt
blob: fc04520e449ae71d6e3e3365de8af16adeaefef1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
##############################################################################
# Dispatch

include_directories (
    ${CMAKE_CURRENT_BINARY_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}
)

add_custom_command (
    OUTPUT
        ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
        ${CMAKE_CURRENT_BINARY_DIR}/glproc.cpp
    COMMAND ${PYTHON_EXECUTABLE}
        ${CMAKE_CURRENT_SOURCE_DIR}/glproc.py
        ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
        ${CMAKE_CURRENT_BINARY_DIR}/glproc.cpp
    DEPENDS
        glproc.py
        dispatch.py
        ${CMAKE_SOURCE_DIR}/specs/wglapi.py
        ${CMAKE_SOURCE_DIR}/specs/glxapi.py
        ${CMAKE_SOURCE_DIR}/specs/cglapi.py
        ${CMAKE_SOURCE_DIR}/specs/eglapi.py
        ${CMAKE_SOURCE_DIR}/specs/glapi.py
        ${CMAKE_SOURCE_DIR}/specs/gltypes.py
        ${CMAKE_SOURCE_DIR}/specs/stdapi.py
)


# Wrap glproc.hpp as a target to prevent the command from being executed
# multiple times simulatenously, when the targets that depend on it are built
# in parallel.
add_custom_target (glproc DEPENDS
    ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
    ${CMAKE_CURRENT_BINARY_DIR}/glproc.cpp
)


add_convenience_library (glproc_gl EXCLUDE_FROM_ALL
    glproc_gl.cpp
    ${CMAKE_CURRENT_BINARY_DIR}/glproc.cpp
)

add_dependencies (glproc_gl glproc)

if (ENABLE_EGL)
    add_convenience_library (glproc_egl EXCLUDE_FROM_ALL
        glproc_egl.cpp
        ${CMAKE_CURRENT_BINARY_DIR}/glproc.cpp
    )

    add_dependencies (glproc_egl glproc)
endif ()