-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Opengl/Direct3D specifics, File wrapper
NEW: opengl and direct3d functions are wrapped, hope CMake is written properly for this (haven't tested on Windows) NEW: File wrapper. Users should probably use Lua's native file API, but who knows.
- Loading branch information
Showing
14 changed files
with
507 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,50 @@ | ||
# SWIG stuff | ||
find_path (ALLEGRO_INCLUDE_PATH allegro5/allegro.h) | ||
set (CMAKE_SWIG_FLAGS -I${ALLEGRO_INCLUDE_PATH}) | ||
# First, find Allegro | ||
include (FindAllegro5.cmake) | ||
|
||
# make SWIG find the headers | ||
set (CMAKE_SWIG_FLAGS -I${ALLEGRO5_INCLUDE_DIR}) | ||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_PROJECT_NAME}) | ||
# make SWIG use the same type runtime for all modules | ||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSWIG_TYPE_TABLE=${CMAKE_PROJECT_NAME}") | ||
|
||
# Include Allegro Unstable API? | ||
if (${ALLEGRO_UNSTABLE}) | ||
set (CMAKE_SWIG_FLAGS ${CMAKE_SWIG_FLAGS} -DALLEGRO_UNSTABLE) | ||
set (CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -DALLEGRO_UNSTABLE) | ||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DALLEGRO_UNSTABLE") | ||
endif (${ALLEGRO_UNSTABLE}) | ||
|
||
swig_add_module (core lua core.i) | ||
swig_link_libraries (core allegro) | ||
|
||
# Wraps an addon, as they all follow the same name convention =] | ||
function (swig_please_wrap_it addon) | ||
swig_add_module (${addon} lua ${addon}.i) | ||
swig_link_libraries (${addon} allegro allegro_${addon}) | ||
endfunction () | ||
# General modules | ||
set (addons audio acodec color font ttf image memfile dialog physfs primitives video) | ||
foreach (mod ${addons}) | ||
swig_add_module (${mod} lua ${mod}.i) | ||
swig_link_libraries (${mod} allegro allegro_${mod}) | ||
endforeach (mod) | ||
|
||
swig_please_wrap_it (audio) | ||
swig_please_wrap_it (acodec) | ||
swig_please_wrap_it (color) | ||
swig_please_wrap_it (font) | ||
swig_please_wrap_it (ttf) | ||
swig_please_wrap_it (image) | ||
swig_please_wrap_it (memfile) | ||
swig_please_wrap_it (dialog) | ||
swig_please_wrap_it (physfs) | ||
swig_please_wrap_it (primitives) | ||
swig_please_wrap_it (video) | ||
# Platform specific modules: Direct3D or OpenGL? | ||
if (${WIN32}) | ||
set (platform_specific direct3d) | ||
# Include opengl specific functions on Windows? | ||
if (${ALLEGRO_WIN32_OPENGL}) | ||
set (platform_specific "${platform_specific} opengl") | ||
endif(${ALLEGRO_WIN32_OPENGL}) | ||
else () | ||
set (platform_specific opengl) | ||
endif(${WIN32}) | ||
foreach (mod ${platform_specific}) | ||
swig_add_module (${mod} lua ${mod}.i) | ||
swig_link_libraries (${mod} allegro) | ||
endforeach (mod) | ||
|
||
# Copy Lua files | ||
file (GLOB luaSrc *.lua) | ||
file (COPY ${luaSrc} DESTINATION ${CMAKE_PROJECT_NAME}) | ||
|
||
## Install ## | ||
set (LUA_VER "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}") | ||
install (TARGETS core audio acodec color font ttf image memfile dialog physfs | ||
primitives video | ||
install (TARGETS core ${addons} ${platform_specific} | ||
LIBRARY DESTINATION lib/lua/${LUA_VER}/${CMAKE_PROJECT_NAME}) | ||
install (FILES ${luaSrc} | ||
DESTINATION share/lua/${LUA_VER}/${CMAKE_PROJECT_NAME}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.