1 cmake_minimum_required(VERSION 2.6)
4 #######################################
5 # cmake build types configuration
6 set (CMAKE_CONFIGURATION_TYPES Debug Release)
9 #######################################
13 #######################################
15 add_definitions(-DWINVER=0x0400 -DWIN32)
17 add_definitions(-DMSVC)
20 add_definitions(-Wall)
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)
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) )
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")
41 set(SRC ${SRC} "${ROOT}/*.cpp") # add source files
42 foreach(folder ${SRCFOLDERS})
43 set(SRC ${SRC} "${ROOT}/${folder}/*.cpp") # add source files
46 set(SRC ${SRC} "${ROOT}/threads/win*.cpp") # add threads src per platform
48 set(SRC ${SRC} "${ROOT}/threads/pthread*.cpp") # add threads src per platform
51 file (GLOB SRCFILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${SRC})
53 foreach(folder ${SRCFOLDERS})
54 set(HEADERS ${HEADERS} "${ROOT}/${folder}/*.h") # add header files
56 set(HEADERS ${HEADERS} "${ROOT}/threads/*.h") # add header files
57 file (GLOB HEADERFILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${HEADERS})
59 foreach(folder ${SRCFOLDERS})
60 set(INCL ${INCL} "${ROOT}/${folder}") # add include folders
62 set(INCL ${INCL} "${ROOT}/threads") # add other include folders
64 #######################################
67 set(OSCPACK ${ROOT}/../../oscpack.lib)
69 set(OSCPACK ${ROOT}/../../liboscpack.a)
72 #######################################
74 include_directories (${INCL} ${OSC_PATH} )
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
80 ARCHIVE_OUTPUT_DIRECTORY "${ROOT}/../.."
81 ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${ROOT}/../.."
85 target_link_libraries ( ${TARGET} ws2_32.lib )
89 set (OUTLIB "${TARGET}.lib")
91 set (OUTLIB "lib${TARGET}.a")