Merge pull request #2506 from comex/enet-build-fixes
ENet fixes (build fixes, upgrade)
This commit is contained in:
+42
-23
@@ -6,6 +6,7 @@ project(dolphin-emu)
|
||||
|
||||
option(USE_EGL "Enables EGL OpenGL Interface" OFF)
|
||||
option(TRY_X11 "Enables X11 Support" ON)
|
||||
option(USE_SHARED_ENET "Use shared libenet if found rather than Dolphin's soon-to-compatibly-diverge version" OFF)
|
||||
option(USE_UPNP "Enables UPnP port mapping support" ON)
|
||||
option(DISABLE_WX "Disable wxWidgets (use Qt or CLI interface)" OFF)
|
||||
option(ENABLE_QT "Enable Qt (use the experimental Qt interface)" OFF)
|
||||
@@ -246,12 +247,6 @@ if(APPLE)
|
||||
set(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};/usr")
|
||||
endif()
|
||||
|
||||
# Some of our code contains Objective C constructs.
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -x objective-c -stdlib=libc++")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -x objective-c++ -stdlib=libc++")
|
||||
# Avoid mistaking an object file for a source file on the link command line.
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -x none")
|
||||
|
||||
# Identify the target system:
|
||||
# Ask for 64-bit binary.
|
||||
set(TARGET_FLAGS "-arch x86_64")
|
||||
@@ -395,7 +390,7 @@ if(NOT ANDROID)
|
||||
message("ALSA NOT found, disabling ALSA sound backend")
|
||||
endif(ALSA_FOUND)
|
||||
|
||||
check_lib(AO ao QUIET)
|
||||
check_lib(AO ao ao QUIET)
|
||||
if(AO_FOUND)
|
||||
add_definitions(-DHAVE_AO=1)
|
||||
message("ao found, enabling ao sound backend")
|
||||
@@ -404,7 +399,7 @@ if(NOT ANDROID)
|
||||
message("ao NOT found, disabling ao sound backend")
|
||||
endif(AO_FOUND)
|
||||
|
||||
check_lib(BLUEZ bluez QUIET)
|
||||
check_lib(BLUEZ bluez bluez QUIET)
|
||||
if(BLUEZ_FOUND)
|
||||
add_definitions(-DHAVE_BLUEZ=1)
|
||||
message("bluez found, enabling bluetooth support")
|
||||
@@ -413,7 +408,7 @@ if(NOT ANDROID)
|
||||
message("bluez NOT found, disabling bluetooth support")
|
||||
endif(BLUEZ_FOUND)
|
||||
|
||||
check_lib(PULSEAUDIO libpulse QUIET)
|
||||
check_lib(PULSEAUDIO libpulse pulse QUIET)
|
||||
if(PULSEAUDIO_FOUND)
|
||||
add_definitions(-DHAVE_PULSEAUDIO=1)
|
||||
message("PulseAudio found, enabling PulseAudio sound backend")
|
||||
@@ -467,7 +462,7 @@ if(NOT ANDROID)
|
||||
endif()
|
||||
|
||||
if(USE_X11)
|
||||
check_lib(XRANDR Xrandr)
|
||||
check_lib(XRANDR xrandr Xrandr)
|
||||
if(XRANDR_FOUND)
|
||||
add_definitions(-DHAVE_XRANDR=1)
|
||||
else()
|
||||
@@ -507,8 +502,8 @@ if(NOT ANDROID)
|
||||
endif(PORTAUDIO)
|
||||
|
||||
if(OPROFILING)
|
||||
check_lib(OPROFILE opagent opagent.h)
|
||||
check_lib(BFD bfd bfd.h)
|
||||
check_lib(OPROFILE "(no .pc for opagent)" opagent opagent.h)
|
||||
check_lib(BFD "(no .pc for bfd)" bfd bfd.h)
|
||||
if(OPROFILE_FOUND AND BFD_FOUND)
|
||||
message("oprofile found, enabling profiling support")
|
||||
add_definitions(-DUSE_OPROFILE=1)
|
||||
@@ -541,11 +536,27 @@ include_directories(Source/Core)
|
||||
add_subdirectory(Externals/Bochs_disasm)
|
||||
include_directories(Externals/Bochs_disasm)
|
||||
|
||||
if(NOT APPLE AND NOT ANDROID)
|
||||
check_lib(ENET enet enet/enet.h QUIET)
|
||||
if(NOT ANDROID AND USE_SHARED_ENET)
|
||||
check_lib(ENET libenet enet enet/enet.h QUIET)
|
||||
include(CheckSymbolExists)
|
||||
if (ENET_FOUND)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${ENET_INCLUDE_DIRS})
|
||||
# hack: LDFLAGS already contains -lenet but all flags but the first are
|
||||
# dropped; ugh, cmake
|
||||
set(CMAKE_REQUIRED_FLAGS ${ENET_LDFLAGS})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${ENET_LIBRARIES})
|
||||
CHECK_SYMBOL_EXISTS(enet_socket_get_address enet/enet.h ENET_HAVE_SGA)
|
||||
set(CMAKE_REQUIRED_INCLUDES)
|
||||
set(CMAKE_REQUIRED_FLAGS)
|
||||
set(CMAKE_REQUIRED_LIBRARIES)
|
||||
if (NOT ENET_HAVE_SGA)
|
||||
# enet is too old
|
||||
set(ENET_FOUND FALSE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if (ENET_FOUND)
|
||||
message("Using shared enet")
|
||||
message("Using shared enet")
|
||||
else()
|
||||
message("Using static enet from Externals")
|
||||
include_directories(Externals/enet/include)
|
||||
@@ -576,7 +587,7 @@ else(ZLIB_FOUND)
|
||||
endif(ZLIB_FOUND)
|
||||
|
||||
if(NOT APPLE AND NOT ANDROID)
|
||||
check_lib(LZO lzo2 lzo/lzo1x.h QUIET)
|
||||
check_lib(LZO "(no .pc for lzo2)" lzo2 lzo/lzo1x.h QUIET)
|
||||
endif()
|
||||
if(LZO_FOUND)
|
||||
message("Using shared lzo")
|
||||
@@ -589,7 +600,7 @@ endif()
|
||||
list(APPEND LIBS ${LZO})
|
||||
|
||||
if(NOT APPLE AND NOT ANDROID)
|
||||
check_lib(PNG png png.h QUIET)
|
||||
check_lib(PNG libpng png png.h QUIET)
|
||||
endif()
|
||||
if (PNG_FOUND)
|
||||
message("Using shared libpng")
|
||||
@@ -602,7 +613,7 @@ endif()
|
||||
|
||||
if(OPENAL_FOUND)
|
||||
if(NOT APPLE)
|
||||
check_lib(SOUNDTOUCH SoundTouch soundtouch/SoundTouch.h QUIET)
|
||||
check_lib(SOUNDTOUCH soundtouch SoundTouch soundtouch/SoundTouch.h QUIET)
|
||||
endif()
|
||||
if (SOUNDTOUCH_FOUND)
|
||||
message("Using shared soundtouch")
|
||||
@@ -687,7 +698,7 @@ else()
|
||||
endif()
|
||||
|
||||
if(NOT APPLE AND NOT ANDROID)
|
||||
check_lib(SOIL SOIL SOIL/SOIL.h QUIET)
|
||||
check_lib(SOIL "(no .pc for SOIL)" SOIL SOIL/SOIL.h QUIET)
|
||||
endif()
|
||||
if(SOIL_FOUND)
|
||||
message("Using shared SOIL")
|
||||
@@ -746,7 +757,7 @@ if(NOT DISABLE_WX AND NOT ANDROID)
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}
|
||||
VERSION_EQUAL 2.8.2 OR "${DIST_NAME}" STREQUAL "natty")
|
||||
check_lib(GTK2 gtk+-2.0 gtk.h REQUIRED)
|
||||
check_lib(GTK2 gtk+-2.0 gtk+-2.0 gtk.h REQUIRED)
|
||||
else()
|
||||
include(FindGTK2)
|
||||
if(GTK2_FOUND)
|
||||
@@ -772,8 +783,8 @@ if(NOT DISABLE_WX AND NOT ANDROID)
|
||||
add_definitions(-D__WXGTK__)
|
||||
|
||||
# Check for required libs
|
||||
check_lib(GTHREAD2 gthread-2.0 glib/gthread.h REQUIRED)
|
||||
check_lib(PANGOCAIRO pangocairo pango/pangocairo.h REQUIRED)
|
||||
check_lib(GTHREAD2 gthread-2.0 gthread-2.0 glib/gthread.h REQUIRED)
|
||||
check_lib(PANGOCAIRO pangocairo pangocairo pango/pangocairo.h REQUIRED)
|
||||
elseif(WIN32)
|
||||
add_definitions(-D__WXMSW__)
|
||||
else()
|
||||
@@ -844,6 +855,15 @@ add_definitions(-std=gnu++0x)
|
||||
# but some dependencies require them (LLVM, libav).
|
||||
add_definitions(-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS)
|
||||
|
||||
# Do this at the last minute because try_compile ignores linker flags. Yay...
|
||||
if(APPLE)
|
||||
# Some of our code contains Objective C constructs.
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -x objective-c -stdlib=libc++")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -x objective-c++ -stdlib=libc++")
|
||||
# Avoid mistaking an object file for a source file on the link command line.
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -x none")
|
||||
endif()
|
||||
|
||||
add_subdirectory(Source)
|
||||
|
||||
|
||||
@@ -889,4 +909,3 @@ list(APPEND CPACK_SOURCE_IGNORE_FILES "${CMAKE_BINARY_DIR}")
|
||||
# CPack must be included after the CPACK_* variables are set in order for those
|
||||
# variables to take effect.
|
||||
Include(CPack)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user