cmake_minimum_required(VERSION 2.6)
PROJECT(oscpack)

#
# Endianess detection
#

INCLUDE(TestBigEndian)
TEST_BIG_ENDIAN(BIGENDIAN)
IF(${BIGENDIAN})
     ADD_DEFINITIONS(-DOSC_HOST_BIG_ENDIAN)
ELSE(${BIGENDIAN})
     ADD_DEFINITIONS(-DOSC_HOST_LITTLE_ENDIAN)
ENDIF(${BIGENDIAN})

INCLUDE_DIRECTORIES(.)

IF(WIN32)
 set(SystemTypePath ip/win32)
ELSE(WIN32)
 set(SystemTypePath ip/posix)
ENDIF(WIN32)

ADD_LIBRARY(oscpack STATIC
	ip/IpEndpointName.cpp 
	${SystemTypePath}/NetworkingUtils.cpp
	${SystemTypePath}/UdpSocket.cpp
	osc/OscPrintReceivedElements.cpp
	osc/OscReceivedElements.cpp 
	osc/OscTypes.cpp 
	osc/OscOutboundPacketStream.cpp
)

IF(WIN32)
	TARGET_LINK_LIBRARIES(oscpack Ws2_32)
ENDIF(WIN32)

# winmm)

# ADD_EXECUTABLE(SimpleReceive examples/SimpleReceive.cpp)
# TARGET_LINK_LIBRARIES(SimpleReceive OSC Ws2_32 winmm)

# ADD_EXECUTABLE(SimpleSend examples/SimpleSend.cpp)
# TARGET_LINK_LIBRARIES(SimpleSend OSC Ws2_32 winmm)
#ELSE(WIN32)
# ADD_EXECUTABLE(OscDump examples/OscDump.cpp)
# TARGET_LINK_LIBRARIES(OscDump OSC)

# ADD_EXECUTABLE(SimpleReceive examples/SimpleReceive.cpp)
# TARGET_LINK_LIBRARIES(SimpleReceive OSC)

# ADD_EXECUTABLE(SimpleSend examples/SimpleSend.cpp)
# TARGET_LINK_LIBRARIES(SimpleSend OSC)
#ENDIF(WIN32)
