1 find_package(OpenAL REQUIRED) |
1 find_package(OpenAL REQUIRED) |
2 find_package(OggVorbis REQUIRED) |
2 find_package(OggVorbis REQUIRED) |
3 include_directories(${OPENAL_INCLUDE_DIR}) |
3 include_directories(${OPENAL_INCLUDE_DIR}) |
4 include_directories(${OGGVORBIS_INCLUDE_DIRS}) |
4 include_directories(${OGGVORBIS_INCLUDE_DIRS}) |
5 |
5 |
|
6 #set flag configuration for build type |
|
7 set(CMAKE_C_FLAGS "-Wall -pipe") |
|
8 set(CMAKE_C_FLAGS_RELEASE "-w -O2 -fomit-frame-pointer") |
|
9 set(CMAKE_C_FLAGS_DEBUG "-O0 -g -DDEBUG") |
6 |
10 |
|
11 #set destination directory for library |
7 set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH}) |
12 set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH}) |
|
13 |
|
14 #list of source files for libraries |
8 set(openal_src |
15 set(openal_src |
9 openalwrap.c loaders.c endianness.c wrappers.c |
16 openalwrap.c loaders.c endianness.c wrappers.c |
10 ) |
17 ) |
11 |
18 |
12 #build a static library for human systems |
19 #build a static library for human systems |
13 set (build_type STATIC) |
20 set (build_type STATIC) |
14 |
21 |
15 |
|
16 if(WIN32) |
22 if(WIN32) |
17 #workaround for visualstudio |
23 #workaround for visualstudio (wants headers in the source list) |
18 set(openal_src |
24 set(openal_src |
19 openalwrap.h loaders.h endianness.h wrappers.h winstdint.h ${openal_src} |
25 openalwrap.h loaders.h endianness.h wrappers.h winstdint.h ${openal_src} |
20 ) |
26 ) |
21 #deps for the shared library |
27 #deps for the shared library |
22 link_libraries(${OPENAL_LIBRARY}) |
28 link_libraries(${OPENAL_LIBRARY}) |
25 link_libraries(${VORBISFILE_LIBRARY}) |
31 link_libraries(${VORBISFILE_LIBRARY}) |
26 #build a shared library |
32 #build a shared library |
27 set (build_type SHARED) |
33 set (build_type SHARED) |
28 endif(WIN32) |
34 endif(WIN32) |
29 |
35 |
|
36 #compiles and links actual library |
30 add_library (openalbridge ${build_type} ${openal_src}) |
37 add_library (openalbridge ${build_type} ${openal_src}) |
31 |
38 |
32 if(WIN32) |
39 if(WIN32) |
33 SET_TARGET_PROPERTIES(openalbridge PROPERTIES LINK_FLAGS /DEF:openalbridge.def) |
40 SET_TARGET_PROPERTIES(openalbridge PROPERTIES LINK_FLAGS /DEF:openalbridge.def) |
34 #install it in the executable directory |
41 #install it in the executable directory |