$NetBSD: patch-CMakeLists.txt,v 1.3 2020/06/28 15:04:36 nia Exp $ Allow better control over what libraries are detected. Install data unconditionally. -std=c++1y can't be used with alloca() - use -std=gnu++14 instead --- CMakeLists.txt.orig 2016-06-24 08:09:07.000000000 +0000 +++ CMakeLists.txt @@ -15,6 +15,12 @@ option(ENABLE_PCH "Use PCH to speed up c option(ENABLE_LTO "Enables Link Time Optimization" OFF) option(ENABLE_GENERIC "Enables generic build that should run on any little-endian host" OFF) option(ENABLE_HEADLESS "Enables running Dolphin as a headless variant" OFF) +option(ENABLE_AO "Enable libao support" OFF) +option(ENABLE_ALSA "Enable ALSA support" OFF) +option(ENABLE_OPENAL "Enable OpenAL support" OFF) +option(ENABLE_PULSEAUDIO "Enable PulseAudio support" OFF) +option(ENABLE_PORTAUDIO "Enable PortAudio support" OFF) +option(ENABLE_LLVM "Enable LLVM support (for disassembly)" OFF) # Maintainers: if you consider blanket disabling this for your users, please # consider the following points: @@ -27,7 +33,7 @@ option(ENABLE_ANALYTICS "Enables opt-in # Name of the Dolphin distributor. If you redistribute Dolphin builds (forks, # unofficial builds) please consider identifying your distribution with a # unique name here. -set(DISTRIBUTOR "None" CACHE STRING "Name of the distributor.") +set(DISTRIBUTOR "pkgsrc" CACHE STRING "Name of the distributor.") # Enable SDL for default on operating systems that aren't OSX, Android, Linux or Windows. if(NOT APPLE AND NOT ANDROID AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT MSVC) @@ -82,16 +88,10 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PAT set(LIBS) # Set up paths -if(APPLE) - # The gettext module will install the translations unconditionally. - # Redirect the installation to a build directory where it does no harm. - set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install-dummy) -else() set(bindir ${CMAKE_INSTALL_PREFIX}/bin CACHE PATH "bindir") set(datadir ${CMAKE_INSTALL_PREFIX}/share/dolphin-emu CACHE PATH "datadir") set(mandir ${CMAKE_INSTALL_PREFIX}/share/man CACHE PATH "mandir") add_definitions(-DDATA_DIR="${datadir}/") -endif() # Set where the binary files will be built. The program will not execute from # here. You must run "make install" to install these to the proper location @@ -444,6 +444,7 @@ if (OPENGL_GL) include_directories(${OPENGL_INCLUDE_DIR}) endif() +if(ENABLE_ALSA) include(FindALSA OPTIONAL) if(ALSA_FOUND) add_definitions(-DHAVE_ALSA=1) @@ -452,7 +453,9 @@ else() add_definitions(-DHAVE_ALSA=0) message("ALSA NOT found, disabling ALSA sound backend") endif(ALSA_FOUND) +endif(ENABLE_ALSA) +if(ENABLE_AO) check_lib(AO ao ao QUIET) if(AO_FOUND) add_definitions(-DHAVE_AO=1) @@ -461,6 +464,7 @@ else() add_definitions(-DHAVE_AO=0) message("ao NOT found, disabling ao sound backend") endif(AO_FOUND) +endif(ENABLE_AO) check_lib(BLUEZ bluez bluez QUIET) if(BLUEZ_FOUND) @@ -471,6 +475,7 @@ else() message("bluez NOT found, disabling bluetooth support") endif(BLUEZ_FOUND) +if(ENABLE_PULSEAUDIO) check_lib(PULSEAUDIO libpulse pulse QUIET) if(PULSEAUDIO_FOUND) add_definitions(-DHAVE_PULSEAUDIO=1) @@ -479,7 +484,9 @@ else() add_definitions(-DHAVE_PULSEAUDIO=0) message("PulseAudio NOT found, disabling PulseAudio sound backend") endif(PULSEAUDIO_FOUND) +endif(ENABLE_PULSEAUDIO) +if(ENABLE_OPENAL) include(FindOpenAL OPTIONAL) if(OPENAL_FOUND) add_definitions(-DHAVE_OPENAL=1) @@ -489,7 +496,9 @@ else() add_definitions(-DHAVE_OPENAL=0) message("OpenAL NOT found, disabling OpenAL sound backend") endif(OPENAL_FOUND) +endif(ENABLE_OPENAL) +if(ENABLE_LLVM) include(FindLLVM OPTIONAL) if (LLVM_FOUND) add_definitions(-DHAS_LLVM=1) @@ -500,6 +509,7 @@ if (LLVM_FOUND) message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") endif() +endif(ENABLE_LLVM) set(USE_X11 0) @@ -547,6 +557,7 @@ if(ENCODE_FRAMEDUMPS) endif() +if(ENABLE_PORTAUDIO) set(CMAKE_REQUIRED_LIBRARIES portaudio) CHECK_CXX_SOURCE_RUNS( "#include @@ -563,6 +574,7 @@ else() add_definitions(-DHAVE_PORTAUDIO=0) set(PORTAUDIO_FOUND FALSE) endif(PORTAUDIO) +endif(ENABLE_PORTAUDIO) if(OPROFILING) include(FindOProfile) @@ -854,27 +866,8 @@ if(NOT DISABLE_WX) endif(wxWidgets_FOUND) if(UNIX AND NOT APPLE) - # There is a bug in the FindGTK module in cmake version 2.8.2 that - # does not find gdk-pixbuf-2.0. On the other hand some 2.8.3 - # users have complained that pkg-config does not find - # gdk-pixbuf-2.0. On yet another hand, cmake version 2.8.3 in - # Ubuntu Natty does not find the glib libraries correctly. - # Ugly!!! - execute_process(COMMAND lsb_release -c -s - OUTPUT_VARIABLE DIST_NAME - 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+-2.0 gtk.h REQUIRED) - else() - include(FindGTK2) - if(GTK2_FOUND) - include_directories(${GTK2_INCLUDE_DIRS}) - list(APPEND LIBS ${GTK2_LIBRARIES}) - else() - message(FATAL_ERROR "GTK is required to build the WX UI. Please install the GTK development libraries.") - endif() - endif() + check_lib(GTK2 gtk+-2.0 gtk+-2.0 gtk.h OPTIONAL) + check_lib(GTK3 gtk+-3.0 gtk+-3.0 gtk.h OPTIONAL) endif() if(wxWidgets_FOUND) @@ -965,7 +958,7 @@ add_custom_command(TARGET unittests POST ######################################## # Start compiling our code # -add_definitions(-std=c++1y) +add_definitions(-std=gnu++14 -fexceptions) # These aren't actually needed for C11/C++11 # but some dependencies require them (LLVM, libav). @@ -986,13 +979,8 @@ add_subdirectory(Source) ######################################## # Install shared data files # -if(NOT APPLE) install(DIRECTORY Data/Sys/ DESTINATION ${datadir}/sys PATTERN) -endif() -if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|Darwin") install(FILES Data/license.txt DESTINATION ${datadir}) -endif() -if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") # Install the application icon and menu item install(FILES Data/dolphin-emu.svg DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps) @@ -1002,10 +990,9 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications) # Install manpages install(FILES Data/dolphin-emu.6 - DESTINATION ${mandir}/man6) + DESTINATION ${CMAKE_INSTALL_PREFIX}/${PKGMANDIR}/man6) install(FILES Data/dolphin-emu-nogui.6 - DESTINATION ${mandir}/man6) -endif() + DESTINATION ${CMAKE_INSTALL_PREFIX}/${PKGMANDIR}/man6) # packaging information set(CPACK_PACKAGE_NAME "dolphin-emu")