mirror of https://github.com/axmolengine/axmol.git
Add FindFMODEX.cmake and use it on linux to find FMOD Ex library
This commit is contained in:
parent
f8f37b7bf5
commit
e3a0e089ba
|
@ -141,19 +141,17 @@ include_directories(
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/external
|
||||
)
|
||||
|
||||
# Specific Link Directories
|
||||
if(LINUX)
|
||||
set(PLATFORM_LINK_DIR
|
||||
/usr/local/lib
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/fmod/prebuilt/${ARCH_DIR}
|
||||
)
|
||||
set(PLATFORM_FOLDER_ARCH
|
||||
${PLATFORM_FOLDER}/${ARCH_DIR}
|
||||
)
|
||||
set(PLATFORM_FOLDER_ARCH ${PLATFORM_FOLDER}/${ARCH_DIR})
|
||||
elseif(NOT MINGW)
|
||||
set(PLATFORM_FOLDER_ARCH ${PLATFORM_FOLDER})
|
||||
endif()
|
||||
|
||||
if(LINUX)
|
||||
find_package(FMODEX REQUIRED)
|
||||
message(STATUS "FMOD Ex include dirs: ${FMODEX_INCLUDE_DIRS}")
|
||||
endif()
|
||||
|
||||
# GLFW3 used on Mac, Windows and Linux desktop platforms
|
||||
if(LINUX OR MACOSX OR WINDOWS)
|
||||
find_package(GLFW3 REQUIRED)
|
||||
|
@ -249,12 +247,6 @@ message(STATUS "Protobuf lite libs: ${PROTOBUF_LITE_LIBRARIES}")
|
|||
message(STATUS "Protobuf include dirs: ${PROTOBUF_INCLUDE_DIRS}")
|
||||
|
||||
|
||||
if(NOT MINGW)
|
||||
|
||||
link_directories(${PLATFORM_LINK_DIR})
|
||||
|
||||
endif()
|
||||
|
||||
# build for 3rd party libraries
|
||||
if(LINUX OR APPLE)
|
||||
add_subdirectory(external/unzip)
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
#.rst:
|
||||
# FindFMODEX
|
||||
# ------------
|
||||
#
|
||||
# Locate FMOD Ex library
|
||||
#
|
||||
# This module defines
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# FMODEX_LIBRARIES, the library to link against
|
||||
# FMODEX_FOUND, if false, do not try to link to fmodex
|
||||
# FMODEX_INCLUDE_DIRS, where to find headers.
|
||||
#
|
||||
|
||||
# Try find fmodex for our arch in external folder
|
||||
set(_FMOD_COCOS_PATHS
|
||||
${COCOS_EXTERNAL_DIR}/${PLATFORM_FOLDER}-specific/fmod
|
||||
${COCOS_EXTERNAL_DIR}/fmod
|
||||
)
|
||||
if(USE_PREBUILT_LIBS)
|
||||
find_path(FMODEX_INCLUDE_DIR fmod.h
|
||||
PATH_SUFFIXES include/${ARCH_DIR} include
|
||||
PATHS ${_FMOD_COCOS_PATHS} NO_DEFAULT_PATH
|
||||
)
|
||||
find_library(FMODEX_LIBRARY NAMES fmodex fmodex64
|
||||
PATH_SUFFIXES prebuilt/${ARCH_DIR} prebuilt
|
||||
PATHS ${_FMOD_COCOS_PATHS} NO_DEFAULT_PATH
|
||||
)
|
||||
# cleanup if not found (prevent from mix prebuilt include paths and system installed libraries)
|
||||
if(NOT FMODEX_INCLUDE_DIR OR NOT FMODEX_LIBRARY)
|
||||
unset(FMODEX_INCLUDE_DIR CACHE)
|
||||
unset(FMODEX_LIBRARY CACHE)
|
||||
endif()
|
||||
endif(USE_PREBUILT_LIBS)
|
||||
|
||||
find_path(FMODEX_INCLUDE_DIR fmod.h
|
||||
HINTS ENV FMODEX_DIR
|
||||
PATH_SUFFIXES include
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt
|
||||
)
|
||||
|
||||
find_library(FMODEX_LIBRARY NAMES fmodex fmodex64
|
||||
HINTS ENV FMODEX_DIR
|
||||
PATH_SUFFIXES lib
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt
|
||||
)
|
||||
|
||||
set(FMODEX_INCLUDE_DIRS "${FMODEX_INCLUDE_DIR}")
|
||||
set(FMODEX_LIBRARIES "${FMODEX_LIBRARY}")
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
||||
find_package_handle_standard_args(FMODEX DEFAULT_MSG FMODEX_LIBRARIES FMODEX_INCLUDE_DIRS)
|
||||
|
||||
mark_as_advanced(FMODEX_INCLUDE_DIR FMODEX_LIBRARY FMODEX_INCLUDE_DIRS FMODEX_LIBRARIES)
|
||||
|
|
@ -99,18 +99,13 @@ endif()
|
|||
|
||||
add_library(cocos2d ${BUILD_TYPE} ${COCOS_SRC})
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(FMOD_LIB "fmodex64")
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(FMOD_LIB "fmodex")
|
||||
endif()
|
||||
|
||||
if(MINGW)
|
||||
set(PLATFORM_SPECIFIC_LIBS glew32 opengl32 iconv bz2)
|
||||
elseif(WINDOWS)
|
||||
set(PLATFORM_SPECIFIC_LIBS glew32 opengl32 libiconv)
|
||||
elseif(LINUX)
|
||||
set(PLATFORM_SPECIFIC_LIBS ssl crypto fontconfig pthread GLEW GL X11 rt ${FMOD_LIB})
|
||||
include_directories(${FMODEX_INCLUDE_DIRS})
|
||||
set(PLATFORM_SPECIFIC_LIBS ssl crypto fontconfig pthread GLEW GL X11 rt ${FMODEX_LIBRARIES})
|
||||
elseif(MACOSX OR APPLE)
|
||||
INCLUDE_DIRECTORIES ( /System/Library/Frameworks )
|
||||
|
||||
|
|
Loading…
Reference in New Issue