adds small cleanups towards updating the entire build system
This commit is contained in:
@@ -4,26 +4,30 @@ cmake_minimum_required(VERSION 3.21)
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
include(${CMAKE_TOOLCHAIN_FILE})
|
||||
###############################################################################
|
||||
add_subdirectory(port/moonlight)
|
||||
set(TARGET_MEM "ram" CACHE STRING "memory map to use")
|
||||
###############################################################################
|
||||
# Adds picolibc
|
||||
#set(CMAKE_SYSTEM_PROCESSOR riscv)
|
||||
set(__THREAD_LOCAL_STORAGE OFF)
|
||||
add_subdirectory(third-party/picolibc)
|
||||
#add_subdirectory(picolibc/semihost)
|
||||
target_link_libraries(c PUBLIC gcc)
|
||||
target_sources(c PRIVATE ${CMAKE_CURRENT_LIST_DIR}/port/picolibc/port.c)
|
||||
target_link_libraries(c PUBLIC moonlight gcc)
|
||||
###############################################################################
|
||||
# Adds threadx
|
||||
set(THREADX_CUSTOM_PORT ${CMAKE_CURRENT_LIST_DIR}/port/threadx)
|
||||
add_subdirectory(third-party/threadx)
|
||||
target_link_libraries(threadx PUBLIC c)
|
||||
target_link_libraries(threadx PUBLIC c moonlight)
|
||||
#Adds threadx_smp
|
||||
add_subdirectory(port/threadx_smp)
|
||||
target_link_libraries(threadx_smp PUBLIC c)
|
||||
target_link_libraries(threadx_smp PUBLIC c moonlight)
|
||||
# Adds netxduo
|
||||
set(NETXDUO_CUSTOM_PORT ${CMAKE_CURRENT_LIST_DIR}/port/threadx)
|
||||
set(NXD_ENABLE_FILE_SERVERS OFF)
|
||||
set(NX_USER_FILE ${CMAKE_CURRENT_LIST_DIR}/port/threadx/inc/nx_user.h)
|
||||
#set(NX_USER_FILE ${CMAKE_CURRENT_LIST_DIR}/port/threadx/inc/nx_user.h)
|
||||
add_subdirectory(third-party/netxduo)
|
||||
target_link_libraries(netxduo PUBLIC c)
|
||||
target_link_libraries(netxduo PUBLIC threadx)
|
||||
if(NX_DEBUG)
|
||||
target_compile_definitions(netxduo PRIVATE NX_DEBUG NX_DEBUG_PACKET NX_ENABLE_PACKET_DEBUG_INFO)
|
||||
endif()
|
||||
@@ -36,14 +40,10 @@ endif()
|
||||
project(threadx_demo C ASM)
|
||||
option(NX_DEBUG "compile netxduo debug output in" OFF)
|
||||
option(TX_TRACE "Enable dump of traces to be read by TraceX" OFF)
|
||||
set(TARGET_MEM "ram" CACHE STRING "memory map to use")
|
||||
set(CMAKE_EXECUTABLE_SUFFIX_C ".elf")
|
||||
|
||||
add_subdirectory(port/moonlight)
|
||||
|
||||
function(setup_target TARGET)
|
||||
set(options)
|
||||
set(oneValueArgs PLATFORM_TARGET)
|
||||
set(multiValueArgs LIBRARIES SOURCES)
|
||||
cmake_parse_arguments(ST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
if(ST_UNPARSED_ARGUMENTS)
|
||||
@@ -54,15 +54,7 @@ function(setup_target TARGET)
|
||||
set_target_properties(${TARGET} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
if(ST_PLATFORM_TARGET)
|
||||
target_add_moonlight_platform(${TARGET} PLATFORM_TARGET ${ST_PLATFORM_TARGET})
|
||||
else()
|
||||
target_add_moonlight_platform(${TARGET})
|
||||
endif()
|
||||
|
||||
if("netxduo" IN_LIST ST_LIBRARIES)
|
||||
target_add_moonlight_network_driver(${TARGET})
|
||||
endif()
|
||||
target_link_libraries(${TARGET} PRIVATE moonlight)
|
||||
|
||||
if(ST_SOURCES)
|
||||
target_sources(${TARGET} PRIVATE ${ST_SOURCES})
|
||||
@@ -73,10 +65,6 @@ function(setup_target TARGET)
|
||||
endif()
|
||||
|
||||
target_link_options(${TARGET} PRIVATE
|
||||
-nostartfiles
|
||||
-nostdlib
|
||||
-T ${CMAKE_SOURCE_DIR}/src/${TARGET_MEM}.lds
|
||||
-Wl,--gc-sections
|
||||
-Wl,-Map=${CMAKE_BINARY_DIR}/${TARGET}.map)
|
||||
|
||||
add_custom_command(TARGET ${TARGET} POST_BUILD
|
||||
@@ -89,5 +77,5 @@ function(setup_target TARGET)
|
||||
endfunction()
|
||||
|
||||
setup_target(thread_demo LIBRARIES threadx SOURCES src/thread_demo/main.c)
|
||||
setup_target(tcp_demo LIBRARIES threadx netxduo SOURCES src/tcp_demo/main.c)
|
||||
setup_target(smp_demo PLATFORM_TARGET moonlight_platform_common_smp LIBRARIES threadx_smp SOURCES src/thread_demo/main.c)
|
||||
#setup_target(tcp_demo LIBRARIES threadx netxduo SOURCES src/tcp_demo/main.c)
|
||||
#setup_target(smp_demo LIBRARIES threadx_smp SOURCES src/thread_demo/main.c)
|
||||
|
||||
Reference in New Issue
Block a user