Modularize CMakefiles
Move platform specifics to the cmake subdirectory and rework rt-kernel toolchain configuration. Allow building soem as shared library on linux/darwin. Change-Id: Icbb6607166a640a1243eb5e91a96ee5cc1ed8254pull/343/head
parent
09d48acc32
commit
f547b6c775
143
CMakeLists.txt
143
CMakeLists.txt
|
@ -1,100 +1,85 @@
|
|||
cmake_minimum_required(VERSION 2.8.12)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")
|
||||
# Licensed under the GNU General Public License version 2 with exceptions. See
|
||||
# LICENSE file in the project root for full license information
|
||||
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
||||
project(SOEM C)
|
||||
|
||||
# Default to installing in SOEM source directory
|
||||
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
# Default to installing in SOEM source directory
|
||||
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/install)
|
||||
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/install
|
||||
CACHE PATH "Default install path" FORCE)
|
||||
endif()
|
||||
|
||||
set(SOEM_INCLUDE_INSTALL_DIR include/soem)
|
||||
set(SOEM_LIB_INSTALL_DIR lib)
|
||||
# Let platforms disable test programs
|
||||
set(BUILD_TESTS TRUE)
|
||||
|
||||
if(WIN32)
|
||||
set(OS "win32")
|
||||
include_directories(oshw/win32/wpcap/Include)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
link_directories(${CMAKE_SOURCE_DIR}/oshw/win32/wpcap/Lib/x64)
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
link_directories(${CMAKE_SOURCE_DIR}/oshw/win32/wpcap/Lib)
|
||||
endif()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D _CRT_SECURE_NO_WARNINGS")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
|
||||
set(OS_LIBS wpcap.lib Packet.lib Ws2_32.lib Winmm.lib)
|
||||
elseif(UNIX AND NOT APPLE)
|
||||
set(OS "linux")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror")
|
||||
set(OS_LIBS pthread rt)
|
||||
elseif(APPLE)
|
||||
# This must come *before* linux or MacOSX will identify as Unix.
|
||||
set(OS "macosx")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror")
|
||||
set(OS_LIBS pthread pcap)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "rt-kernel")
|
||||
set(OS "rtk")
|
||||
message("ARCH is ${ARCH}")
|
||||
message("BSP is ${BSP}")
|
||||
include_directories(oshw/${OS}/${ARCH})
|
||||
file(GLOB OSHW_EXTRA_SOURCES oshw/${OS}/${ARCH}/*.c)
|
||||
set(OSHW_SOURCES "${OS_HW_SOURCES} ${OSHW_ARCHSOURCES}")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-but-set-variable")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-format")
|
||||
set(OS_LIBS "-Wl,--start-group -l${BSP} -l${ARCH} -lkern -ldev -lsio -lblock -lfs -lusb -llwip -leth -li2c -lrtc -lcan -lnand -lspi -lnor -lpwm -ladc -ltrace -lc -lm -Wl,--end-group")
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "rtems")
|
||||
message("Building for RTEMS")
|
||||
set(OS "rtems")
|
||||
set(SOEM_LIB_INSTALL_DIR ${LIB_DIR})
|
||||
set(BUILD_TESTS FALSE)
|
||||
endif()
|
||||
# Always use standard .o suffix
|
||||
set(CMAKE_C_OUTPUT_EXTENSION_REPLACE 1)
|
||||
set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)
|
||||
|
||||
message("OS is ${OS}")
|
||||
|
||||
file(GLOB SOEM_SOURCES soem/*.c)
|
||||
file(GLOB OSAL_SOURCES osal/${OS}/*.c)
|
||||
file(GLOB OSHW_SOURCES oshw/${OS}/*.c)
|
||||
|
||||
file(GLOB SOEM_HEADERS soem/*.h)
|
||||
file(GLOB OSAL_HEADERS osal/osal.h osal/${OS}/*.h)
|
||||
file(GLOB OSHW_HEADERS oshw/${OS}/*.h)
|
||||
|
||||
add_library(soem STATIC
|
||||
${SOEM_SOURCES}
|
||||
${OSAL_SOURCES}
|
||||
${OSHW_SOURCES}
|
||||
${OSHW_EXTRA_SOURCES})
|
||||
target_link_libraries(soem ${OS_LIBS})
|
||||
add_library(soem
|
||||
soem/ethercatbase.c
|
||||
soem/ethercatbase.h
|
||||
soem/ethercatcoe.c
|
||||
soem/ethercatcoe.h
|
||||
soem/ethercatconfig.c
|
||||
soem/ethercatconfig.h
|
||||
soem/ethercatconfiglist.h
|
||||
soem/ethercatdc.c
|
||||
soem/ethercatdc.h
|
||||
soem/ethercateoe.c
|
||||
soem/ethercateoe.h
|
||||
soem/ethercatfoe.c
|
||||
soem/ethercatfoe.h
|
||||
soem/ethercat.h
|
||||
soem/ethercatmain.c
|
||||
soem/ethercatmain.h
|
||||
soem/ethercatprint.c
|
||||
soem/ethercatprint.h
|
||||
soem/ethercatsoe.c
|
||||
soem/ethercatsoe.h
|
||||
soem/ethercattype.h
|
||||
)
|
||||
|
||||
target_include_directories(soem PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/soem>
|
||||
$<INSTALL_INTERFACE:include/soem>)
|
||||
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/soem>
|
||||
$<INSTALL_INTERFACE:include/soem>
|
||||
)
|
||||
target_include_directories(soem PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/osal>
|
||||
$<INSTALL_INTERFACE:include/soem>)
|
||||
|
||||
target_include_directories(soem PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/osal/${OS}>
|
||||
$<INSTALL_INTERFACE:include/soem>)
|
||||
|
||||
target_include_directories(soem
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/oshw/${OS}>
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/osal>
|
||||
$<INSTALL_INTERFACE:include/soem>
|
||||
)
|
||||
|
||||
message("LIB_DIR: ${SOEM_LIB_INSTALL_DIR}")
|
||||
include(${CMAKE_SYSTEM_NAME})
|
||||
|
||||
install(TARGETS soem EXPORT soemConfig DESTINATION ${SOEM_LIB_INSTALL_DIR})
|
||||
install(
|
||||
TARGETS soem
|
||||
EXPORT soemConfig
|
||||
DESTINATION lib
|
||||
)
|
||||
|
||||
install(EXPORT soemConfig DESTINATION ${SOEM_LIB_INSTALL_DIR}/cmake)
|
||||
install(
|
||||
EXPORT soemConfig
|
||||
DESTINATION cmake
|
||||
)
|
||||
|
||||
install(FILES
|
||||
${SOEM_HEADERS}
|
||||
${OSAL_HEADERS}
|
||||
${OSHW_HEADERS}
|
||||
DESTINATION ${SOEM_INCLUDE_INSTALL_DIR})
|
||||
soem/ethercatbase.h
|
||||
soem/ethercatcoe.h
|
||||
soem/ethercatconfig.h
|
||||
soem/ethercatconfiglist.h
|
||||
soem/ethercatdc.h
|
||||
soem/ethercateoe.h
|
||||
soem/ethercatfoe.h
|
||||
soem/ethercat.h
|
||||
soem/ethercatmain.h
|
||||
soem/ethercatprint.h
|
||||
soem/ethercatsoe.h
|
||||
soem/ethercattype.h
|
||||
osal/osal.h
|
||||
DESTINATION include/soem
|
||||
)
|
||||
|
||||
if(BUILD_TESTS)
|
||||
add_subdirectory(test/linux/slaveinfo)
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
# Licensed under the GNU General Public License version 2 with exceptions. See
|
||||
# LICENSE file in the project root for full license information
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
||||
|
||||
target_sources(soem PRIVATE
|
||||
osal/macosx/osal.c
|
||||
osal/macosx/osal_defs.h
|
||||
oshw/macosx/oshw.c
|
||||
oshw/macosx/oshw.h
|
||||
oshw/macosx/nicdrv.c
|
||||
oshw/macosx/nicdrv.h
|
||||
)
|
||||
|
||||
target_include_directories(soem PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/osal/macosx>
|
||||
$<INSTALL_INTERFACE:include/soem>
|
||||
)
|
||||
|
||||
target_include_directories(soem PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/oshw/macosx>
|
||||
$<INSTALL_INTERFACE:include/soem>
|
||||
)
|
||||
|
||||
add_definitions(-Wall -Wextra -Werror)
|
||||
|
||||
target_link_libraries(soem PUBLIC pthread pcap)
|
||||
|
||||
install(FILES
|
||||
osal/macosx/osal_defs.h
|
||||
DESTINATION include/soem
|
||||
)
|
|
@ -0,0 +1,32 @@
|
|||
# Licensed under the GNU General Public License version 2 with exceptions. See
|
||||
# LICENSE file in the project root for full license information
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
||||
|
||||
target_sources(soem PRIVATE
|
||||
osal/linux/osal.c
|
||||
osal/linux/osal_defs.h
|
||||
oshw/linux/oshw.c
|
||||
oshw/linux/oshw.h
|
||||
oshw/linux/nicdrv.c
|
||||
oshw/linux/nicdrv.h
|
||||
)
|
||||
|
||||
target_include_directories(soem PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/osal/linux>
|
||||
$<INSTALL_INTERFACE:include/soem>
|
||||
)
|
||||
|
||||
target_include_directories(soem PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/oshw/linux>
|
||||
$<INSTALL_INTERFACE:include/soem>
|
||||
)
|
||||
|
||||
add_definitions(-Wall -Wextra -Werror)
|
||||
|
||||
target_link_libraries(soem PUBLIC pthread rt)
|
||||
|
||||
install(FILES
|
||||
osal/linux/osal_defs.h
|
||||
DESTINATION include/soem
|
||||
)
|
|
@ -1,13 +0,0 @@
|
|||
|
||||
message("rt-kernel-C.cmake")
|
||||
|
||||
# Determine toolchain
|
||||
include(CMakeForceCompiler)
|
||||
|
||||
if(${ARCH} MATCHES "kinetis")
|
||||
cmake_force_c_compiler(arm-eabi-gcc GNU)
|
||||
cmake_force_cxx_compiler(arm-eabi-g++ GNU)
|
||||
elseif(${ARCH} MATCHES "bfin")
|
||||
cmake_force_c_compiler(bfin-elf-gcc GNU)
|
||||
cmake_force_cxx_compiler(bfin-elf-g++ GNU)
|
||||
endif()
|
|
@ -1,3 +0,0 @@
|
|||
|
||||
set(MACHINE "-mcpu=bf537")
|
||||
set(LDFLAGS "-T${RT_KERNEL_PATH}/bsp/${BSP}/${BSP}.ld")
|
|
@ -1,7 +0,0 @@
|
|||
|
||||
message("rt-kernel-gcc-kinetis.cmake")
|
||||
|
||||
#SET_PROPERTY(GLOBAL PROPERTY ARCH kinetis)
|
||||
#SET_PROPERTY(GLOBAL PROPERTY BSP twrk60)
|
||||
|
||||
set(MACHINE "-mfpu=vfp -mcpu=cortex-m3 -mthumb")
|
|
@ -1,19 +0,0 @@
|
|||
|
||||
message("rt-kernel-gcc.cmake")
|
||||
|
||||
set(CMAKE_C_OUTPUT_EXTENSION .o)
|
||||
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
|
||||
|
||||
set(CFLAGS "${CFLAGS} -Wall -Wextra -Wno-unused-parameter -Werror")
|
||||
set(CFLAGS "${CFLAGS} -fomit-frame-pointer -fno-strict-aliasing -fshort-wchar")
|
||||
#set(CFLAGS" ${CFLAGS} -B$(GCC_PATH)/libexec/gcc")
|
||||
|
||||
set(CXXFLAGS "${CXXFLAGS} -fno-rtti -fno-exceptions")
|
||||
|
||||
set(LDFLAGS "${LDFLAGS} -nostartfiles")
|
||||
|
||||
set(CMAKE_C_FLAGS "${CFLAGS} ${MACHINE}" CACHE STRING "")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${MACHINE} ${LDFLAGS}" CACHE STRING "")
|
||||
|
||||
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
if(__RTK_CMAKE_INCLUDED)
|
||||
return()
|
||||
endif()
|
||||
set(__RTK_CMAKE_INCLUDED TRUE)
|
||||
message("rt-kernel.cmake")
|
||||
|
||||
include_directories(
|
||||
${RT_KERNEL_PATH}/include
|
||||
${RT_KERNEL_PATH}/include/kern
|
||||
${RT_KERNEL_PATH}/kern
|
||||
${RT_KERNEL_PATH}/include/drivers
|
||||
${RT_KERNEL_PATH}/include/arch/${ARCH}
|
||||
${RT_KERNEL_PATH}/bsp/${BSP}/include
|
||||
${RT_KERNEL_PATH}/lwip/src/include
|
||||
${RT_KERNEL_PATH}/lwip/src/include/ipv4
|
||||
)
|
||||
|
||||
link_directories(
|
||||
${RT_KERNEL_PATH}/lib/${ARCH}
|
||||
)
|
|
@ -0,0 +1,70 @@
|
|||
# Licensed under the GNU General Public License version 2 with exceptions. See
|
||||
# LICENSE file in the project root for full license information
|
||||
|
||||
# Guard against multiple inclusion
|
||||
if(_RT_KERNEL_CMAKE_)
|
||||
return()
|
||||
endif()
|
||||
set(_RT_KERNEL_CMAKE_ TRUE)
|
||||
|
||||
cmake_minimum_required (VERSION 3.1.2)
|
||||
|
||||
# Avoid warning when re-running cmake
|
||||
set(DUMMY ${CMAKE_TOOLCHAIN_FILE})
|
||||
|
||||
# No support for shared libs
|
||||
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
|
||||
|
||||
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
|
||||
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
|
||||
set(CMAKE_EXECUTABLE_SUFFIX ".elf")
|
||||
|
||||
# Get environment variables
|
||||
set(RTK $ENV{RTK} CACHE STRING
|
||||
"Location of rt-kernel tree")
|
||||
set(COMPILERS $ENV{COMPILERS} CACHE STRING
|
||||
"Location of compiler toolchain")
|
||||
set(BSP $ENV{BSP} CACHE STRING
|
||||
"The name of the BSP to build for")
|
||||
|
||||
# Common flags
|
||||
add_definitions(-fomit-frame-pointer -fno-strict-aliasing -fshort-wchar)
|
||||
|
||||
# Common includes
|
||||
include_directories(
|
||||
$ENV{RTK}/include
|
||||
$ENV{RTK}/include/kern
|
||||
$ENV{RTK}/include/drivers
|
||||
$ENV{RTK}/include/arch/${ARCH}
|
||||
$ENV{RTK}/bsp/${BSP}/include
|
||||
$ENV{RTK}/lwip/src/include
|
||||
)
|
||||
|
||||
link_libraries(
|
||||
shell
|
||||
dev
|
||||
block
|
||||
fs
|
||||
usb
|
||||
lwip
|
||||
eth
|
||||
i2c
|
||||
rtc
|
||||
can
|
||||
nand
|
||||
spi
|
||||
nor
|
||||
pwm
|
||||
adc
|
||||
trace
|
||||
sio
|
||||
kern
|
||||
${ARCH}
|
||||
${BSP}
|
||||
c
|
||||
m
|
||||
)
|
||||
|
||||
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -nostartfiles -L${RTK}/lib/${ARCH}/${VARIANT}/${CPU} -T${RTK}/bsp/${BSP}/${BSP}.ld -Wl,--gc-sections -Wl,--start-group <LINK_LIBRARIES> -Wl,--end-group")
|
||||
|
||||
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -nostartfiles -L${RTK}/lib/${ARCH}/${VARIANT}/${CPU} -T${RTK}/bsp/${BSP}/${BSP}.ld -Wl,--gc-sections -Wl,--start-group <LINK_LIBRARIES> -Wl,--end-group")
|
|
@ -8,15 +8,5 @@ set(CMAKE_CXX_COMPILER_FORCED true)
|
|||
set(CMAKE_C_COMPILER ${RTEMS_TOOLS_PATH}/bin/${ARCH}-gcc)
|
||||
set(CMAKE_CXX_COMPILER ${RTEMS_TOOLS_PATH}/bin/${ARCH}-g++)
|
||||
|
||||
set(SOEM_INCLUDE_INSTALL_DIR ${INCLUDE_DIR}/soem)
|
||||
set(SOEM_LIB_INSTALL_DIR ${LIB_DIR})
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${HOST_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${HOST_CXX_FLAGS}")
|
||||
|
||||
if(NOT ${HOST_LIBS} STREQUAL "")
|
||||
set(OS_LIBS "rtemscpu bsd ${HOST_LIBS}")
|
||||
else()
|
||||
set(OS_LIBS "-lrtemscpu -lbsd")
|
||||
endif()
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
|
||||
message("rt-kernel-kinetis.cmake")
|
||||
|
||||
set(CMAKE_SYSTEM_NAME rt-kernel)
|
||||
set(CMAKE_SYSTEM_VERSION 1)
|
||||
set(CMAKE_SYSTEM_PROCESSOR bfin)
|
||||
|
||||
set(ARCH bfin CACHE STRING "Architecture")
|
||||
set(BSP stamp537 CACHE STRING "Board")
|
|
@ -1,9 +0,0 @@
|
|||
|
||||
message("rt-kernel-kinetis.cmake")
|
||||
|
||||
set(CMAKE_SYSTEM_NAME rt-kernel)
|
||||
set(CMAKE_SYSTEM_VERSION 1)
|
||||
set(CMAKE_SYSTEM_PROCESSOR kinetis)
|
||||
|
||||
set(ARCH kinetis CACHE STRING "Architecture")
|
||||
set(BSP twrk60 CACHE STRING "Board")
|
|
@ -0,0 +1,46 @@
|
|||
# Licensed under the GNU General Public License version 2 with exceptions. See
|
||||
# LICENSE file in the project root for full license information
|
||||
|
||||
target_sources(soem PRIVATE
|
||||
osal/win32/osal.c
|
||||
osal/win32/osal_defs.h
|
||||
oshw/win32/oshw.c
|
||||
oshw/win32/oshw.h
|
||||
oshw/win32/nicdrv.c
|
||||
oshw/win32/nicdrv.h
|
||||
)
|
||||
|
||||
target_include_directories(soem PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/osal/win32>
|
||||
$<INSTALL_INTERFACE:include/soem>
|
||||
)
|
||||
|
||||
target_include_directories(soem PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/oshw/win32>
|
||||
$<INSTALL_INTERFACE:include/soem>
|
||||
)
|
||||
|
||||
target_include_directories(soem PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/oshw/win32/wpcap/Include>
|
||||
$<INSTALL_INTERFACE:include/soem>
|
||||
)
|
||||
|
||||
add_definitions(/D _CRT_SECURE_NO_WARNINGS /WX)
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(WPCAP_LIB_PATH ${CMAKE_SOURCE_DIR}/oshw/win32/wpcap/Lib/x64)
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(WPCAP_LIB_PATH ${CMAKE_SOURCE_DIR}/oshw/win32/wpcap/Lib)
|
||||
endif()
|
||||
|
||||
target_link_libraries(soem PUBLIC
|
||||
${WPCAP_LIB_PATH}/wpcap.lib
|
||||
${WPCAP_LIB_PATH}/Packet.lib
|
||||
Ws2_32.lib
|
||||
Winmm.lib
|
||||
)
|
||||
|
||||
install(FILES
|
||||
osal/win32/osal_defs.h
|
||||
DESTINATION include/soem
|
||||
)
|
|
@ -0,0 +1,40 @@
|
|||
# Licensed under the GNU General Public License version 2 with exceptions. See
|
||||
# LICENSE file in the project root for full license information
|
||||
|
||||
target_sources(soem PRIVATE
|
||||
osal/rtk/osal.c
|
||||
osal/rtk/osal_defs.h
|
||||
oshw/rtk/oshw.c
|
||||
oshw/rtk/oshw.h
|
||||
oshw/rtk/nicdrv.c
|
||||
oshw/rtk/nicdrv.h
|
||||
oshw/rtk/lw_mac/lw_emac.c
|
||||
oshw/rtk/lw_mac/lw_emac.h
|
||||
oshw/rtk/fec/fec_ecat.c
|
||||
oshw/rtk/fec/fec_ecat.h
|
||||
)
|
||||
|
||||
target_include_directories(soem PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/osal/rtk>
|
||||
$<INSTALL_INTERFACE:include/soem>
|
||||
)
|
||||
|
||||
target_include_directories(soem PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/oshw/rtk>
|
||||
$<INSTALL_INTERFACE:include/soem>
|
||||
)
|
||||
|
||||
add_definitions(
|
||||
-D${BSP}
|
||||
-g
|
||||
-Wall
|
||||
-Wextra
|
||||
-Werror
|
||||
-Wno-unused-parameter
|
||||
-Wno-format
|
||||
)
|
||||
|
||||
install(FILES
|
||||
osal/rtk/osal_defs.h
|
||||
DESTINATION include/soem
|
||||
)
|
|
@ -0,0 +1,33 @@
|
|||
# Licensed under the GNU General Public License version 2 with exceptions. See
|
||||
# LICENSE file in the project root for full license information
|
||||
|
||||
set(BUILD_TESTS FALSE)
|
||||
|
||||
target_sources(soem PRIVATE
|
||||
osal/rtems/osal.c
|
||||
osal/rtems/osal_defs.h
|
||||
oshw/rtems/oshw.c
|
||||
oshw/rtems/oshw.h
|
||||
oshw/rtems/nicdrv.c
|
||||
oshw/rtems/nicdrv.h
|
||||
)
|
||||
|
||||
target_include_directories(soem PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/osal/rtems>
|
||||
$<INSTALL_INTERFACE:include/soem>
|
||||
)
|
||||
|
||||
target_include_directories(soem PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/oshw/rtems>
|
||||
$<INSTALL_INTERFACE:include/soem>
|
||||
)
|
||||
|
||||
add_definitions(-Wall -Wextra -Werror)
|
||||
|
||||
target_link_libraries(soem PUBLIC rtemscpu bsd ${HOST_LIBS})
|
||||
|
||||
install(FILES
|
||||
osal/rtems/osal_defs.h
|
||||
DESTINATION include/soem
|
||||
)
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
# Licensed under the GNU General Public License version 2 with exceptions. See
|
||||
# LICENSE file in the project root for full license information
|
||||
|
||||
# the name of the target operating system
|
||||
set(CMAKE_SYSTEM_NAME rt-kernel)
|
||||
|
||||
# which compiler to use
|
||||
set(CMAKE_C_COMPILER $ENV{COMPILERS}/bfin-elf/bin/bfin-elf-gcc)
|
||||
set(CMAKE_CXX_COMPILER $ENV{COMPILERS}/bfin-elf/bin/bfin-elf-gcc)
|
||||
if(CMAKE_HOST_WIN32)
|
||||
set(CMAKE_C_COMPILER ${CMAKE_C_COMPILER}.exe)
|
||||
set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER}.exe)
|
||||
endif(CMAKE_HOST_WIN32)
|
||||
|
||||
set(ARCH bfin)
|
||||
set(CPU bfin)
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mcpu=bf537
|
||||
)
|
||||
|
||||
add_definitions(${MACHINE})
|
||||
add_link_options(${MACHINE})
|
|
@ -0,0 +1,31 @@
|
|||
# Licensed under the GNU General Public License version 2 with exceptions. See
|
||||
# LICENSE file in the project root for full license information
|
||||
|
||||
# Guard against multiple inclusion
|
||||
if(_RT_KERNEL_IMX6_CMAKE_)
|
||||
return()
|
||||
endif()
|
||||
set(_RT_KERNEL_IMX6_CMAKE_ TRUE)
|
||||
|
||||
# the name of the target operating system
|
||||
set(CMAKE_SYSTEM_NAME rt-kernel)
|
||||
|
||||
# which compiler to use
|
||||
set(CMAKE_C_COMPILER $ENV{COMPILERS}/arm-eabi/bin/arm-eabi-gcc)
|
||||
set(CMAKE_CXX_COMPILER $ENV{COMPILERS}/arm-eabi/bin/arm-eabi-gcc)
|
||||
if(CMAKE_HOST_WIN32)
|
||||
set(CMAKE_C_COMPILER ${CMAKE_C_COMPILER}.exe)
|
||||
set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER}.exe)
|
||||
endif(CMAKE_HOST_WIN32)
|
||||
|
||||
set(ARCH imx6)
|
||||
set(CPU cortex-a9-vfp)
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mcpu=cortex-a9
|
||||
-mfpu=vfpv3-d16
|
||||
-mfloat-abi=hard
|
||||
)
|
||||
|
||||
add_definitions(${MACHINE})
|
||||
add_link_options(${MACHINE})
|
Loading…
Reference in New Issue