runtime: add assembly system to collect and export type definitions
This commit is contained in:
+40
-21
@@ -2,12 +2,9 @@ function(add_fx_assembly)
|
||||
set(options)
|
||||
set(one_value_args NAME)
|
||||
set(multi_value_args
|
||||
NAMESPACES
|
||||
DEPENDENCIES
|
||||
SUBDIRS
|
||||
EXTRA_SOURCES
|
||||
LIBS
|
||||
INCLUDE_DIRS
|
||||
DEFINES)
|
||||
LIBS)
|
||||
cmake_parse_arguments(PARSE_ARGV 0 arg
|
||||
"${options}"
|
||||
"${one_value_args}"
|
||||
@@ -19,28 +16,23 @@ function(add_fx_assembly)
|
||||
string(REPLACE "." "_" assembly_token ${assembly_name})
|
||||
string(TOUPPER ${assembly_token} assembly_token)
|
||||
|
||||
file(GLOB sources *.c *.h)
|
||||
set(assembly_include_paths "")
|
||||
set(assembly_sources
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/assemblies/${assembly_name}.c)
|
||||
|
||||
foreach (dir ${arg_SUBDIRS})
|
||||
file(GLOB dir_sources ${dir}/*.c ${dir}/*.h)
|
||||
set(sources ${sources} ${dir_sources})
|
||||
foreach (dir ${arg_NAMESPACES})
|
||||
add_subdirectory(${dir})
|
||||
set(assembly_sources ${assembly_sources} ${namespace_sources})
|
||||
set(assembly_include_paths ${assembly_include_paths} ${namespace_include_paths})
|
||||
endforeach (dir)
|
||||
|
||||
file(GLOB sys_sources sys/${fx_system_name}/*.c sys/${fx_system_name}/*.h)
|
||||
file(GLOB headers include/${assembly_path}/*.h)
|
||||
|
||||
message(STATUS "Building assembly ${assembly_name}")
|
||||
add_library(${assembly_target_name} SHARED
|
||||
${sources}
|
||||
${sys_sources}
|
||||
${root_header}
|
||||
${headers}
|
||||
${arg_EXTRA_SOURCES})
|
||||
${assembly_sources})
|
||||
|
||||
target_include_directories(${assembly_target_name} PUBLIC include/)
|
||||
target_include_directories(${assembly_target_name} PUBLIC ${assembly_include_paths})
|
||||
|
||||
target_compile_definitions(${assembly_target_name} PUBLIC
|
||||
${assembly_token}
|
||||
FX_EXPORT=1
|
||||
FX_ENABLE_FLOATING_POINT=${fx_enable_floating_point})
|
||||
|
||||
@@ -48,8 +40,7 @@ function(add_fx_assembly)
|
||||
PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
foreach (dep ${arg_DEPENDENCIES})
|
||||
string(REPLACE "." "-" dep_target_name ${dep})
|
||||
target_link_libraries(${assembly_target_name} ${dep_target_name})
|
||||
target_link_libraries(${assembly_target_name} ${dep})
|
||||
endforeach (dep)
|
||||
|
||||
foreach (lib ${arg_LIBS})
|
||||
@@ -79,3 +70,31 @@ function(add_fx_assembly)
|
||||
install(TARGETS ${assembly_target_name})
|
||||
install(FILES ${headers} DESTINATION include/${assembly_path})
|
||||
endfunction(add_fx_assembly)
|
||||
|
||||
macro(export_fx_namespace_details)
|
||||
set(options)
|
||||
set(one_value_args NAME)
|
||||
set(multi_value_args)
|
||||
cmake_parse_arguments(PARSE_ARGV 0 arg
|
||||
"${options}"
|
||||
"${one_value_args}"
|
||||
"${multi_value_args}")
|
||||
|
||||
set(namespace_name ${arg_NAME})
|
||||
string(REPLACE "." "/" namespace_path ${namespace_name})
|
||||
set(namespace_target_name ${namespace_name})
|
||||
|
||||
set(namespace_include_paths ${CMAKE_CURRENT_SOURCE_DIR}/include PARENT_SCOPE)
|
||||
|
||||
file(GLOB namespace_sources
|
||||
*.c *.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/${namespace_path}/*.h)
|
||||
file(GLOB sys_sources sys/${fx_system_name}/*.c sys/${fx_system_name}/*.h)
|
||||
file(GLOB headers include/${namespace_path}/*.h)
|
||||
set(namespace_sources
|
||||
${namespace_sources}
|
||||
${sys_sources}
|
||||
${headers}
|
||||
PARENT_SCOPE)
|
||||
endmacro(export_fx_namespace_details)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user