File use-system-luabind.patch of Package valyriatear
diff -Nur old/CMake/Modules/FindLuabind.cmake new/CMake/Modules/FindLuabind.cmake
--- old/CMake/Modules/FindLuabind.cmake 1970-01-01 01:00:00.000000000 +0100
+++ new/CMake/Modules/FindLuabind.cmake 2016-01-28 14:33:38.885950411 +0100
@@ -0,0 +1,47 @@
+# - Try to find luabind
+# Once done this will define
+#
+# Luabind_FOUND - system has luabind
+# Luabind_INCLUDE_DIR
+# Luabind_LIBRARIES - luabind libraries
+#
+# $LuabindDIR is an environment variable used
+# for finding luabind.
+
+INCLUDE(FindPackageHandleStandardArgs)
+
+FIND_PATH(Luabind_INCLUDE_DIR luabind/luabind.hpp
+PATHS $ENV{LuabindDIR}
+PATH_SUFFIXES include
+)
+
+IF(WIN32)
+FIND_LIBRARY(Luabind_LIBRARIES
+NAMES libluabind libluabind-static
+PATHS $ENV{LuabindDIR}
+PATH_SUFFIXES Release
+)
+ELSE()
+FIND_LIBRARY(Luabind_LIBRARIES
+NAMES luabind
+PATH_SUFFIXES lib
+)
+ENDIF(WIN32)
+
+# Handle the REQUIRED argument and set Luabind_FOUND
+IF(NOT WIN32)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Luabind DEFAULT_MSG
+Luabind_LIBRARIES
+Luabind_INCLUDE_DIR
+)
+ELSE()
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Luabind DEFAULT_MSG
+Luabind_LIBRARIES
+Luabind_INCLUDE_DIR
+)
+ENDIF(NOT WIN32)
+
+MARK_AS_ADVANCED(
+Luabind_INCLUDE_DIR
+Luabind_LIBRARIES
+)
diff -Nur old/src/CMakeLists.txt new/src/CMakeLists.txt
--- old/src/CMakeLists.txt 2016-01-28 14:08:20.629440966 +0100
+++ new/src/CMakeLists.txt 2016-01-28 14:28:35.896322092 +0100
@@ -11,6 +11,9 @@
FIND_PACKAGE(PNG REQUIRED)
FIND_PACKAGE(Gettext REQUIRED)
FIND_PACKAGE(Boost 1.46.1 REQUIRED)
+IF(USE_SYSTEM_LUABIND)
+ FIND_PACKAGE(Luabind REQUIRED)
+ENDIF()
# Set the release mode if not told otherwise
IF(NOT CMAKE_BUILD_TYPE)
@@ -118,16 +121,17 @@
${PNG_INCLUDE_DIR}
${LUA_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}
+ ${Luabind_INCLUDE_DIRS}
)
-INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/luabind")
-MESSAGE(STATUS "Using included luabind files")
-
-CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/luabind/build_information.hpp.cmake_in" "${CMAKE_CURRENT_SOURCE_DIR}/luabind/luabind/build_information.hpp")
-MESSAGE(STATUS "Configured luabind information file...")
-
-# Enable C++11 in luabind
-SET(FLAGS "${FLAGS} -DLUABIND_USE_CXX11")
+IF(NOT USE_SYSTEM_LUABIND)
+ INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/luabind")
+ MESSAGE(STATUS "Using included luabind files")
+ CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/luabind/build_information.hpp.cmake_in" "${CMAKE_CURRENT_SOURCE_DIR}/luabind/luabind/build_information.hpp")
+ MESSAGE(STATUS "Configured luabind information file...")
+ # Enable C++11 in luabind
+ SET(FLAGS "${FLAGS} -DLUABIND_USE_CXX11")
+ENDIF()
# enable rc-handling with mingw
# most likely this part can be kicked out with some later cmake version
@@ -152,98 +156,100 @@
MARK_AS_ADVANCED(SDLIMAGE_INCLUDE_DIR)
MARK_AS_ADVANCED(SDLIMAGE_LIBRARY)
-SET(SRCS_LUABIND
-luabind/src/class_registry.cpp
-luabind/src/class_rep.cpp
-luabind/src/object_rep.cpp
-luabind/src/pcall.cpp
-luabind/src/scope.cpp
-luabind/src/stack_content_by_name.cpp
-luabind/src/inheritance.cpp
-luabind/src/class.cpp
-luabind/src/error.cpp
-luabind/src/weak_ref.cpp
-luabind/src/class_info.cpp
-luabind/src/create_class.cpp
-luabind/src/function.cpp
-luabind/src/link_compatibility.cpp
-luabind/src/exception_handler.cpp
-luabind/src/wrapper_base.cpp
-luabind/src/open.cpp
-luabind/src/lua51compat.cpp
-luabind/luabind/prefix.hpp
-luabind/luabind/operator.hpp
-luabind/luabind/back_reference_fwd.hpp
-luabind/luabind/config.hpp
-luabind/luabind/out_value_policy.hpp
-luabind/luabind/return_reference_to_policy.hpp
-luabind/luabind/back_reference.hpp
-luabind/luabind/function.hpp
-luabind/luabind/object.hpp
-luabind/luabind/scope.hpp
-luabind/luabind/copy_policy.hpp
-luabind/luabind/version.hpp
-luabind/luabind/container_policy.hpp
-luabind/luabind/class.hpp
-luabind/luabind/lua_include.hpp
-luabind/luabind/open.hpp
-luabind/luabind/get_pointer.hpp
-luabind/luabind/raw_policy.hpp
-luabind/luabind/class_info.hpp
-luabind/luabind/get_main_thread.hpp
-luabind/luabind/luabind.hpp
-luabind/luabind/from_stack.hpp
-luabind/luabind/dependency_policy.hpp
-luabind/luabind/typeid.hpp
-luabind/luabind/adopt_policy.hpp
-luabind/luabind/weak_ref.hpp
-luabind/luabind/iterator_policy.hpp
-luabind/luabind/shared_ptr_converter.hpp
-luabind/luabind/discard_result_policy.hpp
-luabind/luabind/exception_handler.hpp
-luabind/luabind/value_wrapper.hpp
-luabind/luabind/make_function.hpp
-luabind/luabind/tag_function.hpp
-luabind/luabind/nil.hpp
-luabind/luabind/handle.hpp
-luabind/luabind/detail/object_rep.hpp
-luabind/luabind/detail/enum_maker.hpp
-luabind/luabind/detail/call_function.hpp
-luabind/luabind/detail/format_signature.hpp
-luabind/luabind/detail/constructor.hpp
-luabind/luabind/detail/object_call.hpp
-luabind/luabind/detail/inheritance.hpp
-luabind/luabind/detail/decorate_type.hpp
-luabind/luabind/detail/primitives.hpp
-luabind/luabind/detail/convert_to_lua.hpp
-luabind/luabind/detail/most_derived.hpp
-luabind/luabind/detail/stack_utils.hpp
-luabind/luabind/detail/open.hpp
-luabind/luabind/detail/property.hpp
-luabind/luabind/detail/other.hpp
-luabind/luabind/detail/link_compatibility.hpp
-luabind/luabind/detail/typetraits.hpp
-luabind/luabind/detail/has_get_pointer.hpp
-luabind/luabind/detail/debug.hpp
-luabind/luabind/detail/garbage_collector.hpp
-luabind/luabind/detail/instance_holder.hpp
-luabind/luabind/detail/class_rep.hpp
-luabind/luabind/detail/signature_match.hpp
-luabind/luabind/detail/call_member.hpp
-luabind/luabind/detail/pointee_sizeof.hpp
-luabind/luabind/detail/policy.hpp
-luabind/luabind/detail/deduce_signature.hpp
-luabind/luabind/detail/class_registry.hpp
-luabind/luabind/detail/yes_no.hpp
-luabind/luabind/detail/operator_id.hpp
-luabind/luabind/detail/make_instance.hpp
-luabind/luabind/detail/pcall.hpp
-luabind/luabind/detail/call.hpp
-luabind/luabind/detail/call_operator_iterate.hpp
-luabind/luabind/yield_policy.hpp
-luabind/luabind/error.hpp
-luabind/luabind/wrapper_base.hpp
-)
+IF(NOT USE_SYSTEM_LUABIND)
+ SET(SRCS_LUABIND
+ luabind/src/class_registry.cpp
+ luabind/src/class_rep.cpp
+ luabind/src/object_rep.cpp
+ luabind/src/pcall.cpp
+ luabind/src/scope.cpp
+ luabind/src/stack_content_by_name.cpp
+ luabind/src/inheritance.cpp
+ luabind/src/class.cpp
+ luabind/src/error.cpp
+ luabind/src/weak_ref.cpp
+ luabind/src/class_info.cpp
+ luabind/src/create_class.cpp
+ luabind/src/function.cpp
+ luabind/src/link_compatibility.cpp
+ luabind/src/exception_handler.cpp
+ luabind/src/wrapper_base.cpp
+ luabind/src/open.cpp
+ luabind/src/lua51compat.cpp
+ luabind/luabind/prefix.hpp
+ luabind/luabind/operator.hpp
+ luabind/luabind/back_reference_fwd.hpp
+ luabind/luabind/config.hpp
+ luabind/luabind/out_value_policy.hpp
+ luabind/luabind/return_reference_to_policy.hpp
+ luabind/luabind/back_reference.hpp
+ luabind/luabind/function.hpp
+ luabind/luabind/object.hpp
+ luabind/luabind/scope.hpp
+ luabind/luabind/copy_policy.hpp
+ luabind/luabind/version.hpp
+ luabind/luabind/container_policy.hpp
+ luabind/luabind/class.hpp
+ luabind/luabind/lua_include.hpp
+ luabind/luabind/open.hpp
+ luabind/luabind/get_pointer.hpp
+ luabind/luabind/raw_policy.hpp
+ luabind/luabind/class_info.hpp
+ luabind/luabind/get_main_thread.hpp
+ luabind/luabind/luabind.hpp
+ luabind/luabind/from_stack.hpp
+ luabind/luabind/dependency_policy.hpp
+ luabind/luabind/typeid.hpp
+ luabind/luabind/adopt_policy.hpp
+ luabind/luabind/weak_ref.hpp
+ luabind/luabind/iterator_policy.hpp
+ luabind/luabind/shared_ptr_converter.hpp
+ luabind/luabind/discard_result_policy.hpp
+ luabind/luabind/exception_handler.hpp
+ luabind/luabind/value_wrapper.hpp
+ luabind/luabind/make_function.hpp
+ luabind/luabind/tag_function.hpp
+ luabind/luabind/nil.hpp
+ luabind/luabind/handle.hpp
+ luabind/luabind/detail/object_rep.hpp
+ luabind/luabind/detail/enum_maker.hpp
+ luabind/luabind/detail/call_function.hpp
+ luabind/luabind/detail/format_signature.hpp
+ luabind/luabind/detail/constructor.hpp
+ luabind/luabind/detail/object_call.hpp
+ luabind/luabind/detail/inheritance.hpp
+ luabind/luabind/detail/decorate_type.hpp
+ luabind/luabind/detail/primitives.hpp
+ luabind/luabind/detail/convert_to_lua.hpp
+ luabind/luabind/detail/most_derived.hpp
+ luabind/luabind/detail/stack_utils.hpp
+ luabind/luabind/detail/open.hpp
+ luabind/luabind/detail/property.hpp
+ luabind/luabind/detail/other.hpp
+ luabind/luabind/detail/link_compatibility.hpp
+ luabind/luabind/detail/typetraits.hpp
+ luabind/luabind/detail/has_get_pointer.hpp
+ luabind/luabind/detail/debug.hpp
+ luabind/luabind/detail/garbage_collector.hpp
+ luabind/luabind/detail/instance_holder.hpp
+ luabind/luabind/detail/class_rep.hpp
+ luabind/luabind/detail/signature_match.hpp
+ luabind/luabind/detail/call_member.hpp
+ luabind/luabind/detail/pointee_sizeof.hpp
+ luabind/luabind/detail/policy.hpp
+ luabind/luabind/detail/deduce_signature.hpp
+ luabind/luabind/detail/class_registry.hpp
+ luabind/luabind/detail/yes_no.hpp
+ luabind/luabind/detail/operator_id.hpp
+ luabind/luabind/detail/make_instance.hpp
+ luabind/luabind/detail/pcall.hpp
+ luabind/luabind/detail/call.hpp
+ luabind/luabind/detail/call_operator_iterate.hpp
+ luabind/luabind/yield_policy.hpp
+ luabind/luabind/error.hpp
+ luabind/luabind/wrapper_base.hpp
+ )
+ENDIF()
# Files used by both the game and the editor
SET(SRCS_COMMON
@@ -475,8 +481,12 @@
ADD_PCH_RULE(${CMAKE_CURRENT_SOURCE_DIR}/utils/utils_pch.h SRCS)
ENDIF()
-ADD_EXECUTABLE(valyriatear WIN32 ${SRCS} ${SRCS_COMMON} ${SRCS_LUABIND})
-
+IF(USE_SYSTEM_LUABIND)
+ ADD_EXECUTABLE(valyriatear WIN32 ${SRCS} ${SRCS_COMMON})
+ SET(EXTRA_LIBRARIES ${EXTRA_LIBRARIES} ${Luabind_LIBRARIES})
+ELSE()
+ ADD_EXECUTABLE(valyriatear WIN32 ${SRCS} ${SRCS_COMMON} ${SRCS_LUABIND})
+ENDIF()
# Vorbis, vorbisfile and ogg are explcitely needed on OpenBSD
IF (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
TARGET_LINK_LIBRARIES(valyriatear