misc/libopenalbridge/CMakeLists.txt
author koda
Wed, 06 Mar 2013 12:18:42 +0100
changeset 8667 f93cc19d8b98
parent 8146 1fba650c2aa4
child 8330 aaefa587e277
permissions -rw-r--r--
comas and capitals
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)
3529
0e968ba12a84 memory management for openalbridge
koda
parents: 3514
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
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    20
	link_libraries(${VORBISFILE_LIBRARY})
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    21
	link_libraries(${VORBIS_LIBRARY})
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    22
	link_libraries(${OGG_LIBRARY})
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    23
	link_libraries(${OPENAL_LIBRARY})
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    24
#build a shared library
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    25
	set (build_type SHARED)
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)
8146
1fba650c2aa4 GCI2012: Lowercase CMake functions (main files only)
m4tx
parents: 3529
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
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents:
diff changeset
    36
	install(TARGETS openalbridge DESTINATION bin)
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
0e968ba12a84 memory management for openalbridge
koda
parents: 3514
diff changeset
    40
add_executable(openalbridge_test "${hedgewars_SOURCE_DIR}/misc/libopenalbridge/tester.c")
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