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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
|
#-----------------------------------------------------------------------------#
#
# AllegroGL
#
find_package(OpenGL)
if(NOT OPENGL_FOUND)
return()
endif()
if(UNIX AND NOT APPLE)
find_package(X11)
if(NOT X11_FOUND)
return()
endif()
set(GLX 1)
endif()
if(ALLEGRO_XWINDOWS_WITH_XF86VIDMODE)
set(ALLEGROGL_HAVE_XF86VIDMODE 1)
endif()
find_library(DLOPEN_LIB dl)
mark_as_advanced(DLOPEN_LIB)
if(DLOPEN_LIB)
set(ALLEGROGL_HAVE_DYNAMIC_LINK 1)
endif()
if(ALLEGRO_WITH_XWINDOWS)
set(CMAKE_REQUIRED_LIBRARIES ${OPENGL_gl_LIBRARY})
check_function_exists(glXGetProcAddress GLXGETPROCADDRESS_FOUND)
if(NOT GLXGETPROCADDRESS_FOUND)
check_function_exists(glXGetProcAddressARB GLXGETPROCADDRESSARB_FOUND)
if(GLXGETPROCADDRESSARB_FOUND)
set(ALLEGROGL_GLXGETPROCADDRESSARB 1)
else()
message(FATAL_ERROR "OpenGL does not export symbol glXGetProcAddress[ARB]")
endif()
endif()
set(CMAKE_REQUIRED_LIBRARIES)
endif(ALLEGRO_WITH_XWINDOWS)
# XXX Mesa generic driver support?
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/include/allegrogl/alleggl_config.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/include/allegrogl/alleggl_config.h
@ONLY
)
include_directories(SYSTEM ${OPENGL_INCLUDE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
#-----------------------------------------------------------------------------#
set(ALLEGROGL_SOURCES
src/alleggl.c
src/glvtable.c
src/scorer.c
src/math.c
src/aglf.c
src/fontconv.c
src/texture.c
src/glext.c
src/gui.c
src/videovtb.c
)
if(WIN32)
list(APPEND ALLEGROGL_SOURCES src/win.c)
endif()
if(DJGPP)
list(APPEND ALLEGROGL_SOURCES src/djgpp.c)
endif()
if(APPLE)
list(APPEND ALLEGROGL_SOURCES src/macosx.m)
endif()
if(GLX)
list(APPEND ALLEGROGL_SOURCES src/x.c)
endif()
set(ALLEGROGL_HEADERS
include/alleggl.h
include/allegrogl/gl_ext.h
include/allegrogl/gl_header_detect.h
${CMAKE_CURRENT_BINARY_DIR}/include/allegrogl/alleggl_config.h
include/allegrogl/GLext/glx_ext_alias.h
include/allegrogl/GLext/glx_ext_api.h
include/allegrogl/GLext/glx_ext_defs.h
include/allegrogl/GLext/glx_ext_list.h
include/allegrogl/GLext/gl_ext_alias.h
include/allegrogl/GLext/gl_ext_api.h
include/allegrogl/GLext/gl_ext_defs.h
include/allegrogl/GLext/gl_ext_list.h
include/allegrogl/GLext/wgl_ext_alias.h
include/allegrogl/GLext/wgl_ext_api.h
include/allegrogl/GLext/wgl_ext_defs.h
include/allegrogl/GLext/wgl_ext_list.h
)
set_source_files_properties(
include/alleggl.h
PROPERTIES
MACOSX_PACKAGE_LOCATION Headers
)
set_source_files_properties(
include/allegrogl/gl_ext.h
include/allegrogl/gl_header_detect.h
${CMAKE_CURRENT_BINARY_DIR}/include/allegrogl/alleggl_config.h
PROPERTIES
MACOSX_PACKAGE_LOCATION Headers/allegrogl
)
set_source_files_properties(
include/allegrogl/GLext/glx_ext_alias.h
include/allegrogl/GLext/glx_ext_api.h
include/allegrogl/GLext/glx_ext_defs.h
include/allegrogl/GLext/glx_ext_list.h
include/allegrogl/GLext/gl_ext_alias.h
include/allegrogl/GLext/gl_ext_api.h
include/allegrogl/GLext/gl_ext_defs.h
include/allegrogl/GLext/gl_ext_list.h
include/allegrogl/GLext/wgl_ext_alias.h
include/allegrogl/GLext/wgl_ext_api.h
include/allegrogl/GLext/wgl_ext_defs.h
include/allegrogl/GLext/wgl_ext_list.h
PROPERTIES
MACOSX_PACKAGE_LOCATION Headers/allegrogl/GLext
)
# XXX Maybe AllegroGL should be optionally dynamic?
add_our_library(allegrogl ${ADDON_LINKAGE}
${ALLEGROGL_SOURCES}
${ALLEGROGL_HEADERS}
)
set_target_properties(allegrogl
PROPERTIES
COMPILE_FLAGS -DALLEGRO_GL_SRC_BUILD
LINK_FLAGS "${ALLEGRO_LINK_FLAGS}"
OUTPUT_NAME alleggl
VERSION ${ALLEGRO_VERSION}
SOVERSION ${ALLEGRO_SOVERSION}
)
set_our_framework_properties(allegrogl AllegroGL)
target_link_libraries(allegrogl
allegro
${OPENGL_gl_LIBRARY}
${OPENGL_glu_LIBRARY}
)
sanitize_cmake_link_flags(static_link_with
${OPENGL_gl_LIBRARY}
${OPENGL_glu_LIBRARY}
)
set_target_properties(allegrogl
PROPERTIES
static_link_with "${static_link_with}"
)
install_our_library(allegrogl)
if(NOT WANT_FRAMEWORKS)
install_our_headers(${ALLEGROGL_HEADERS})
endif(NOT WANT_FRAMEWORKS)
set(SUPPORT_ALLEGROGL 1 PARENT_SCOPE)
#-----------------------------------------------------------------------------#
#
# Examples
#
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/examp)
function(add_our_example nm)
add_executable(${nm}_agl WIN32 examp/${nm}.c)
set_target_properties(${nm}_agl
PROPERTIES
OUTPUT_NAME examp/${nm}
)
target_link_libraries(${nm}_agl allegrogl)
endfunction()
if(WANT_EXAMPLES)
add_our_example(dialog)
add_our_example(dumbtest)
add_our_example(exalleg)
add_our_example(exalpfnt)
add_our_example(exblend)
add_our_example(excamera)
add_our_example(exext)
add_our_example(exgui)
add_our_example(exmasked)
add_our_example(exmipmaps)
add_our_example(extext)
add_our_example(extextur)
add_our_example(fonttest)
add_our_example(test)
add_our_example(tex)
copy_files(copy_allegrogl_example_data
examp/a1.bmp
examp/a8.bmp
examp/a24.tga
examp/a32.tga
examp/demofont.dat
examp/lucidia.dat
examp/mysha.pcx
examp/running.dat
)
endif(WANT_EXAMPLES)
#-----------------------------------------------------------------------------#
# vim: set sts=4 sw=4 et:
|