forked from OpenEtherCATsociety/SOEM
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable and fix warnings (OpenEtherCATsociety#123)
* cleanup CMakeLists.txt * build with more warnings, warnings as errors * fix expression has no effect warning * fix unused parameter warnings * fix loss of precision warning * remove obsolete files
- Loading branch information
1 parent
0ece316
commit da7d55e
Showing
12 changed files
with
99 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,68 @@ | ||
cmake_minimum_required(VERSION 2.8.4) | ||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules") | ||
project(SOEM C) | ||
|
||
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) | ||
# Default to installing in SOEM source directory | ||
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/install) | ||
endif() | ||
|
||
set(SOEM_INCLUDE_INSTALL_DIR include/soem) | ||
|
||
message("CMAKE_SYSTEM_NAME is ${CMAKE_SYSTEM_NAME}") | ||
|
||
if(WIN32) | ||
set(OS "win32") | ||
include_directories(oshw/win32/wpcap/Include) | ||
link_directories(${CMAKE_SOURCE_DIR}/oshw/win32/wpcap/Lib) | ||
elseif(UNIX) | ||
set(OS "linux") | ||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "rt-kernel") | ||
set(OS "rtk") | ||
message("ARCH is ${ARCH}") | ||
message("BSP is ${BSP}") | ||
include_directories(oshw/${OS}/${ARCH}) | ||
add_definitions("-Wno-unused-but-set-variable") | ||
add_definitions("-Wno-unused-function") | ||
add_definitions("-Wno-format") | ||
endif() | ||
|
||
message("OS is ${OS}") | ||
|
||
include_directories(soem) | ||
include_directories(osal) | ||
include_directories(osal/${OS}) | ||
include_directories(oshw/${OS}) | ||
|
||
if (MSVC) | ||
set(CMAKE_C_FLAGS_RELEASE "/D _CRT_SECURE_NO_WARNINGS /EHsc") | ||
set(CMAKE_C_FLAGS_DEBUG "/D _CRT_SECURE_NO_WARNINGS /EHsc /ZI /Od") | ||
endif() | ||
|
||
file(GLOB SOEM_SOURCES soem/*.c) | ||
file(GLOB OSAL_SOURCES osal/${OS}/*.c) | ||
file(GLOB OSHW_SOURCES oshw/${OS}/*.c) | ||
|
||
if(WIN32) | ||
set(SOEM_SOURCES ${SOEM_SOURCES}) | ||
endif() | ||
|
||
file(GLOB SOEM_HEADERS soem/*.h) | ||
file(GLOB OSAL_HEADERS osal/osal.h osal/${OS}/*.h) | ||
file(GLOB OSHW_HEADERS oshw/${OS}/*.h) | ||
|
||
if(${CMAKE_SYSTEM_NAME} MATCHES "rt-kernel") | ||
file(GLOB OSHW_ARCHSOURCES oshw/${OS}/${ARCH}/*.c) | ||
endif() | ||
|
||
add_library(soem STATIC ${SOEM_SOURCES} ${OSAL_SOURCES} ${OSHW_SOURCES} ${OSHW_ARCHSOURCES}) | ||
if(WIN32) | ||
target_link_libraries(soem wpcap.lib Packet.lib Ws2_32.lib Winmm.lib ${HDF5_LIBRARIES}) | ||
elseif(UNIX) | ||
target_link_libraries(soem pthread rt) | ||
endif() | ||
|
||
install(TARGETS soem DESTINATION lib) | ||
install(FILES ${SOEM_HEADERS} ${OSAL_HEADERS} ${OSHW_HEADERS} DESTINATION ${SOEM_INCLUDE_INSTALL_DIR}) | ||
|
||
add_subdirectory(test/linux/slaveinfo) | ||
add_subdirectory(test/linux/eepromtool) | ||
add_subdirectory(test/linux/simple_test) | ||
cmake_minimum_required(VERSION 2.8.4) | ||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules") | ||
project(SOEM C) | ||
|
||
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) | ||
# Default to installing in SOEM source directory | ||
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/install) | ||
endif() | ||
|
||
set(SOEM_INCLUDE_INSTALL_DIR include/soem) | ||
|
||
if(WIN32) | ||
set(OS "win32") | ||
include_directories(oshw/win32/wpcap/Include) | ||
link_directories(${CMAKE_SOURCE_DIR}/oshw/win32/wpcap/Lib) | ||
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) | ||
set(OS "linux") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror") | ||
set(OS_LIBS pthread rt) | ||
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") | ||
endif() | ||
|
||
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) | ||
|
||
include_directories(soem) | ||
include_directories(osal) | ||
include_directories(osal/${OS}) | ||
include_directories(oshw/${OS}) | ||
|
||
add_library(soem STATIC | ||
${SOEM_SOURCES} | ||
${OSAL_SOURCES} | ||
${OSHW_SOURCES} | ||
${OSHW_EXTRA_SOURCES}) | ||
target_link_libraries(soem ${OS_LIBS}) | ||
|
||
install(TARGETS soem DESTINATION lib) | ||
install(FILES | ||
${SOEM_HEADERS} | ||
${OSAL_HEADERS} | ||
${OSHW_HEADERS} | ||
DESTINATION ${SOEM_INCLUDE_INSTALL_DIR}) | ||
|
||
add_subdirectory(test/linux/slaveinfo) | ||
add_subdirectory(test/linux/eepromtool) | ||
add_subdirectory(test/linux/simple_test) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,5 @@ | ||
|
||
set(SOURCES eepromtool.c) | ||
add_executable(eepromtool ${SOURCES}) | ||
target_link_libraries(eepromtool soem) | ||
|
||
if(WIN32) | ||
target_link_libraries(eepromtool wpcap.lib Packet.lib Ws2_32.lib Winmm.lib) | ||
elseif(UNIX) | ||
target_link_libraries(eepromtool pthread rt) | ||
endif() | ||
|
||
install(TARGETS eepromtool DESTINATION bin) | ||
|
||
set(SOURCES eepromtool.c) | ||
add_executable(eepromtool ${SOURCES}) | ||
target_link_libraries(eepromtool soem) | ||
install(TARGETS eepromtool DESTINATION bin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,5 @@ | ||
|
||
set(SOURCES simple_test.c) | ||
add_executable(simple_test ${SOURCES}) | ||
target_link_libraries(simple_test soem) | ||
|
||
if(WIN32) | ||
target_link_libraries(simple_test wpcap.lib Packet.lib Ws2_32.lib Winmm.lib) | ||
elseif(UNIX) | ||
target_link_libraries(simple_test pthread rt) | ||
endif() | ||
|
||
install(TARGETS simple_test DESTINATION bin) | ||
|
||
set(SOURCES simple_test.c) | ||
add_executable(simple_test ${SOURCES}) | ||
target_link_libraries(simple_test soem) | ||
install(TARGETS simple_test DESTINATION bin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,5 @@ | ||
|
||
set(SOURCES slaveinfo.c) | ||
add_executable(slaveinfo ${SOURCES}) | ||
target_link_libraries(slaveinfo soem) | ||
|
||
if(WIN32) | ||
target_link_libraries(slaveinfo wpcap.lib Packet.lib Ws2_32.lib Winmm.lib) | ||
elseif(UNIX) | ||
target_link_libraries(slaveinfo pthread rt) | ||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "rt-kernel") | ||
target_link_libraries(slaveinfo "-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") | ||
endif() | ||
|
||
install(TARGETS slaveinfo DESTINATION bin) | ||
|
||
set(SOURCES slaveinfo.c) | ||
add_executable(slaveinfo ${SOURCES}) | ||
target_link_libraries(slaveinfo soem) | ||
install(TARGETS slaveinfo DESTINATION bin) |