###############################################################################
# 
#  Copyright (2008) Alexander Stukowski
#
#  This file is part of OVITO (Open Visualization Tool).
#
#  OVITO 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.
#
#  OVITO 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, see <http://www.gnu.org/licenses/>.
#
###############################################################################

# The header files that need to be processed by the QT meta-object compiler.
SET(Scripting_MOC_HDRS
	engine/ScriptEngine.h
	engine/StartupScriptExecutor.h
	plugins/ScriptPlugin.h
)

# The regular source files of this library.
SET(Scripting_SRCS
	engine/ScriptEngine.cpp		
	engine/StartupScriptExecutor.cpp		
	plugins/ScriptPlugin.cpp
	plugins/ScriptPluginClassDescriptor.cpp
	interface/PythonInterface.cpp
	interface/LinAlg.cpp			
	interface/TriMesh.cpp			
	interface/Viewport.cpp			
	interface/Plugins.cpp
	interface/Reference.cpp		
	interface/Data.cpp
	interface/Scene.cpp	
	interface/Animation.cpp
	interface/Rendering.cpp
	interface/Actions.cpp
)

# Use the QT meta-object compiler to generate additional code.
QT4_WRAP_CPP(Scripting_MOC_SRCS ${Scripting_MOC_HDRS} OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED)

# Generate plugin module.
OVITO_PLUGIN(Scripting
	SOURCES PrecompiledHeader.cpp ${Scripting_SRCS} ${Scripting_MOC_SRCS}
	PCH "${CMAKE_SOURCE_DIR}/src/core/Core.h"
)

# Add Python libraries for scripting
TARGET_LINK_LIBRARIES(Scripting ${Boost_PYTHON_LIBRARY} ${PYTHON_UTIL_LIBRARY} ${PYTHON_LIBRARIES})

# Create sub directories for the script files
FILE(MAKE_DIRECTORY "${OVITO_SHARE_DIRECTORY}/scripts")

# Copy the shell script to the output directory that can be used to launch the non-GUI script interpreter.
CONFIGURE_FILE("resources/ovitos" "${OVITO_BINARY_DIRECTORY}/ovitos" COPYONLY)
INSTALL(PROGRAMS "resources/ovitos" DESTINATION "${OVITO_RELATIVE_BINARY_DIRECTORY}")

