Recompile and test of the master branch.
[Faustine.git] / interpretor / faust-0.9.47mr3 / architecture / osclib / oscpack / cmake / CMakeLists.txt
1 # CMAKE oscpack
2 project(oscpack)
3 cmake_minimum_required(VERSION 2.6)
4
5 if(WIN32)
6 add_definitions(-DWINVER=0x0500)
7 add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
8 else(WIN32)
9 add_definitions(-Wall -fPIC)
10 endif(WIN32)
11
12 if (${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL powerpc OR
13 ${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL ppc)
14 message(STATUS "OSC host is big endian")
15 add_definitions(-DOSC_HOST_BIG_ENDIAN=1)
16
17 elseif (${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL i386 OR
18 ${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL x86 OR
19 ${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL x86_64 OR
20 ${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL i686)
21 message(STATUS "OSC host is little endian")
22 add_definitions(-DOSC_HOST_LITTLE_ENDIAN=1)
23
24 else(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL powerpc)
25 message(SEND_ERROR "${CMAKE_HOST_SYSTEM_PROCESSOR} unknown endianess")
26
27 endif (${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL powerpc OR
28 ${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL ppc)
29
30 if(APPLE AND (${CMAKE_GENERATOR} STREQUAL Xcode) )
31 set (CMAKE_OSX_ARCHITECTURES "x86_64 i386")
32 set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk)
33 set(CMAKE_C++_FLAGS -mmacosx-version-min=10.4)
34 endif(APPLE AND (${CMAKE_GENERATOR} STREQUAL Xcode) )
35
36
37 # SET MAIN DIRECTORY.
38 set(OSCPACK ${CMAKE_CURRENT_SOURCE_DIR}/..)
39
40 set(IP_PATH ${OSCPACK}/ip)
41 set(IP_WIN32_PATH ${OSCPACK}/ip/win32)
42 set(IP_POSIX_PATH ${OSCPACK}/ip/posix)
43 set(SRC_PATH ${OSCPACK}/osc)
44 set(EX_PATH ${OSCPACK}/examples)
45
46 # SET INCLUDES
47 include_directories( .. )
48
49 # SET SOURCES
50 FILE(GLOB OSC_SRC "${SRC_PATH}/*.cpp")
51 FILE(GLOB IP_SRC "${IP_PATH}/*.cpp")
52
53 if (CMAKE_HOST_WIN32)
54 FILE(GLOB IP_IMPL_SRC "${IP_WIN32_PATH}/*.cpp")
55 else (CMAKE_HOST_WIN32)
56 FILE(GLOB IP_IMPL_SRC "${IP_POSIX_PATH}/*.cpp")
57 endif (CMAKE_HOST_WIN32)
58
59 ADD_LIBRARY( oscpack STATIC ${OSC_SRC} ${IP_SRC} ${IP_IMPL_SRC} )
60 if (CMAKE_HOST_WIN32)
61 TARGET_LINK_LIBRARIES( oscpack ws2_32 winmm)
62 endif (CMAKE_HOST_WIN32)
63 set_target_properties (oscpack PROPERTIES
64 ARCHIVE_OUTPUT_DIRECTORY ${OSCPACK}/..
65 ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${OSCPACK}/..)
66
67 if (${GENTOOLS})
68 message (STATUS "Generating tools. Use -DGENTOOLS=0 to change")
69
70 #######################################
71 # set sample targets
72 set (TOOLS examples/SimpleReceive examples/SimpleSend examples/OscDump
73 tests/OscReceiveTest tests/OscSendTests tests/OscUnitTests )
74
75 foreach(tool ${TOOLS})
76 add_executable( ${tool} ${OSCPACK}/${tool}.cpp )
77 target_link_libraries( ${tool} oscpack)
78 add_dependencies(${tool} oscpack)
79 endforeach(tool)
80 set_target_properties( examples/OscDump PROPERTIES CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk)
81
82 else (${GENTOOLS})
83 message (STATUS "Don't generates tools. Use -DGENTOOLS=1 to change")
84 endif (${GENTOOLS})