require	'mxx_ru/cpp'

require 'oess_1/defs/version'
require	'oess_1/util_cpp_serializer/gen'

Mxx_ru::setup_target(
	Mxx_ru::Cpp::Dll_target.new( "oess_1/db/prj.rb" ) {

		required_prj( "ace/dll.rb" )

		required_prj( "cls_2/prj.rb" )

		required_prj( "oess_1/defs/prj.rb" )
		required_prj( "oess_1/io/prj.rb" )
		required_prj( "oess_1/file/prj.rb" )
		required_prj( "oess_1/stdsn/prj.rb" )
		required_prj( "oess_1/scheme/prj.rb" )
		required_prj( "oess_1/zlib/prj.rb" )

		required_prj( "smart_ref_3/lib.rb" )

		required_prj( "libpcre++/prj.rb" )

		ddl_cpp_generator = generator(
			Oess_1::Util_cpp_serializer::Gen.new( self ) )

		Oess_1::setup_platform( self )

		target( "oess_db" + Oess_1::VERSION )

		define( "OESS_1__DB__PRJ" )

		#
		# Физическое хранилище.
		#

		sources_root( "storage" ) { 
			cpp_source( "loaded_page.cpp" )
			cpp_source( "dirty_page_storage.cpp" )

			cpp_source( "page_index_calculator.cpp" )
			cpp_source( "config.cpp" )
			ddl_cpp_generator.ddl_file( "config.ddl" )

			cpp_source( "chain_storage.cpp" )

			cpp_source( "entity_stream.cpp" )
			cpp_source( "stream_storage.cpp" )

			sources_root( "trx" ) {
				cpp_source( "types.cpp" )
				ddl_cpp_generator.ddl_file( "types.ddl" )

				cpp_source( "find_all_trace_files.cpp" )
				cpp_source( "std_snapshot_collection.cpp" )
				cpp_source( "std_trace_stream.cpp" )

				cpp_source( "std_file_committer.cpp" )
			}

			sources_root( "impl" ) { 
				cpp_source( "cache.cpp" )

				cpp_source( "mem_dirty_page_storage.cpp" )
				cpp_source( "std_cache.cpp" )
				cpp_source( "page_accessor.cpp" )
				cpp_source( "headers.cpp" )
				cpp_source( "header_processor.cpp" )

				cpp_source( "std_chain_storage.cpp" )

				cpp_source( "std_entity_stream.cpp" )
				ddl_cpp_generator.ddl_file( "std_entity_stream.ddl" )

				cpp_source( "stream_storage_dir.cpp" )
				ddl_cpp_generator.ddl_file( "stream_storage_dir.ddl" )

				cpp_source( "std_stream_storage.cpp" )
			}
		}

		sources_root( "impl" ) {

			#
			# Работа с содержимым базы данных.
			#
			sources_root( "db_content" ) {
				cpp_source( "db_content.cpp" )
				cpp_source( "std_client_map.cpp" )
				cpp_source( "std_db_content.cpp" )
			}
		}

		sources_root( "site" ) {

			#
			# Средства коммуникации между клиентом и сервером.
			#

			cpp_source( "abstract_connector.cpp" )
			cpp_source( "localhost.cpp" )

			sources_root( "impl" ) {
				cpp_source( "request.cpp" )
				ddl_cpp_generator.ddl_file( "request.ddl" )
				cpp_source( "response.cpp" )
				ddl_cpp_generator.ddl_file( "response.ddl" )

				cpp_source( "attach_cmd.cpp" )
				ddl_cpp_generator.ddl_file( "attach_cmd.ddl" )
				cpp_source( "detach_cmd.cpp" )
				ddl_cpp_generator.ddl_file( "detach_cmd.ddl" )
				cpp_source( "ent_create_cmd.cpp" )
				ddl_cpp_generator.ddl_file( "ent_create_cmd.ddl" )
				cpp_source( "ent_destroy_cmd.cpp" )
				ddl_cpp_generator.ddl_file( "ent_destroy_cmd.ddl" )
				cpp_source( "ent_destroy_all_cmd.cpp" )
				ddl_cpp_generator.ddl_file( "ent_destroy_all_cmd.ddl" )
				cpp_source( "ent_load_cmd.cpp" )
				ddl_cpp_generator.ddl_file( "ent_load_cmd.ddl" )
				cpp_source( "ent_update_cmd.cpp" )
				ddl_cpp_generator.ddl_file( "ent_update_cmd.ddl" )
				cpp_source( "ent_find_next_cmd.cpp" )
				ddl_cpp_generator.ddl_file( "ent_find_next_cmd.ddl" )
				cpp_source( "slice_create_cmd.cpp" )
				ddl_cpp_generator.ddl_file( "slice_create_cmd.ddl" )
				cpp_source( "slice_destroy_cmd.cpp" )
				ddl_cpp_generator.ddl_file( "slice_destroy_cmd.ddl" )
				cpp_source( "slice_is_exists_cmd.cpp" )
				ddl_cpp_generator.ddl_file( "slice_is_exists_cmd.ddl" )
				cpp_source( "slice_names_cmd.cpp" )
				ddl_cpp_generator.ddl_file( "slice_names_cmd.ddl" )
				cpp_source( "transaction_cmd.cpp" )
				ddl_cpp_generator.ddl_file( "transaction_cmd.ddl" )

				cpp_source( "std_localhost.cpp" )

				cpp_source( "localhost_connector.cpp" )
			}
		}

		#
		# Клиентская часть.
		#
		sources_root( "cln" ) {
			cpp_source( "db.cpp" )
			cpp_source( "slice_index_base.cpp" )
			cpp_source( "slice_image_base.cpp" )
			cpp_source( "local_db.cpp" )

			sources_root( "impl" ) {
				cpp_source( "std_db.cpp" )
			}
		}
	}
)
