05c4d9d5f74cce5b656c1afb94cd9d375db060fd
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / architecture / osclib / faust / cmake / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.6)
2 project(OSCFaust)
3
4 #######################################
5 # cmake build types configuration
6 set (CMAKE_CONFIGURATION_TYPES Debug Release)
7
8 set (TARGET OSCFaust)
9 #######################################
10 # versions management
11 set (version 0.50)
12
13 #######################################
14 if(WIN32)
15 add_definitions(-DWINVER=0x0400 -DWIN32)
16 if(MSVC)
17 add_definitions(-DMSVC)
18 endif(MSVC)
19 else(WIN32)
20 add_definitions(-Wall)
21 endif(WIN32)
22
23 if(APPLE AND (${CMAKE_GENERATOR} STREQUAL Xcode) )
24 if (${CMAKE_SYSTEM_VERSION} VERSION_LESS 9.0.0)
25 set (CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk)
26 else (${CMAKE_SYSTEM_VERSION} VERSION_LESS 9.0.0)
27 set (CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk)
28 endif (${CMAKE_SYSTEM_VERSION} VERSION_LESS 9.0.0)
29
30 set (CMAKE_OSX_ARCHITECTURES "i386 x86_64")
31 set (CMAKE_C++_FLAGS -mmacosx-version-min=10.4)
32 endif(APPLE AND (${CMAKE_GENERATOR} STREQUAL Xcode) )
33
34 #######################################
35 # set directories, src and headers.
36 set (ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../src)
37 set (LIBDIR ${CMAKE_CURRENT_SOURCE_DIR}/../..)
38 set (SRCFOLDERS lib ../include msg osc nodes)
39 set (OSC_PATH "${ROOT}/../../oscpack")
40
41 set(SRC ${SRC} "${ROOT}/*.cpp") # add source files
42 foreach(folder ${SRCFOLDERS})
43 set(SRC ${SRC} "${ROOT}/${folder}/*.cpp") # add source files
44 endforeach(folder)
45 if (WIN32)
46 set(SRC ${SRC} "${ROOT}/threads/win*.cpp") # add threads src per platform
47 else (WIN32)
48 set(SRC ${SRC} "${ROOT}/threads/pthread*.cpp") # add threads src per platform
49 endif (WIN32)
50
51 file (GLOB SRCFILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${SRC})
52
53 foreach(folder ${SRCFOLDERS})
54 set(HEADERS ${HEADERS} "${ROOT}/${folder}/*.h") # add header files
55 endforeach(folder)
56 set(HEADERS ${HEADERS} "${ROOT}/threads/*.h") # add header files
57 file (GLOB HEADERFILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${HEADERS})
58
59 foreach(folder ${SRCFOLDERS})
60 set(INCL ${INCL} "${ROOT}/${folder}") # add include folders
61 endforeach(folder)
62 set(INCL ${INCL} "${ROOT}/threads") # add other include folders
63
64 #######################################
65 # set libraries
66 if(WIN32)
67 set(OSCPACK ${ROOT}/../../oscpack.lib)
68 else(WIN32)
69 set(OSCPACK ${ROOT}/../../liboscpack.a)
70 endif(WIN32)
71
72 #######################################
73 # set targets
74 include_directories (${INCL} ${OSC_PATH} )
75
76 add_library ( ${TARGET} STATIC ${SRCFILES} ${HEADERFILES} ${OSCPACK} )
77 set_source_files_properties (${HEADERFILES} PROPERTIES HEADER_FILE_ONLY TRUE)
78 set_target_properties (${TARGET} PROPERTIES
79 VERSION ${version}
80 ARCHIVE_OUTPUT_DIRECTORY "${ROOT}/../.."
81 ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${ROOT}/../.."
82 )
83
84 if(WIN32)
85 target_link_libraries ( ${TARGET} ws2_32.lib )
86 endif(WIN32)
87
88 if (WIN32)
89 set (OUTLIB "${TARGET}.lib")
90 else (WIN32)
91 set (OUTLIB "lib${TARGET}.a")
92 endif (WIN32)
93
94