openalbridge/CMakeLists.txt
changeset 3353 a767dd3786b5
parent 3352 ac5d14a35482
child 3354 cb5d13ff4aae
equal deleted inserted replaced
3352:ac5d14a35482 3353:a767dd3786b5
     1 find_package(OpenAL REQUIRED)
       
     2 find_package(OggVorbis REQUIRED)
       
     3 include_directories(${OPENAL_INCLUDE_DIR})
       
     4 include_directories(${OGGVORBIS_INCLUDE_DIRS})
       
     5 
       
     6 #set destination directory for library
       
     7 set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
       
     8 
       
     9 #list of source files for libraries
       
    10 set(openal_src
       
    11 	openalbridge.c loaders.c wrappers.c errlib.c
       
    12 )
       
    13 
       
    14 #build a static library for human systems
       
    15 set (build_type STATIC)
       
    16 
       
    17 #visualstudio and windows in general doesn't like static linking, so we're building the library in shared mode
       
    18 if(WIN32)
       
    19 #workaround for visualstudio (wants headers in the source list)
       
    20 	set(openal_src
       
    21 		openalbridge.h loaders.h wrappers.h globals.h oggvorbis.h errlib.h ${openal_src}
       
    22 	)
       
    23 #deps for the shared library
       
    24 	link_libraries(${VORBISFILE_LIBRARY})
       
    25 	link_libraries(${VORBIS_LIBRARY})
       
    26 	link_libraries(${OGG_LIBRARY})
       
    27 	link_libraries(${OPENAL_LIBRARY})
       
    28 #build a shared library
       
    29 	set (build_type SHARED)
       
    30 endif()
       
    31 
       
    32 #compiles and links actual library
       
    33 add_library (openalbridge ${build_type} ${openal_src})
       
    34 
       
    35 if(WIN32)
       
    36 if(MSVC)
       
    37 	SET_TARGET_PROPERTIES(openalbridge PROPERTIES LINK_FLAGS /DEF:openalbridge.def)
       
    38 endif(MSVC)
       
    39 #install it in the executable directory
       
    40 	install(TARGETS openalbridge DESTINATION bin)
       
    41 endif(WIN32)