improve for tkc shared library

This commit is contained in:
xianjimli 2020-10-13 17:43:19 +08:00
parent 2fc7c179cf
commit b7c41d60f7
6 changed files with 10405 additions and 6590 deletions

View File

@ -34,6 +34,44 @@ EXPORTS
rect_contains
rect_fix
rect_intersect
object_unref
object_ref
object_create
object_get_type
object_get_desc
object_get_size
object_is_collection
object_set_name
object_compare
object_get_prop
object_get_prop_str
object_get_prop_pointer
object_get_prop_object
object_get_prop_int
object_get_prop_bool
object_get_prop_float
object_remove_prop
object_set_prop
object_set_prop_str
object_set_prop_pointer
object_set_prop_object
object_set_prop_int
object_set_prop_bool
object_set_prop_float
object_copy_prop
object_foreach_prop
object_has_prop
object_eval
object_can_exec
object_exec
object_notify_changed
object_get_prop_by_path
object_get_prop_str_by_path
object_get_prop_pointer_by_path
object_get_prop_object_by_path
object_get_prop_int_by_path
object_get_prop_bool_by_path
object_get_prop_float_by_path
value_set_bool
value_bool
value_set_int8
@ -85,44 +123,14 @@ EXPORTS
value_destroy
value_reset
value_cast
object_unref
object_ref
object_create
object_get_type
object_get_desc
object_get_size
object_is_collection
object_set_name
object_compare
object_get_prop
object_get_prop_str
object_get_prop_pointer
object_get_prop_object
object_get_prop_int
object_get_prop_bool
object_get_prop_float
object_remove_prop
object_set_prop
object_set_prop_str
object_set_prop_pointer
object_set_prop_object
object_set_prop_int
object_set_prop_bool
object_set_prop_float
object_copy_prop
object_foreach_prop
object_has_prop
object_eval
object_can_exec
object_exec
object_notify_changed
object_get_prop_by_path
object_get_prop_str_by_path
object_get_prop_pointer_by_path
object_get_prop_object_by_path
object_get_prop_int_by_path
object_get_prop_bool_by_path
object_get_prop_float_by_path
rom_fopen
rom_fopen_buff
rom_ftell
rom_feof
rom_fseek
rom_fread
rom_fwrite
rom_fclose
asset_info_create
asset_info_destroy
asset_info_unref
@ -237,9 +245,13 @@ EXPORTS
action_thread_pool_create
action_thread_pool_exec
action_thread_pool_destroy
wcs_len
wcs_cmp
wcs_cpy
conf_node_get_name
conf_node_find_child
conf_node_find_sibling
conf_node_set_value
conf_node_get_value
conf_node_get_first_child
conf_node_set_first_child
event_source_manager_init
event_source_manager_deinit
event_source_manager_get_wakeup_time
@ -248,38 +260,63 @@ EXPORTS
event_source_manager_remove
event_source_manager_remove_by_tag
event_source_manager_destroy
wcs_chr
wstr_init
wstr_set
wstr_clear
wstr_set_utf8
wstr_get_utf8
wstr_remove
wstr_insert
wstr_append
wstr_append_with_len
wstr_push
wstr_pop
wstr_push_int
wstr_equal
wstr_from_int
wstr_from_float
wstr_from_value
wstr_to_int
wstr_to_float
wstr_add_float
wstr_trim_float_zero
wstr_normalize_newline
wstr_count_char
wstr_reset
waitable_ring_buffer_create
waitable_ring_buffer_read
waitable_ring_buffer_write
waitable_ring_buffer_destroy
waitable_action_queue_create
waitable_action_queue_recv
waitable_action_queue_send
waitable_action_queue_destroy
conf_doc_create
conf_doc_create_node
conf_doc_destroy_node
conf_doc_append_sibling
conf_doc_append_child
conf_doc_remove_sibling
conf_doc_remove_child
conf_doc_remove_child_by_name
conf_doc_remove_children
conf_doc_set
conf_doc_set_int
conf_doc_set_bool
conf_doc_set_float
conf_doc_set_str
conf_doc_get
conf_doc_get_int
conf_doc_get_bool
conf_doc_get_float
conf_doc_get_str
conf_doc_remove
conf_doc_clear
conf_doc_move_up
conf_doc_move_down
conf_doc_exists
conf_doc_is_first
conf_doc_is_last
conf_doc_add_child
conf_doc_destroy
conf_doc_save_json
conf_doc_load_json
app_conf_set_instance
app_conf_get_instance
app_conf_save
app_conf_reload
app_conf_on_changed
app_conf_off_changed
app_conf_off_changed_by_ctx
app_conf_deinit
app_conf_set
app_conf_get
app_conf_exist
app_conf_set_int
app_conf_set_int64
app_conf_set_bool
app_conf_set_double
app_conf_set_str
app_conf_set_wstr
app_conf_get_int
app_conf_get_int64
app_conf_get_bool
app_conf_get_double
app_conf_get_str
app_conf_get_wstr
app_conf_remove
app_conf_init
app_conf_init_ubjson
app_conf_init_json
eval_execute
tk_expr_eval
tk_expr_eval_str
@ -331,6 +368,7 @@ EXPORTS
func_call_parser_parse
func_call_parser_deinit
func_call_parse
app_conf_init_ini
idle_manager
idle_manager_set
idle_manager_create
@ -345,6 +383,7 @@ EXPORTS
idle_manager_add
int_str_value
int_str_name
tk_ostream_serial_create
log_get_log_level
log_set_log_level
matrix_init
@ -356,76 +395,52 @@ EXPORTS
matrix_scale
matrix_rotate
matrix_transform_point
tk_atoi
tk_atob
tk_atof
tk_str_cmp
tk_str_icmp
tk_watoi
tk_watoi_n
tk_watob
tk_watof
tk_skip_to_num
tk_itoa
tk_ftoa
tk_strtol
tk_strcpy
tk_strncpy
tk_strdup
tk_wstrdup
tk_strndup
tk_strlen
tk_str_append
tk_memset16
tk_memset24
tk_memset32
tk_memcpy16
tk_memcpy32
tk_pixel_copy
tk_snprintf
tk_sscanf
filename_to_name
filename_to_name_ex
xml_file_expand_read
tk_str_copy
dummy_destroy
default_destroy
pointer_compare
compare_always_equal
tk_is_valid_name
tk_str_start_with
tk_under_score_to_camel
tk_pointer_to_int
tk_pointer_from_int
tk_str_toupper
tk_str_tolower
tk_wstr_dup_utf8
tk_wstr_count_c
image_region_parse
tk_utf8_from_utf16
tk_utf8_from_utf16_ex
tk_utf8_to_utf16
tokenizer_init
tokenizer_init_ex
tokenizer_has_more
tokenizer_next
tokenizer_next_until
tokenizer_next_expr_until
tokenizer_next_int
tokenizer_next_float
tokenizer_deinit
ubjson_writer_init
ubjson_writer_write_key
ubjson_writer_write_null
ubjson_writer_write_noop
ubjson_writer_write_true
ubjson_writer_write_false
ubjson_writer_write_int
ubjson_writer_write_int8
ubjson_writer_write_uint8
ubjson_writer_write_int16
ubjson_writer_write_int32
ubjson_writer_write_int64
ubjson_writer_write_float32
ubjson_writer_write_float64
ubjson_writer_write_char
ubjson_writer_write_str
ubjson_writer_write_str_len
ubjson_writer_write_object
ubjson_writer_write_array_begin
ubjson_writer_write_array_end
ubjson_writer_write_object_begin
ubjson_writer_write_object_end
ubjson_writer_write_data
ubjson_writer_write_kv_object_begin
ubjson_writer_write_kv_object
ubjson_writer_write_kv_int
ubjson_writer_write_kv_int64
ubjson_writer_write_kv_float
ubjson_writer_write_kv_double
ubjson_writer_write_kv_bool
ubjson_writer_write_kv_str
ubjson_writer_write_kv_str_len
ubjson_writer_write_kv_value
ubjson_parse
ubjson_to_object
ubjson_dump
wcs_dup
wcs_len
wcs_cmp
wcs_cpy
tk_alloc
tk_calloc
tk_realloc
tk_free
tk_mem_dump
tk_mem_is_valid_addr
action_thread_create
action_thread_create_with_queue
action_thread_exec
action_thread_set_on_idle
action_thread_set_on_quit
action_thread_destroy
tk_mutex_nest_create
tk_mutex_nest_lock
tk_mutex_nest_try_lock
@ -444,73 +459,38 @@ EXPORTS
named_value_get_value
named_value_deinit
named_value_destroy
timer_manager
timer_manager_set
timer_manager_create
timer_manager_init
timer_manager_deinit
timer_manager_destroy
timer_manager_add
timer_manager_remove
timer_manager_reset
timer_manager_find
timer_manager_count
timer_manager_next_time
timer_manager_append
time_now_s
time_now_ms
tk_thread_create
tk_thread_set_name
tk_thread_set_stack_size
tk_thread_set_priority
tk_thread_start
tk_thread_join
tk_thread_get_args
tk_thread_destroy
tk_thread_self
str_init
str_extend
str_eq
str_set
str_clear
str_set_with_len
str_append
str_append_more
str_append_with_len
str_insert
str_insert_with_len
str_remove
str_append_char
str_append_int
str_append_double
str_append_json_str
str_append_json_int_pair
str_append_json_str_pair
str_append_json_double_pair
str_append_json_bool_pair
str_pop
str_unescape
str_decode_xml_entity
str_decode_xml_entity_with_len
str_from_int
str_from_float
str_from_value
str_from_wstr
str_from_wstr_with_len
str_to_int
str_to_float
str_end_with
str_start_with
str_trim
str_trim_left
str_trim_right
str_replace
str_to_lower
str_to_upper
str_expand_vars
str_reset
str_str_value
str_str_name
wcs_chr
wstr_init
wstr_set
wstr_clear
wstr_set_utf8
wstr_get_utf8
wstr_remove
wstr_insert
wstr_append
wstr_append_with_len
wstr_push
wstr_pop
wstr_push_int
wstr_equal
wstr_from_int
wstr_from_float
wstr_from_value
wstr_to_int
wstr_to_float
wstr_add_float
wstr_trim_float_zero
wstr_normalize_newline
wstr_count_char
wstr_reset
waitable_ring_buffer_create
waitable_ring_buffer_read
waitable_ring_buffer_write
waitable_ring_buffer_destroy
waitable_action_queue_create
waitable_action_queue_recv
waitable_action_queue_send
waitable_action_queue_destroy
path_basename
path_extname
path_dirname
@ -557,14 +537,12 @@ EXPORTS
ring_buffer_set_write_cursor_delta
ring_buffer_ensure_write_space
ring_buffer_destroy
rom_fopen
rom_fopen_buff
rom_ftell
rom_feof
rom_fseek
rom_fread
rom_fwrite
rom_fclose
action_thread_create
action_thread_create_with_queue
action_thread_exec
action_thread_set_on_idle
action_thread_set_on_quit
action_thread_destroy
tk_semaphore_create
tk_semaphore_wait
tk_semaphore_post
@ -596,34 +574,173 @@ EXPORTS
udp_listen
udp_connect
tk_socketpair
wcs_dup
event_source_fd_create
event_source_idle_create
str_str_value
str_str_name
str_init
str_extend
str_eq
str_set
str_clear
str_set_with_len
str_append
str_append_more
str_append_with_len
str_insert
str_insert_with_len
str_remove
str_append_char
str_append_int
str_append_double
str_append_json_str
str_append_json_int_pair
str_append_json_str_pair
str_append_json_double_pair
str_append_json_bool_pair
str_pop
str_unescape
str_decode_xml_entity
str_decode_xml_entity_with_len
str_from_int
str_from_float
str_from_value
str_from_wstr
str_from_wstr_with_len
str_to_int
str_to_float
str_end_with
str_start_with
str_trim
str_trim_left
str_trim_right
str_replace
str_to_lower
str_to_upper
str_expand_vars
str_reset
tk_thread_create
tk_thread_set_name
tk_thread_set_stack_size
tk_thread_set_priority
tk_thread_start
tk_thread_join
tk_thread_get_args
tk_thread_destroy
tk_thread_self
time_now_s
time_now_ms
timer_manager
timer_manager_set
timer_manager_create
timer_manager_init
timer_manager_deinit
timer_manager_destroy
timer_manager_add
timer_manager_remove
timer_manager_reset
timer_manager_find
timer_manager_count
timer_manager_next_time
timer_manager_append
tokenizer_init
tokenizer_init_ex
tokenizer_has_more
tokenizer_next
tokenizer_next_until
tokenizer_next_expr_until
tokenizer_next_int
tokenizer_next_float
tokenizer_deinit
tk_utf8_from_utf16
tk_utf8_from_utf16_ex
tk_utf8_to_utf16
tk_atoi
tk_atob
tk_atof
tk_str_cmp
tk_str_icmp
tk_watoi
tk_watoi_n
tk_watob
tk_watof
tk_skip_to_num
tk_itoa
tk_ftoa
tk_strtol
tk_strcpy
tk_strncpy
tk_strdup
tk_wstrdup
tk_strndup
tk_strlen
tk_str_append
tk_memset16
tk_memset24
tk_memset32
tk_memcpy16
tk_memcpy32
tk_pixel_copy
tk_snprintf
tk_sscanf
filename_to_name
filename_to_name_ex
xml_file_expand_read
tk_str_copy
dummy_destroy
default_destroy
pointer_compare
compare_always_equal
tk_is_valid_name
tk_str_start_with
tk_under_score_to_camel
tk_pointer_to_int
tk_pointer_from_int
tk_str_toupper
tk_str_tolower
tk_wstr_dup_utf8
tk_wstr_count_c
image_region_parse
event_source_manager_default_create
event_source_timer_create
event_source_get_fd
event_source_dispatch
event_source_set_tag
event_source_check
event_source_get_wakeup_time
prop_change_event_cast
prop_change_event_init
progress_event_cast
progress_event_init
done_event_cast
done_event_init
cmd_exec_event_cast
cmd_exec_event_init
error_event_cast
error_event_init
cmd_exec_event_cast
cmd_exec_event_init
conf_obj_create
conf_obj_get_doc
conf_obj_save
conf_obj_set_readonly
event_source_fd_create
event_source_idle_create
object_array_create
object_array_clone
object_array_unref
object_array_clear_props
event_source_timer_create
event_source_get_fd
event_source_dispatch
event_source_set_tag
event_source_check
event_source_get_wakeup_time
conf_ubjson_load
timer_info_cast
conf_json_load
conf_ini_load
tk_ostream_write
tk_ostream_seek
tk_ostream_write_len
tk_ostream_write_byte
tk_ostream_flush
object_locker_create
idle_info_cast
tk_iostream_get_istream
tk_iostream_get_ostream
tk_iostream_read
tk_iostream_read_len
tk_iostream_write
tk_iostream_write_len
object_default_create
object_default_clone
object_default_unref
object_default_clear_props
object_default_find_prop
tk_istream_read
tk_istream_seek
tk_istream_tell
@ -633,19 +750,43 @@ EXPORTS
tk_istream_read_len
tk_istream_read_line
tk_istream_read_line_str
object_array_create
object_array_clone
object_array_unref
object_array_clear_props
timer_info_cast
object_compositor_create
object_default_create
object_default_clone
object_default_unref
object_default_clear_props
object_default_find_prop
tk_ostream_write
tk_ostream_seek
tk_ostream_write_len
tk_ostream_write_byte
tk_ostream_flush
idle_info_cast
tk_iostream_get_istream
tk_iostream_get_ostream
tk_iostream_read
tk_iostream_read_len
tk_iostream_write
tk_iostream_write_len
tk_iostream_mem_create
tk_iostream_serial_create
tk_iostream_serial_config
tk_ostream_noisy_create
tk_iostream_shdlc_create
tk_istream_shdlc_create
tk_ostream_shdlc_create
tk_iostream_noisy_create
tk_ostream_retry_create
tk_ostream_retry_set_max_retry_times
tk_ostream_retry_set_max_buffer_size
tk_ostream_retry_clear_buffer
tk_ostream_retry_set_discard_policy
tk_ostream_mem_create
tk_istream_mem_create
tk_istream_serial_create
tk_ostream_udp_create
tk_ostream_udp_set_target_with_host
tk_ostream_udp_set_target_with_addr
tk_ostream_tcp_create
tk_istream_udp_create
tk_istream_udp_set_target_with_host
tk_istream_udp_set_target_with_addr
tk_iostream_udp_create_client
tk_iostream_udp_create
tk_iostream_tcp_create
tk_ostream_file_create
tk_istream_file_create
tk_ostream_buffered_create
tk_ostream_buffered_get_size
tk_istream_buffered_create
tk_istream_tcp_create

