CMakeLists.txt
changeset 9431 a9c73f29a15e
parent 9414 669bf9fb901e
child 9466 510c9a2f0951
equal deleted inserted replaced
9430:92622f92bb8c 9431:a9c73f29a15e
   116 else()
   116 else()
   117   set(UNIX_OR_MAC_SYS OFF)
   117   set(UNIX_OR_MAC_SYS OFF)
   118 endif()
   118 endif()
   119 
   119 
   120 if (UNIX_OR_MAC_SYS AND NOT EMSCRIPTEN) # JavaScript does not yet have threading support, so disable pthreads when building for Emscripten.
   120 if (UNIX_OR_MAC_SYS AND NOT EMSCRIPTEN) # JavaScript does not yet have threading support, so disable pthreads when building for Emscripten.
   121   set(PTHREADS_ENABLED_BY_DEFAULT ON)
   121   set(SDL_PTHREADS_ENABLED_BY_DEFAULT ON)
   122 else()
   122 else()
   123   set(PTHREADS_ENABLED_BY_DEFAULT OFF)
   123   set(SDL_PTHREADS_ENABLED_BY_DEFAULT OFF)
   124 endif()
   124 endif()
   125 
   125 
   126 # Default option knobs
   126 # Default option knobs
   127 if(APPLE OR ARCH_64)
   127 if(APPLE OR ARCH_64)
   128   set(OPT_DEF_SSEMATH ON)
   128   set(OPT_DEF_SSEMATH ON)
   200 # General includes
   200 # General includes
   201 include_directories(${SDL2_BINARY_DIR}/include ${SDL2_SOURCE_DIR}/include)
   201 include_directories(${SDL2_BINARY_DIR}/include ${SDL2_SOURCE_DIR}/include)
   202 
   202 
   203 # All these ENABLED_BY_DEFAULT vars will default to ON if not specified, so
   203 # All these ENABLED_BY_DEFAULT vars will default to ON if not specified, so
   204 #  you only need to have a platform override them if they are disabling.
   204 #  you only need to have a platform override them if they are disabling.
       
   205 set(OPT_DEF_ASM TRUE)
   205 if(EMSCRIPTEN)
   206 if(EMSCRIPTEN)
   206   # Set up default values for the currently supported set of subsystems:
   207   # Set up default values for the currently supported set of subsystems:
   207   # Emscripten/Javascript does not have assembly support, a dynamic library 
   208   # Emscripten/Javascript does not have assembly support, a dynamic library 
   208   # loading architecture, low-level CPU inspection or multithreading.
   209   # loading architecture, low-level CPU inspection or multithreading.
   209   set(OPT_DEF_ASM FALSE)
   210   set(OPT_DEF_ASM FALSE)
   210   set(SDL_SHARED_ENABLED_BY_DEFAULT OFF)
   211   set(SDL_SHARED_ENABLED_BY_DEFAULT OFF)
   211   set(SDL_ATOMIC_ENABLED_BY_DEFAULT OFF)
   212   set(SDL_ATOMIC_ENABLED_BY_DEFAULT OFF)
   212   set(SDL_THREADS_ENABLED_BY_DEFAULT OFF)
   213   set(SDL_THREADS_ENABLED_BY_DEFAULT OFF)
   213   set(SDL_LOADSO_ENABLED_BY_DEFAULT OFF)
   214   set(SDL_LOADSO_ENABLED_BY_DEFAULT OFF)
   214   set(SDL_CPUINFO_ENABLED_BY_DEFAULT OFF)
   215   set(SDL_CPUINFO_ENABLED_BY_DEFAULT OFF)
   215   set(DLOPEN_ENABLED_BY_DEFAULT OFF)
   216   set(SDL_DLOPEN_ENABLED_BY_DEFAULT OFF)
   216 else()
       
   217   set(OPT_DEF_ASM TRUE)
       
   218   set(SDL_SHARED_ENABLED_BY_DEFAULT ON)
       
   219   set(SDL_ATOMIC_ENABLED_BY_DEFAULT ON)
       
   220   set(SDL_THREADS_ENABLED_BY_DEFAULT ON)
       
   221   set(SDL_LOADSO_ENABLED_BY_DEFAULT ON)
       
   222   set(SDL_CPUINFO_ENABLED_BY_DEFAULT ON)
       
   223   set(DLOPEN_ENABLED_BY_DEFAULT ON)
       
   224 endif()
   217 endif()
   225 
   218 
   226 set(SDL_SUBSYSTEMS
   219 set(SDL_SUBSYSTEMS
   227     Atomic Audio Video Render Events Joystick Haptic Power Threads Timers
   220     Atomic Audio Video Render Events Joystick Haptic Power Threads Timers
   228     File Loadso CPUinfo Filesystem)
   221     File Loadso CPUinfo Filesystem Dlopen)
   229 foreach(_SUB ${SDL_SUBSYSTEMS})
   222 foreach(_SUB ${SDL_SUBSYSTEMS})
   230   string(TOUPPER ${_SUB} _OPT)
   223   string(TOUPPER ${_SUB} _OPT)
   231   if (NOT DEFINED SDL_${_OPT}_ENABLED_BY_DEFAULT)
   224   if (NOT DEFINED SDL_${_OPT}_ENABLED_BY_DEFAULT)
   232     set(SDL_${_OPT}_ENABLED_BY_DEFAULT ON)
   225     set(SDL_${_OPT}_ENABLED_BY_DEFAULT ON)
   233   endif()
   226   endif()
   252 set_option(FUSIONSOUND         "Use FusionSound audio driver" OFF)
   245 set_option(FUSIONSOUND         "Use FusionSound audio driver" OFF)
   253 dep_option(FUSIONSOUND_SHARED  "Dynamically load fusionsound audio support" ON "FUSIONSOUND_SHARED" OFF)
   246 dep_option(FUSIONSOUND_SHARED  "Dynamically load fusionsound audio support" ON "FUSIONSOUND_SHARED" OFF)
   254 set_option(VIDEO_DUMMY         "Use dummy video driver" ON)
   247 set_option(VIDEO_DUMMY         "Use dummy video driver" ON)
   255 set_option(VIDEO_OPENGL        "Include OpenGL support" ON)
   248 set_option(VIDEO_OPENGL        "Include OpenGL support" ON)
   256 set_option(VIDEO_OPENGLES      "Include OpenGL ES support" ON)
   249 set_option(VIDEO_OPENGLES      "Include OpenGL ES support" ON)
   257 set_option(PTHREADS            "Use POSIX threads for multi-threading" ${PTHREADS_ENABLED_BY_DEFAULT})
   250 set_option(PTHREADS            "Use POSIX threads for multi-threading" ${SDL_PTHREADS_ENABLED_BY_DEFAULT})
   258 dep_option(PTHREADS_SEM        "Use pthread semaphores" ON "PTHREADS" OFF)
   251 dep_option(PTHREADS_SEM        "Use pthread semaphores" ON "PTHREADS" OFF)
   259 set_option(SDL_DLOPEN          "Use dlopen for shared object loading" ${DLOPEN_ENABLED_BY_DEFAULT})
   252 set_option(SDL_DLOPEN          "Use dlopen for shared object loading" ${SDL_DLOPEN_ENABLED_BY_DEFAULT})
   260 set_option(OSS                 "Support the OSS audio API" ${UNIX_SYS})
   253 set_option(OSS                 "Support the OSS audio API" ${UNIX_SYS})
   261 set_option(ALSA                "Support the ALSA audio API" ${UNIX_SYS})
   254 set_option(ALSA                "Support the ALSA audio API" ${UNIX_SYS})
   262 dep_option(ALSA_SHARED         "Dynamically load ALSA audio support" ON "ALSA" OFF)
   255 dep_option(ALSA_SHARED         "Dynamically load ALSA audio support" ON "ALSA" OFF)
   263 set_option(ESD                 "Support the Enlightened Sound Daemon" ${UNIX_SYS})
   256 set_option(ESD                 "Support the Enlightened Sound Daemon" ${UNIX_SYS})
   264 dep_option(ESD_SHARED          "Dynamically load ESD audio support" ON "ESD" OFF)
   257 dep_option(ESD_SHARED          "Dynamically load ESD audio support" ON "ESD" OFF)