# this local library crap needs to go away. The Ogg/Vorbis libraries are easy to replace with libsndfile but there doesn't seem to be anything to get a working libvpx that doesn't force linking with MinGW dependencies.
libogg
libvorbis
libvorbisfile
libvpx
libcompat-to-msvc
)
if( NOT ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
set( ZDOOM_LIBS ${ZDOOM_LIBS} DelayImp )
endif()
if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
if( DX_dxguid_LIBRARY )
list( APPEND ZDOOM_LIBS "${DX_dxguid_LIBRARY}" )
endif()
endif()
else()
if( APPLE )
set( NO_GTK ON )
set( DYN_GTK OFF )
# Prevent inclusion of fp.h and FixMath.h from Carbon framework
# Declarations from these files are not used but cause the following conflicts:
# - redefinition of 'FixedToFloat' and 'FloatToFixed' macros
# - redefinition of 'pi' as different kind of symbol
add_definitions( -D__FP__ -D__FIXMATH__ )
else()
option( NO_GTK "Disable GTK+ dialogs (Not applicable to Windows)" )
option( DYN_GTK "Load GTK+ at runtime instead of compile time" ON )
# Use GTK+ for the IWAD picker, if available.
if( NOT NO_GTK )
pkg_check_modules( GTK3 gtk+-3.0 )
if( GTK3_FOUND )
if( NOT DYN_GTK )
set( ZDOOM_LIBS ${ZDOOM_LIBS} ${GTK3_LIBRARIES} )
endif()
include_directories( ${GTK3_INCLUDE_DIRS} )
link_directories( ${GTK3_LIBRARY_DIRS} )
else()
pkg_check_modules( GTK2 gtk+-2.0 )
if( GTK2_FOUND )
if( NOT DYN_GTK )
set( ZDOOM_LIBS ${ZDOOM_LIBS} ${GTK2_LIBRARIES} )
endif()
include_directories( ${GTK2_INCLUDE_DIRS} )
link_directories( ${GTK2_LIBRARY_DIRS} )
else()
set( NO_GTK ON )
endif()
endif()
endif()
endif()
if( NO_GTK )
add_definitions( -DNO_GTK )
elseif( DYN_GTK )
add_definitions( -DDYN_GTK=1 )
else()
add_definitions( -DDYN_GTK=0 )
endif()
# Non-Windows version also needs SDL except native OS X backend
if( NOT APPLE OR NOT OSX_COCOA_BACKEND )
find_package( SDL2 REQUIRED )
include_directories( "${SDL2_INCLUDE_DIR}" )
set( ZDOOM_LIBS ${ZDOOM_LIBS} "${SDL2_LIBRARY}" )
endif()
find_path( FPU_CONTROL_DIR fpu_control.h )
if( FPU_CONTROL_DIR )
include_directories( ${FPU_CONTROL_DIR} )
add_definitions( -DHAVE_FPU_CONTROL )
endif()
endif()
if( NOT NO_OPENAL )
if ( NOT DYN_OPENAL ) # DYN_OPENAL uses local copies of the headers.
find_package( OpenAL )
mark_as_advanced(CLEAR OPENAL_INCLUDE_DIR)
if( OPENAL_INCLUDE_DIR )
include_directories( ${OPENAL_INCLUDE_DIR} )
mark_as_advanced(CLEAR OPENAL_LIBRARY)
if( OPENAL_LIBRARY )
set( ZDOOM_LIBS ${OPENAL_LIBRARY} ${ZDOOM_LIBS} )
else()
set( NO_OPENAL ON )
endif()
else()
set( NO_OPENAL ON )
endif()
else()
add_definitions( -DDYN_OPENAL )
endif()
endif()
if( NO_OPENAL )
add_definitions( -DNO_OPENAL=1 )
set(MPG123_FOUND NO)
set(SNDFILE_FOUND NO)
else()
# Search for libSndFile
if ( NOT DYN_SNDFILE )
find_package( SndFile )
endif()
# Search for libmpg123
if ( NOT DYN_MPG123 )
find_package( MPG123 )
endif()
endif()
# Search for FluidSynth
find_package( FluidSynth )
# Decide on SSE setup
set( SSE_MATTERS NO )
# with global use of SSE 2 we do not need special handling for selected files
if (NOT ZDOOM_USE_SSE2)
# SSE only matters on 32-bit targets. We check compiler flags to know if we can do it.
if( CMAKE_SIZEOF_VOID_P MATCHES "4" AND NOT CMAKE_OSX_ARCHITECTURES MATCHES ppc )
#option( SEND_ANON_STATS "Enable sending of anonymous hardware statistics" ON )
#if( NOT SEND_ANON_STATS )
# add_definitions( -DNO_SEND_STATS )
#endif()
# Disable ADLMIDI's and OPNMIDI's MIDI Sequencer
add_definitions(-DADLMIDI_DISABLE_MIDI_SEQUENCER)
add_definitions(-DOPNMIDI_DISABLE_MIDI_SEQUENCER)
# Disable OPNMIDI's experimental yet emulator (using of it has some issues and missing notes in playback)
add_definitions(-DOPNMIDI_DISABLE_GX_EMULATOR)
# Project files should be aware of the header files. We can GLOB these since
# there's generally a new cpp for every header so this file will get changed
file( GLOB HEADER_FILES
audiolib/include/*.h
audiolib/src/*.h
blood/src/*.h
build/include/*.h
enet/include/enet/*.h
glad/include/glad/*.h
glad/include/Khr/*.h
glbackend/*.h
libsmackerdec/include/*.h
libxmp-lite/include/libxmp-lite/*.h
libxmp-lite/src/*.h
mact/include/*.h
mact/src/*.h
build/src/*.h
duke3d/src/*.h
rr/src/*.h
#sw/src/*.h Shadow Warrior does not work yet.
thirdparty/include/*.h
thirdparty/include/*.hpp
)
# These files will be flagged as "headers" so that they appear in project files
# without being compiled.
set( NOT_COMPILED_SOURCE_FILES
${OTHER_SYSTEM_SOURCES}
build/src/mingw_main.cpp
build/src/sdlkeytrans.cpp
duke3d/src/gamestructures.cpp
rr/src/gamestructures.cpp
#sc_man_scanner.h
#utility/sc_man_scanner.re
)
# Enable fast math for some sources where performance matters (or where the PCH must not be used.) (This would be good for rendering code, but unfortunately that is hopelessly intermingled with the playsim code in engine.cpp.)
set( FASTMATH_SOURCES
# This should better be made a library subproject later, once things are working.
enet/src/callbacks.c
enet/src/compress.c
enet/src/host.c
enet/src/list.c
enet/src/packet.c
enet/src/peer.c
enet/src/protocol.c
enet/src/unix.c # This and the next one are platform safe!
enet/src/win32.c
# This should better be made a library subproject later, once things are working.
libsmackerdec/src/BitReader.cpp
libsmackerdec/src/FileStream.cpp
libsmackerdec/src/HuffmanVLC.cpp
libsmackerdec/src/LogError.cpp
libsmackerdec/src/SmackerDecoder.cpp
# This will go away once GZDoom's music backend has been plugged in.
libxmp-lite/src/common.c
libxmp-lite/src/control.c
libxmp-lite/src/dataio.c
libxmp-lite/src/effects.c
libxmp-lite/src/filter.c
libxmp-lite/src/format.c
libxmp-lite/src/hio.c
libxmp-lite/src/itsex.c
libxmp-lite/src/it_load.c
libxmp-lite/src/lfo.c
libxmp-lite/src/load.c
libxmp-lite/src/load_helpers.c
libxmp-lite/src/memio.c
libxmp-lite/src/mixer.c
libxmp-lite/src/mix_all.c
libxmp-lite/src/mod_load.c
libxmp-lite/src/mtm_load.c
libxmp-lite/src/period.c
libxmp-lite/src/player.c
libxmp-lite/src/read_event.c
libxmp-lite/src/s3m_load.c
libxmp-lite/src/sample.c
libxmp-lite/src/scan.c
libxmp-lite/src/smix.c
libxmp-lite/src/virtual.c
libxmp-lite/src/win32.c
libxmp-lite/src/xm_load.c
# The rest is only here because it is C, not C++
glad/src/glad.c
thirdparty/src/lz4.c
thirdparty/src/xxhash.c
# Will we need this anymore with ZLib being available?
thirdparty/src/miniz.c
thirdparty/src/miniz_tdef.c
thirdparty/src/miniz_tinfl.c
# These will be exported to a resource file later - until that works they need to be explicitly compiled.
polymost1Vert.glsl.cpp
polymost1Frag.glsl.cpp
# Another bit of cruft just to make S(hit)DL happy...
sdlappicon.cpp
)
set (PCH_SOURCES
audiolib/src/drivers.cpp
audiolib/src/driver_nosound.cpp
audiolib/src/flac.cpp
audiolib/src/formats.cpp
audiolib/src/fx_man.cpp
audiolib/src/gmtimbre.cpp
audiolib/src/midi.cpp
audiolib/src/mix.cpp
audiolib/src/mixst.cpp
audiolib/src/mpu401.cpp
audiolib/src/multivoc.cpp
audiolib/src/music.cpp
audiolib/src/pitch.cpp
audiolib/src/vorbis.cpp
audiolib/src/xa.cpp
audiolib/src/xmp.cpp
glbackend/gl_hwtexture.cpp
glbackend/gl_samplers.cpp
glbackend/glbackend.cpp
mact/src/animlib.cpp
mact/src/control.cpp
mact/src/joystick.cpp
mact/src/keyboard.cpp
mact/src/scriplib.cpp
thirdparty/src/sjson.cpp
thirdparty/src/crc32.cpp
thirdparty/src/fix16.cpp
thirdparty/src/fix16_str.cpp
thirdparty/src/md4.cpp
# Todo: Split out the license-safe code from this.
build/src/2d.cpp
build/src/a-c.cpp
build/src/animvpx.cpp
build/src/baselayer.cpp
build/src/cache1d.cpp
build/src/clip.cpp
build/src/colmatch.cpp
build/src/common.cpp
build/src/compat.cpp
build/src/defs.cpp
build/src/engine.cpp
build/src/glbuild.cpp
build/src/glsurface.cpp
build/src/hash.cpp
build/src/hightile.cpp
build/src/klzw.cpp
build/src/kplib.cpp
build/src/mdsprite.cpp
build/src/mhk.cpp
build/src/mmulti_null.cpp
build/src/mutex.cpp
build/src/osd.cpp
build/src/palette.cpp
build/src/pngwrite.cpp
build/src/polymost.cpp
build/src/pragmas.cpp
build/src/rev.cpp
build/src/screenshot.cpp
build/src/scriptfile.cpp
build/src/sdlayer.cpp
build/src/smalltextfont.cpp
build/src/softsurface.cpp
build/src/texcache.cpp
build/src/textfont.cpp
build/src/tiles.cpp
build/src/timer.cpp
build/src/vfs.cpp
build/src/voxmodel.cpp
duke3d/src/actors.cpp
duke3d/src/anim.cpp
duke3d/src/cheats.cpp
duke3d/src/cmdline.cpp
duke3d/src/common.cpp
duke3d/src/config.cpp
duke3d/src/demo.cpp
duke3d/src/game.cpp
duke3d/src/gamedef.cpp
duke3d/src/gameexec.cpp
duke3d/src/gamevars.cpp
duke3d/src/global.cpp
duke3d/src/grpscan.cpp
duke3d/src/input.cpp
duke3d/src/menus.cpp
duke3d/src/namesdyn.cpp
duke3d/src/network.cpp
duke3d/src/osdcmds.cpp
duke3d/src/osdfuncs.cpp
duke3d/src/player.cpp
duke3d/src/premap.cpp
duke3d/src/rts.cpp
duke3d/src/savegame.cpp
duke3d/src/sbar.cpp
duke3d/src/screens.cpp
duke3d/src/screentext.cpp
duke3d/src/sector.cpp
duke3d/src/sounds.cpp
duke3d/src/soundsdyn.cpp
rr/src/actors.cpp
rr/src/anim.cpp
rr/src/cheats.cpp
rr/src/cmdline.cpp
rr/src/common.cpp
rr/src/config.cpp
rr/src/demo.cpp
rr/src/game.cpp
rr/src/gamedef.cpp
rr/src/gameexec.cpp
rr/src/gamevars.cpp
rr/src/global.cpp
rr/src/grpscan.cpp
rr/src/input.cpp
rr/src/menus.cpp
rr/src/namesdyn.cpp
rr/src/net.cpp
rr/src/osdcmds.cpp
rr/src/osdfuncs.cpp
rr/src/player.cpp
rr/src/premap.cpp
rr/src/rts.cpp
rr/src/savegame.cpp
rr/src/sbar.cpp
rr/src/screens.cpp
rr/src/screentext.cpp
rr/src/sector.cpp
rr/src/sounds.cpp
rr/src/soundsdyn.cpp
blood/src/actor.cpp
blood/src/ai.cpp
blood/src/aibat.cpp
blood/src/aibeast.cpp
blood/src/aiboneel.cpp
blood/src/aiburn.cpp
blood/src/aicaleb.cpp
blood/src/aicerber.cpp
blood/src/aicult.cpp
blood/src/aigarg.cpp
blood/src/aighost.cpp
blood/src/aigilbst.cpp
blood/src/aihand.cpp
blood/src/aihound.cpp
blood/src/aiinnoc.cpp
blood/src/aipod.cpp
blood/src/airat.cpp
blood/src/aispid.cpp
blood/src/aitchern.cpp
blood/src/aiunicult.cpp
blood/src/aizomba.cpp
blood/src/aizombf.cpp
blood/src/asound.cpp
blood/src/barf.cpp
blood/src/blood.cpp
blood/src/callback.cpp
blood/src/choke.cpp
blood/src/common.cpp
blood/src/config.cpp
blood/src/controls.cpp
blood/src/credits.cpp
blood/src/db.cpp
blood/src/demo.cpp
blood/src/dude.cpp
blood/src/endgame.cpp
blood/src/eventq.cpp
blood/src/fire.cpp
blood/src/fx.cpp
blood/src/gamemenu.cpp
blood/src/gameutil.cpp
blood/src/getopt.cpp
blood/src/gib.cpp
blood/src/globals.cpp
blood/src/inifile.cpp
blood/src/iob.cpp
blood/src/levels.cpp
blood/src/loadsave.cpp
blood/src/map2d.cpp
blood/src/menu.cpp
blood/src/messages.cpp
blood/src/mirrors.cpp
blood/src/misc.cpp
blood/src/network.cpp
blood/src/osdcmd.cpp
blood/src/player.cpp
blood/src/qav.cpp
blood/src/qheap.cpp
blood/src/replace.cpp
blood/src/resource.cpp
blood/src/screen.cpp
blood/src/sectorfx.cpp
blood/src/seq.cpp
blood/src/sfx.cpp
blood/src/sound.cpp
blood/src/tile.cpp
blood/src/trig.cpp
blood/src/triggers.cpp
blood/src/view.cpp
blood/src/warp.cpp
blood/src/weapon.cpp
)
if( MSVC )
enable_precompiled_headers( g_pch.h PCH_SOURCES )
# The original Build code was written with unsigned chars and unfortunately they still haven't been eliminated entirely.
# All other code should stay with signed chars. What a mess... :(