View File

@ -44,6 +44,9 @@ class AppHelperBase:
def set_deps(self, DEPENDS_LIBS):
self.DEPENDS_LIBS = DEPENDS_LIBS
return self
def set_src_dir(self, SRC_DIR):
self.SRC_DIR = SRC_DIR
return self
def set_libs(self, APP_LIBS):
self.APP_LIBS = APP_LIBS
@ -130,6 +133,7 @@ class AppHelperBase:
def __init__(self, ARGUMENTS):
APP_ROOT = os.path.normpath(os.getcwd())
self.SRC_DIR = 'src'
self.ARGUMENTS = ARGUMENTS
self.DEF_FILE = None
self.DEF_FILE_PROCESSOR = None
@ -227,7 +231,7 @@ class AppHelperBase:
dll_def_gen_tools = os.path.join(
self.AWTK_ROOT, 'tools/dll_def_gen/index.js')
cmd = 'node ' + '"' + idl_gen_tools + '"' + ' idl/idl.json ' + 'src'
cmd = 'node ' + '"' + idl_gen_tools + '"' + ' idl/idl.json ' + self.SRC_DIR
if os.system(cmd) != 0:
print('exe cmd: ' + cmd + ' failed.')

View File

@ -107,17 +107,20 @@ env.Library(os.path.join(LIB_DIR, 'tkc_static'), TK_SOURCES, LIBS=[])
TKC_DEPS_LIBS=[]
OS_NAME = platform.system()
TKC_LINKFLAGS = env['LINKFLAGS'];
TKC_STATIC_LIBS = ['conf_io', 'ubjson', 'streams', 'tkc_static', 'compressors', 'miniz']
TKC_LINK_ALL=' -Wl,--whole-archive -lstreams -lconf_io -lubjson -ltkc_static -lcompressors -lminiz -Wl,--no-whole-archive'
if OS_NAME == 'Windows':
if TOOLS_NAME == '' :
TKC_DEPS_LIBS=['tkc_static', 'SDL2', 'user32','winmm.lib','advapi32.lib','shell32.lib', 'ole32.lib']
TKC_DEPS_LIBS= TKC_STATIC_LIBS + ['SDL2', 'user32','winmm.lib','advapi32.lib','shell32.lib', 'ole32.lib']
TKC_LINKFLAGS += ' /DEF:"dllexports/tkc.def" '
elif TOOLS_NAME == 'mingw':
TKC_LINKFLAGS +=' -Wl,--whole-archive -ltkc_static -Wl,--no-whole-archive'
TKC_LINKFLAGS += TKC_LINK_ALL
elif OS_NAME == 'Darwin':
TKC_DEPS_LIBS= TKC_STATIC_LIBS
TKC_LINKFLAGS +=' -all_load '
elif OS_NAME == 'Linux':
TKC_LINKFLAGS +=' -Wl,--whole-archive -ltkc_static -Wl,--no-whole-archive'
TKC_LINKFLAGS += TKC_LINK_ALL
env.SharedLibrary(os.path.join(BIN_DIR, 'tkc'), [], LIBS=TKC_DEPS_LIBS, LINKFLAGS=TKC_LINKFLAGS);

