From 864b61cbf16d737fb99dadaafa0b9252a77b1eb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Neum=C3=BCller?= Date: Sun, 16 Sep 2012 20:47:30 +0200 Subject: [PATCH] Switch to CMake build system --- CMakeLists.txt | 12 +++ Jamroot | 248 --------------------------------------------- src/CMakeLists.txt | 112 ++++++++++++++++++++ test/Jamfile | 69 ------------- 4 files changed, 124 insertions(+), 317 deletions(-) create mode 100644 CMakeLists.txt delete mode 100755 Jamroot create mode 100644 src/CMakeLists.txt delete mode 100755 test/Jamfile diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..67b659bc --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 2.6) +project(luabind) + +find_package(Boost 1.51.0 REQUIRED) + +# Adjust to actual locations +set (LUABINARIES_DIR "C:/myProgs/cpp/Bibliotheken/luabinaries") +set (LUA_INCLUDE_DIR "${LUABINARIES_DIR}/include") +set (LUA_LIBRARY + optimized "${LUABINARIES_DIR}/lua52.lib" + debug "${LUABINARIES_DIR}/lua52-d.lib") +add_subdirectory("src") \ No newline at end of file diff --git a/Jamroot b/Jamroot deleted file mode 100755 index 94494bf4..00000000 --- a/Jamroot +++ /dev/null @@ -1,248 +0,0 @@ -import docutils ; -import os ; -import errors ; -import notfile ; -import package ; -import path ; -import virtual-target ; - -VERSION = 0.9.0 ; -BOOST_ROOT = [ os.environ BOOST_ROOT ] ; - -rule debug-message ( txt * ) -{ - if --debug-build in [ modules.peek : ARGV ] - { - echo [luabind DEBUG] $(txt) ; - } -} - -debug-message figuring out which libraries to link to... ; -debug-message os.name is [ os.name ] ; - -if [ os.name ] = NT -{ - if ! $(BOOST_ROOT) - { - errors.user-error "*** BOOST_ROOT must be set to a Boost installation." ; - } - - LUA_PATH = [ os.environ LUA_PATH ] ; - - if ! $(LUA_PATH) - { - errors.user-error "*** LUA_PATH must be set." ; - } - - local includes = [ GLOB $(LUA_PATH)/include $(LUA_PATH)/src : lua.h ] ; - - if ! $(includes) - { - errors.user-error "*** Unable to determine Lua include directory." ; - } - - includes = $(includes:D) ; - - debug-message found include directory in $(includes) ; - - if [ GLOB $(LUA_PATH) : lib ] - { - lib lua : : static lua5.1 $(LUA_PATH)/lib/static : : $(includes) ; - lib lua : : shared lua5.1 $(LUA_PATH)/lib : : $(includes) ; - } - else if [ GLOB $(LUA_PATH) : lua5.1.dll ] - { - lib lua : : lua5.1 $(LUA_PATH) : : $(includes) ; - } -} -else if [ os.name ] in LINUX MACOSX FREEBSD -{ - LUA_PATH = [ os.environ LUA_PATH ] ; - HOME = [ os.environ HOME ] ; - - local possible-prefixes = - $(LUA_PATH) $(HOME)/Library/Frameworks /Library/Frameworks /usr /usr/local /opt/local /opt ; - - local possible-suffixes = - include/lua5.1 include/lua51 include/lua include ; - - local includes = [ GLOB $(possible-prefixes)/$(possible-suffixes) : lua.h ] ; - - if ! $(includes) - { - errors.user-error "*** Unable to determine Lua include directory." ; - } - - local includes = $(includes[1]:D) ; - local prefix = $(includes:D) ; - - if $(prefix:B) = "include" - { - prefix = $(prefix:D) ; - } - - local lib = $(prefix)/lib ; - - local names = liblua5.1 liblua51 liblua ; - local extensions = .a .so ; - - library = [ GLOB $(lib)/lua51 $(lib)/lua5.1 $(lib)/lua $(lib) : - $(names)$(extensions) ] ; - lib-name = [ MATCH "lib(.*)" : $(library[1]:B) ] ; - - debug-message prefix: $(prefix) ; - debug-message includes: $(includes) ; - debug-message lib: $(library:D) ; - debug-message candidates: $(library) ; - debug-message linking to: $(lib-name) ; - - if ! $(lib-name) - { - errors.user-error "*** Unable to find Lua library." ; - } - - lib m : : shared ; - if [ os.name ] = LINUX - { - lib dl : : shared ; - } - else - { - alias dl ; - } - lib lua : m dl : $(lib-name) $(library:D) : : $(includes) ; -} - -rule tag-names ( name : type ? : property-set ) -{ - if $(type) in STATIC_LIB SHARED_LIB IMPORT_LIB && - [ $(property-set).get ] = debug - { - name = $(name)d ; - } - - local result = [ virtual-target.add-prefix-and-suffix $(name) : $(type) : $(property-set) ] ; - - if $(type) = SHARED_LIB && - ( ! ( [ $(property-set).get ] in windows cygwin darwin aix ) && - ! ( [ $(property-set).get ] in pgi ) ) - { - result = $(result).$(VERSION) ; - } - - return $(result) ; -} - -SOURCES = - class.cpp - class_info.cpp - class_registry.cpp - class_rep.cpp - create_class.cpp - error.cpp - exception_handler.cpp - function.cpp - inheritance.cpp - link_compatibility.cpp - object_rep.cpp - open.cpp - pcall.cpp - scope.cpp - stack_content_by_name.cpp - weak_ref.cpp - wrapper_base.cpp ; - -usage-requirements = - lua - msvc,shared:/wd4251 - shared:LUABIND_DYNAMIC_LINK - @tag-names ; - -lib luabind - : src/$(SOURCES) - # requirements - : . $(BOOST_ROOT) - $(usage-requirements) - # default-build - : - # usage-requirements - : . $(BOOST_ROOT) - $(usage-requirements) - ; - -alias test - : test//test - # requirements - : - # default-build - : static shared release debug ; - -explicit test ; - -rule git-describe ( ) -{ - local result = [ SHELL "git describe HEAD 2>&1" : exit-status ] ; - - if $(result[2]) = 0 - { - return [ MATCH "^v([a-zA-Z.0-9\\-]+)" : $(result[1]) ] ; - } -} - -version-tag = [ git-describe ] ; - -if $(version-tag) -{ - actions make-version-file - { - echo ".. |version| replace:: $(version-tag)" > doc/version.rst - } - - notfile make-version-file : @make-version-file ; -} -else -{ - alias make-version-file ; -} - -if docs in [ modules.peek : ARGV ] -{ - local result = [ SHELL "rst2html.py --version 2>&1" : exit-status ] ; - if $(result[2]) = 0 - { - found-rst2html = rst2html.py ; - } -} - -html docs.html - : doc/docs.rst - : make-version-file - $(found-rst2html) - "--traceback -gdt --stylesheet=style.css --link-stylesheet" ; - -stage docs : docs.html : doc ; -explicit docs docs.html make-version-file ; - -headers = [ path.glob-tree luabind : *.hpp ] ; - -package.install install - : luabind - luabind - on - : - : luabind - : $(headers) - ; - -local stage-locate = [ MATCH "^--stagedir=(.*)" : [ modules.peek : ARGV ] ] ; -stage-locate ?= stage ; - -install stage - : luabind - : $(stage-locate) - on - on - LIB - ; - -explicit stage ; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 00000000..95a88cc4 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,112 @@ +include_directories( + ${Boost_INCLUDE_DIRS} ${LUA_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}) + +set(luabind_SRCS + class.cpp + class_info.cpp + class_registry.cpp + class_rep.cpp + create_class.cpp + error.cpp + exception_handler.cpp + function.cpp + inheritance.cpp + link_compatibility.cpp + object_rep.cpp + open.cpp + pcall.cpp + scope.cpp + stack_content_by_name.cpp + weak_ref.cpp + wrapper_base.cpp) + +set(luabind_HDRS + ../luabind/adopt_policy.hpp + ../luabind/back_reference.hpp + ../luabind/back_reference_fwd.hpp + ../luabind/class.hpp + ../luabind/class_info.hpp + ../luabind/config.hpp + ../luabind/container_policy.hpp + ../luabind/copy_policy.hpp + ../luabind/dependency_policy.hpp + ../luabind/discard_result_policy.hpp + ../luabind/error.hpp + ../luabind/exception_handler.hpp + ../luabind/from_stack.hpp + ../luabind/function.hpp + ../luabind/get_main_thread.hpp + ../luabind/get_pointer.hpp + ../luabind/handle.hpp + ../luabind/iterator_policy.hpp + ../luabind/luabind.hpp + ../luabind/lua_include.hpp + ../luabind/make_function.hpp + ../luabind/nil.hpp + ../luabind/object.hpp + ../luabind/open.hpp + ../luabind/operator.hpp + ../luabind/out_value_policy.hpp + ../luabind/prefix.hpp + ../luabind/raw_policy.hpp + ../luabind/return_reference_to_policy.hpp + ../luabind/scope.hpp + ../luabind/shared_ptr_converter.hpp + ../luabind/tag_function.hpp + ../luabind/typeid.hpp + ../luabind/value_wrapper.hpp + ../luabind/version.hpp + ../luabind/weak_ref.hpp + ../luabind/wrapper_base.hpp + ../luabind/yield_policy.hpp) + +set(luabind_detail_HDRS + ../luabind/detail/calc_arity.hpp + ../luabind/detail/call.hpp + ../luabind/detail/call_function.hpp + ../luabind/detail/call_member.hpp + ../luabind/detail/call_operator_iterate.hpp + ../luabind/detail/class_cache.hpp + ../luabind/detail/class_registry.hpp + ../luabind/detail/class_rep.hpp + ../luabind/detail/compute_score.hpp + ../luabind/detail/constructor.hpp + ../luabind/detail/conversion_storage.hpp + ../luabind/detail/convert_to_lua.hpp + ../luabind/detail/debug.hpp + ../luabind/detail/decorate_type.hpp + ../luabind/detail/deduce_signature.hpp + ../luabind/detail/enum_maker.hpp + ../luabind/detail/format_signature.hpp + ../luabind/detail/garbage_collector.hpp + ../luabind/detail/has_get_pointer.hpp + ../luabind/detail/inheritance.hpp + ../luabind/detail/instance_holder.hpp + ../luabind/detail/is_indirect_const.hpp + ../luabind/detail/link_compatibility.hpp + ../luabind/detail/make_instance.hpp + ../luabind/detail/most_derived.hpp + ../luabind/detail/object_call.hpp + ../luabind/detail/object_funs.hpp + ../luabind/detail/object_rep.hpp + ../luabind/detail/open.hpp + ../luabind/detail/operator_id.hpp + ../luabind/detail/other.hpp + ../luabind/detail/pcall.hpp + ../luabind/detail/pointee_sizeof.hpp + ../luabind/detail/pointee_typeid.hpp + ../luabind/detail/policy.hpp + ../luabind/detail/primitives.hpp + ../luabind/detail/property.hpp + ../luabind/detail/ref.hpp + ../luabind/detail/signature_match.hpp + ../luabind/detail/stack_utils.hpp + ../luabind/detail/typetraits.hpp + ../luabind/detail/yes_no.hpp) + +source_group("detail headers" FILES ${luabind_detail_HDRS}) + +set(CMAKE_DEBUG_POSTFIX "-d") +add_library(luabind ${luabind_SRCS} ${luabind_HDRS} ${luabind_detail_HDRS}) + +target_link_libraries(luabind ${LUA_LIBRARIES}) \ No newline at end of file diff --git a/test/Jamfile b/test/Jamfile deleted file mode 100755 index 804da562..00000000 --- a/test/Jamfile +++ /dev/null @@ -1,69 +0,0 @@ -import testing ; - -SOURCES = - test_vector_of_object.cpp - test_back_reference.cpp - test_def_from_base.cpp - test_object.cpp - test_abstract_base.cpp - test_attributes.cpp - test_const.cpp - test_construction.cpp - test_exceptions.cpp - test_free_functions.cpp - test_held_type.cpp - test_implicit_cast.cpp - test_iterator.cpp - test_lua_classes.cpp - test_null_pointer.cpp - test_operators.cpp - test_policies.cpp - test_scope.cpp - test_separation.cpp - test_simple_class.cpp - test_yield.cpp - test_private_destructors.cpp - test_exception_handlers.cpp - test_shadow.cpp - test_tag_function.cpp - test_adopt.cpp - test_properties.cpp - test_user_defined_converter.cpp - test_adopt_wrapper.cpp - test_builtin_converters.cpp - test_class_info.cpp - test_table.cpp - test_automatic_smart_ptr.cpp - test_shared_ptr.cpp - test_implicit_raw.cpp - test_collapse_converter.cpp - test_dynamic_type.cpp - test_virtual_inheritance.cpp - test_create_in_thread.cpp - test_extend_class_in_lua.cpp - test_smart_ptr_attributes.cpp - test_super_leak.cpp - test_set_instance_value.cpp - test_unsigned_int.cpp - ; - -obj main : main.cpp : ..//luabind : : ..//luabind ; - -tests = ; - -for local src in $(SOURCES) -{ - tests += [ run $(src) main ] ; -} - -test += [ compile test_typetraits.cpp ..//luabind ] - [ compile test_value_wrapper.cpp ..//luabind ] - [ compile test_has_get_pointer.cpp ..//luabind ] ; - -test-suite test - : $(tests) - # requirements - : - # default-build - : static shared release debug ; -