implement auto avaluation of used platform. To use it simply not add -DPLATFORM (#98)

This commit is contained in:
redPanther 2016-07-11 11:02:18 +02:00 committed by brindosch
parent c2e2c26ab2
commit 2013304130
2 changed files with 21 additions and 2 deletions

View File

@ -32,6 +32,27 @@ if (APPLE)
SET ( DEFAULT_OSX ON )
SET ( DEFAULT_V4l2 OFF )
else ()
if ( NOT DEFINED PLATFORM )
if ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86" )
SET( PLATFORM "x86")
elseif ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm" )
SET( PLATFORM "rpi")
EXEC_PROGRAM( "nproc" OUTPUT_VARIABLE SYSTEM_CPU_CORES )
FILE( READ /proc/cpuinfo SYSTEM_CPUINFO )
STRING ( TOLOWER "${SYSTEM_CPUINFO}" SYSTEM_CPUINFO )
if ( "${SYSTEM_CPUINFO}" MATCHES "amlogic" )
SET( PLATFORM "wetek" )
elseif( SYSTEM_CPU_CORES GREATER 1 AND "${SYSTEM_CPUINFO}" MATCHES "bcm" )
SET( PLATFORM "rpi-pwm" )
endif()
endif()
if ( PLATFORM )
message( STATUS "PLATFORM is not defined, evaluated platform: ${PLATFORM}")
else()
message( FATAL_ERROR "PLATFORM is not defined and could not be evaluated. Set -DPLATFORM=<rpi|pri-pwm|wetek|x86>")
endif()
endif()
if ( "${PLATFORM}" STREQUAL "rpi" )
SET ( DEFAULT_DISPMANX ON )
SET ( DEFAULT_SPIDEV ON )

View File

@ -45,7 +45,6 @@ if (USE_SHARED_AVAHI_LIBS)
avahi-client
avahi-common
avahi-core
# avahi-qt4
dbus-1)
else()
target_link_libraries(bonjour
@ -53,6 +52,5 @@ else()
libavahi-client.a
libavahi-common.a
libavahi-core.a
# libavahi-qt4.a
libdbus-1.a)
endif()