#
# FIXME: create config.h from config.h.in
-# FIXME: compile miniswig
-# FIXME: use miniswig to create squirrel wrappers
# FIXME: create messages.pot for levels
# FIXME: provide working install target
#
set(ENABLE_BINRELOC 0 CACHE BOOL "Enable autopackage's BINRELOC features")
set(APPDATADIR "" CACHE STRING "APPDATADIR for autopackage's BINRELOC features")
set(ENABLE_SQDBG 0 CACHE BOOL "Build squirrel script interpreter with debugging options")
+set(ENABLE_OPENGL 1 CACHE BOOL "Enable OpenGL support")
## Search here for additional cmake modules (for finding deps)
INCLUDE_DIRECTORIES(${SDLIMAGE_INCLUDE_DIR})
LINK_LIBRARIES(${SDLIMAGE_LIBRARY})
-FIND_PACKAGE(OpenGL REQUIRED)
-INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
-LINK_LIBRARIES(${OPENGL_LIBRARY})
+IF(ENABLE_OPENGL)
+ FIND_PACKAGE(OpenGL)
+ INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
+ LINK_LIBRARIES(${OPENGL_LIBRARY})
+ SET(HAVE_OPENGL OPENGL_FOUND)
+ENDIF(ENABLE_OPENGL)
FIND_PACKAGE(OpenAL REQUIRED)
INCLUDE_DIRECTORIES(${OPENAL_INCLUDE_DIR})
configure_file(config.h.cmake ${CMAKE_BINARY_DIR}/config.h )
include_directories (${CMAKE_BINARY_DIR}/)
+## Also execute instructions in tools/miniswig/CMakeLists.txt
+ADD_SUBDIRECTORY(tools/miniswig)
+
## Also execute instructions in src/squirrel/CMakeLists.txt
ADD_SUBDIRECTORY(src/squirrel)
FILE(GLOB SUPERTUX_SOURCES RELATIVE ${SUPERTUX_SOURCE_DIR} src/*.cpp src/audio/*.cpp src/badguy/*.cpp src/binreloc/*.cpp src/control/*.cpp src/gui/*.cpp src/lisp/*.cpp src/math/*.cpp src/object/*.cpp src/physfs/*.cpp src/sprite/*.cpp src/tinygettext/*.cpp src/trigger/*.cpp src/video/*.cpp src/worldmap/*.cpp src/scripting/*.cpp)
+## Generate miniswig wrapper
+
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.cpp ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.hpp
+ COMMAND ${CMAKE_CXX_COMPILER}
+ ARGS -x "c++" -E -CC -DSCRIPTING_API -I${SUPERTUX_SOURCE_DIR}/src/ -I${SUPERTUX_SOURCE_DIR}/src/squirrel/include/ ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.interface.hpp -o miniswig.tmp
+ COMMAND tools/miniswig/miniswig
+ ARGS --input miniswig.tmp --output-cpp ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.cpp --output-hpp ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.hpp --module supertux --select-namespace Scripting
+ DEPENDS src/scripting/wrapper.interface.hpp tools/miniswig/miniswig
+)
+
## If xgettext is available, generate messages.pot for sources
FIND_PROGRAM(
## Add target for supertux binary
-ADD_EXECUTABLE(supertux ${SUPERTUX_SOURCES} )
+ADD_EXECUTABLE(supertux2 ${SUPERTUX_SOURCES} )
## Link supertux binary with squirrel
-TARGET_LINK_LIBRARIES(supertux squirrel)
+TARGET_LINK_LIBRARIES(supertux2 squirrel)
## After building, copy binary to source root
ADD_CUSTOM_COMMAND(
- TARGET supertux
+ TARGET supertux2
POST_BUILD
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy supertux ${SUPERTUX_SOURCE_DIR}/supertux
+ ARGS -E copy supertux2 ${SUPERTUX_SOURCE_DIR}/supertux2
)
--- /dev/null
+#
+# SuperTux - miniswig build script
+# Copyright (C) 2007 Timothy Goya <tuxdev103@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+## Project name to use as command prefix
+
+PROJECT(MINISWIG)
+
+## add additional compiler switches
+
+ADD_DEFINITIONS(-include ${CMAKE_BINARY_DIR}/config.h)
+
+## Add target for bison parser generation
+
+FIND_PROGRAM(BISON_EXECUTABLE bison)
+IF (NOT BISON_EXECUTABLE)
+ MESSAGE(FATAL_ERROR "bison not found - aborting")
+ENDIF (NOT BISON_EXECUTABLE)
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${MINISWIG_SOURCE_DIR}/parser.cpp ${MINISWIG_SOURCE_DIR}/parser.hpp
+ COMMAND ${BISON_EXECUTABLE}
+ ARGS -d -o ${MINISWIG_SOURCE_DIR}/parser.cpp ${MINISWIG_SOURCE_DIR}/parser.yy
+ DEPENDS parser.yy
+)
+
+## Add target for flex lexical analyzer generation
+
+FIND_PROGRAM(FLEX_EXECUTABLE flex)
+IF (NOT FLEX_EXECUTABLE)
+ MESSAGE(FATAL_ERROR "flex not found - aborting")
+ENDIF (NOT FLEX_EXECUTABLE)
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${MINISWIG_SOURCE_DIR}/lexer.cpp
+ COMMAND ${FLEX_EXECUTABLE}
+ ARGS -o ${MINISWIG_SOURCE_DIR}/lexer.cpp ${MINISWIG_SOURCE_DIR}/lexer.ll
+ DEPENDS lexer.ll ${MINISWIG_SOURCE_DIR}/parser.hpp
+)
+
+## build list of source files
+
+FILE(GLOB MINISWIG_SOURCES RELATIVE ${MINISWIG_SOURCE_DIR} *.cpp)
+
+## Add target for miniswig binary
+
+ADD_EXECUTABLE(miniswig ${MINISWIG_SOURCES} ${MINISWIG_SOURCE_DIR}/parser.cpp ${MINISWIG_SOURCE_DIR}/lexer.cpp)