View File

@ -3,7 +3,7 @@ const path = require('path')
const DefGenerator = require('./def_generator')
let inputIDL = path.normalize(path.join(__dirname, '../idl_gen/tkc_idl.json'));
let inputIDL = path.normalize(path.join(__dirname, '../idl_gen/tkc.json'));
let outputDef = '../../dllexports/tkc.def';
let withIndex = false;

View File

@ -4,19 +4,11 @@ const glob = require('glob')
const IDLGen = require('./idl_gen.js')
let outputIDL = 'tkc.json';
let sourcesPath = path.normalize(path.join(__dirname, '../../src/tkc'));
if(process.argv.length == 3) {
outputIDL = process.argv[2];
} else if(process.argv.length > 3) {
outputIDL = process.argv[2];
sourcesPath = process.argv[3];
}
if(sourcesPath === '-h' || sourcesPath === '--help') {
console.log('Usage: node index.js outputIDL sourcesPath');
process.exit(0);
}
let sourcesPath = [
path.normalize(path.join(__dirname, '../../src/tkc')),
path.normalize(path.join(__dirname, '../../src/ubjson')),
path.normalize(path.join(__dirname, '../../src/streams')),
path.normalize(path.join(__dirname, '../../src/conf_io'))].join(';');
IDLGen.gen(sourcesPath, outputIDL)

File diff suppressed because it is too large Load Diff