http://andescore.blogspot.com/2009/08/cmake-andes-toolchains3.html
To run mySrv and myCli on mipsel platform. Add below lines in src/CMakeLists.txt and lib/CMakeLists.txt.
SET(CMAKE_C_COMPILER mipsel-linux-gcc)
SET(CMAKE_CXX_COMPILER mipsel-linux-g++) SET(AS mipsel-linux-as) SET(AR mipsel-linux-ar) SET(LD mipsel-linux-ld) SET(NM mipsel-linux-nm) SET(OBJCOPY mipsel-linux-objcopy) SET(OBJDUMP mipsel-linux-objdump) SET(READELF mipsel-linux-readelf) $ cat src/CMakeLists.txt SET(CMAKE_C_COMPILER mipsel-linux-gcc) SET(CMAKE_CXX_COMPILER mipsel-linux-g++) SET(AS mipsel-linux-as) SET(AR mipsel-linux-ar) SET(LD mipsel-linux-ld) SET(NM mipsel-linux-nm) SET(OBJCOPY mipsel-linux-objcopy) SET(OBJDUMP mipsel-linux-objdump) SET(READELF mipsel-linux-readelf) INCLUDE_DIRECTORIES(${MYSOCKET_SOURCE_DIR}/lib) LINK_DIRECTORIES(${MYSOCKET_BINARY_DIR}/lib) ADD_EXECUTABLE(mySrv tcpSrvDemo.c) ADD_EXECUTABLE(myCli tcpCliDemo.c) TARGET_LINK_LIBRARIES(mySrv myTcpSocket) TARGET_LINK_LIBRARIES(myCli myTcpSocket) $ cat lib/CMakeLists.txt SET(CMAKE_C_COMPILER mipsel-linux-gcc) SET(CMAKE_CXX_COMPILER mipsel-linux-g++) SET(AS mipsel-linux-as) SET(AR mipsel-linux-ar) SET(LD mipsel-linux-ld) SET(NM mipsel-linux-nm) SET(OBJCOPY mipsel-linux-objcopy) SET(OBJDUMP mipsel-linux-objdump) SET(READELF mipsel-linux-readelf) FIND_LIBRARY(PTHREAD pthread) ADD_LIBRARY(myLL myLL.c) ADD_LIBRARY(myTcpSocket myTcpSocket.c) TARGET_LINK_LIBRARIES(myTcpSocket myLL ${PTHREAD}) $ cd build $ cmake .. $ make [ 25%] Built target myLL [ 50%] Built target myTcpSocket [ 75%] Building C object src/CMakeFiles/myCli.dir/tcpCliDemo.c.o Linking C executable myCli [ 75%] Built target myCli [100%] Building C object src/CMakeFiles/mySrv.dir/tcpSrvDemo.c.o Linking C executable mySrv [100%] Built target mySrv $ file src/my* src/myCli: ELF 32-bit LSB executable, MIPS, MIPS32 version 1 (SYSV), dynamically linked (uses shared libs), not stripped src/mySrv: ELF 32-bit LSB executable, MIPS, MIPS32 version 1 (SYSV), dynamically linked (uses shared libs), not stripped
mySrc is running on mips platform with Linux kernel 2.6.12.
[packet] [inform] [close] are receiving status.
[status] is the server status report.
沒有留言:
張貼留言