misc/libopenalbridge/CMakeLists.txt
branchwebgl
changeset 9521 8054d9d775fd
parent 9282 92af50454cf2
parent 9519 b8b5c82eb61b
child 9950 2759212a27de
equal deleted inserted replaced
9282:92af50454cf2 9521:8054d9d775fd
     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 openalbridge.c loaders.c wrappers.c commands.c)
       
    11 
       
    12 #build a static library for human systems
       
    13 set (build_type STATIC)
       
    14 
       
    15 #visualstudio and windows in general don't like static linking, so we're building the library in shared mode
       
    16 if(WIN32)
       
    17 #workaround for visualstudio (wants headers in the source list)
       
    18     set(openal_src *.h ${openal_src})
       
    19 #deps for the shared library
       
    20     link_libraries(${VORBISFILE_LIBRARY})
       
    21     link_libraries(${VORBIS_LIBRARY})
       
    22     link_libraries(${OGG_LIBRARY})
       
    23     link_libraries(${OPENAL_LIBRARY})
       
    24 #build a shared library
       
    25     set (build_type SHARED)
       
    26 endif()
       
    27 
       
    28 #compiles and links actual library
       
    29 add_library (openalbridge ${build_type} ${openal_src})
       
    30 
       
    31 if(WIN32)
       
    32 if(MSVC)
       
    33     set_target_properties(openalbridge PROPERTIES LINK_FLAGS /DEF:openalbridge.def)
       
    34 endif(MSVC)
       
    35 #install it in the executable directory
       
    36     install(TARGETS openalbridge DESTINATION bin)
       
    37 endif(WIN32)
       
    38 
       
    39 #type make openalbridge_test to get a small executable test
       
    40 add_executable(openalbridge_test "${CMAKE_SOURCE_DIR}/misc/libopenalbridge/tester.c")
       
    41 target_link_libraries(openalbridge_test openalbridge ${OPENAL_LIBRARY} ${OGGVORBIS_LIBRARIES})
       
    42