misc/libopenalbridge/CMakeLists.txt
author unc0rr
Wed, 19 Jun 2013 00:52:39 +0400
branchwebgl
changeset 9267 dbd18257be8f
parent 8330 aaefa587e277
permissions -rw-r--r--
merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3353
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
     1
find_package(OpenAL REQUIRED)
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
     2
find_package(OggVorbis REQUIRED)
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
     3
include_directories(${OPENAL_INCLUDE_DIR})
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
     4
include_directories(${OGGVORBIS_INCLUDE_DIRS})
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
     5
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
     6
#set destination directory for library
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
     7
set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
     8
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
     9
#list of source files for libraries
3529
0e968ba12a84 memory management for openalbridge
koda
parents: 3514
diff changeset
    10
set(openal_src openalbridge.c loaders.c wrappers.c commands.c)
3353
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    11
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    12
#build a static library for human systems
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    13
set (build_type STATIC)
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    14
3362
8d3b4d19ce27 in reprocessing openalbridge, a lot of code cleanup and simplification
koda
parents: 3353
diff changeset
    15
#visualstudio and windows in general don't like static linking, so we're building the library in shared mode
3353
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    16
if(WIN32)
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    17
#workaround for visualstudio (wants headers in the source list)
8330
aaefa587e277 update branch with default
koda
parents: 8044 8146
diff changeset
    18
    set(openal_src *.h ${openal_src})
3353
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    19
#deps for the shared library
8330
aaefa587e277 update branch with default
koda
parents: 8044 8146
diff changeset
    20
    link_libraries(${VORBISFILE_LIBRARY})
aaefa587e277 update branch with default
koda
parents: 8044 8146
diff changeset
    21
    link_libraries(${VORBIS_LIBRARY})
aaefa587e277 update branch with default
koda
parents: 8044 8146
diff changeset
    22
    link_libraries(${OGG_LIBRARY})
aaefa587e277 update branch with default
koda
parents: 8044 8146
diff changeset
    23
    link_libraries(${OPENAL_LIBRARY})
3353
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    24
#build a shared library
8330
aaefa587e277 update branch with default
koda
parents: 8044 8146
diff changeset
    25
    set (build_type SHARED)
3353
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    26
endif()
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    27
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    28
#compiles and links actual library
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    29
add_library (openalbridge ${build_type} ${openal_src})
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    30
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    31
if(WIN32)
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    32
if(MSVC)
8330
aaefa587e277 update branch with default
koda
parents: 8044 8146
diff changeset
    33
    set_target_properties(openalbridge PROPERTIES LINK_FLAGS /DEF:openalbridge.def)
3353
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    34
endif(MSVC)
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    35
#install it in the executable directory
8330
aaefa587e277 update branch with default
koda
parents: 8044 8146
diff changeset
    36
    install(TARGETS openalbridge DESTINATION bin)
3353
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    37
endif(WIN32)
3529
0e968ba12a84 memory management for openalbridge
koda
parents: 3514
diff changeset
    38
0e968ba12a84 memory management for openalbridge
koda
parents: 3514
diff changeset
    39
#type make openalbridge_test to get a small executable test
8044
796f2653f21d some CMake cleanup
koda
parents: 3529
diff changeset
    40
add_executable(openalbridge_test "${CMAKE_SOURCE_DIR}/misc/libopenalbridge/tester.c")
3529
0e968ba12a84 memory management for openalbridge
koda
parents: 3514
diff changeset
    41
target_link_libraries(openalbridge_test openalbridge ${OPENAL_LIBRARY} ${OGGVORBIS_LIBRARIES})
0e968ba12a84 memory management for openalbridge
koda
parents: 3514
diff changeset
    42