misc/libopenalbridge/CMakeLists.txt
author sheepluva
Thu, 18 Aug 2011 00:14:43 +0200
changeset 5594 3ab68a93434b
parent 3529 0e968ba12a84
child 8044 796f2653f21d
child 8146 1fba650c2aa4
permissions -rw-r--r--
portal: combating the space-detection issue. what needs to be tweaked next is how far away objects are spawned. it should either be a trial&error adjustment or depend on the object's moving direction and the portal's angle in order to avoid issues with box collisions. if the spawn distance to the portal is just a fixed value (as it was before this patch) or a constant factor (it is now) it can be too big for "nice" portal angles (in tight gaps with still enough space, but -> denied) and too small for bad angles (box collision esp. on big objects like barrels -> denied)

find_package(OpenAL REQUIRED)
find_package(OggVorbis REQUIRED)
include_directories(${OPENAL_INCLUDE_DIR})
include_directories(${OGGVORBIS_INCLUDE_DIRS})

#set destination directory for library
set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})

#list of source files for libraries
set(openal_src openalbridge.c loaders.c wrappers.c commands.c)

#build a static library for human systems
set (build_type STATIC)

#visualstudio and windows in general don't like static linking, so we're building the library in shared mode
if(WIN32)
#workaround for visualstudio (wants headers in the source list)
	set(openal_src *.h ${openal_src})
#deps for the shared library
	link_libraries(${VORBISFILE_LIBRARY})
	link_libraries(${VORBIS_LIBRARY})
	link_libraries(${OGG_LIBRARY})
	link_libraries(${OPENAL_LIBRARY})
#build a shared library
	set (build_type SHARED)
endif()

#compiles and links actual library
add_library (openalbridge ${build_type} ${openal_src})

if(WIN32)
if(MSVC)
	SET_TARGET_PROPERTIES(openalbridge PROPERTIES LINK_FLAGS /DEF:openalbridge.def)
endif(MSVC)
#install it in the executable directory
	install(TARGETS openalbridge DESTINATION bin)
endif(WIN32)

#type make openalbridge_test to get a small executable test
add_executable(openalbridge_test "${hedgewars_SOURCE_DIR}/misc/libopenalbridge/tester.c")
target_link_libraries(openalbridge_test openalbridge ${OPENAL_LIBRARY} ${OGGVORBIS_LIBRARIES})