2019-11-24 20:45:15 -08:00
|
|
|
cmake_minimum_required(VERSION 3.14)
|
|
|
|
cmake_policy(SET CMP0046 NEW)
|
|
|
|
cmake_policy(SET CMP0063 NEW)
|
|
|
|
cmake_policy(SET CMP0071 NEW)
|
|
|
|
|
|
|
|
project(agw-quake C)
|
|
|
|
|
2019-11-24 22:05:46 -08:00
|
|
|
find_package(OpenGL REQUIRED)
|
2019-11-24 20:45:15 -08:00
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
|
2019-11-24 22:05:46 -08:00
|
|
|
pkg_check_modules(SDL2 REQUIRED IMPORTED_TARGET sdl2>=2.0.0)
|
|
|
|
|
|
|
|
pkg_check_modules(FLAC IMPORTED_TARGET flac>=1.3.3)
|
|
|
|
pkg_check_modules(Vorbis IMPORTED_TARGET vorbis>=1.3.6
|
|
|
|
vorbisfile>=1.3.6
|
|
|
|
ogg>=1.3.4)
|
|
|
|
pkg_check_modules(Opus IMPORTED_TARGET opus>=1.3.1
|
|
|
|
opusfile>=0.11
|
|
|
|
ogg>=1.3.4)
|
|
|
|
pkg_check_modules(MikMod IMPORTED_TARGET libmikmod>=3.3.11)
|
2019-11-24 20:45:15 -08:00
|
|
|
|
2019-11-24 22:27:51 -08:00
|
|
|
set(srcs
|
2019-11-24 20:45:15 -08:00
|
|
|
source/anorm_dots.h
|
|
|
|
source/anorms.h
|
|
|
|
source/arch_def.h
|
|
|
|
source/bgmusic.c
|
|
|
|
source/bgmusic.h
|
|
|
|
source/bspfile.h
|
|
|
|
source/cd_sdl.c
|
|
|
|
source/cdaudio.h
|
|
|
|
source/cfgfile.c
|
|
|
|
source/cfgfile.h
|
|
|
|
source/chase.c
|
|
|
|
source/cl_demo.c
|
|
|
|
source/cl_input.c
|
|
|
|
source/cl_main.c
|
|
|
|
source/cl_parse.c
|
|
|
|
source/cl_tent.c
|
|
|
|
source/client.h
|
|
|
|
source/cmd.c
|
|
|
|
source/cmd.h
|
|
|
|
source/common.c
|
|
|
|
source/common.h
|
|
|
|
source/console.c
|
|
|
|
source/console.h
|
|
|
|
source/crc.c
|
|
|
|
source/crc.h
|
|
|
|
source/cvar.c
|
|
|
|
source/cvar.h
|
|
|
|
source/draw.h
|
|
|
|
source/filenames.h
|
|
|
|
source/gl_draw.c
|
|
|
|
source/gl_fog.c
|
|
|
|
source/gl_mesh.c
|
|
|
|
source/gl_model.c
|
|
|
|
source/gl_model.h
|
|
|
|
source/gl_refrag.c
|
|
|
|
source/gl_rlight.c
|
|
|
|
source/gl_rmain.c
|
|
|
|
source/gl_rmisc.c
|
|
|
|
source/gl_screen.c
|
|
|
|
source/gl_sky.c
|
|
|
|
source/gl_texmgr.c
|
|
|
|
source/gl_texmgr.h
|
|
|
|
source/gl_vidsdl.c
|
|
|
|
source/gl_warp.c
|
|
|
|
source/gl_warp_sin.h
|
|
|
|
source/glquake.h
|
|
|
|
source/host.c
|
|
|
|
source/host_cmd.c
|
|
|
|
source/image.c
|
|
|
|
source/image.h
|
|
|
|
source/in_sdl.c
|
|
|
|
source/input.h
|
|
|
|
source/keys.c
|
|
|
|
source/keys.h
|
|
|
|
source/lodepng.h
|
|
|
|
source/main_sdl.c
|
|
|
|
source/mathlib.c
|
|
|
|
source/mathlib.h
|
|
|
|
source/menu.c
|
|
|
|
source/menu.h
|
|
|
|
source/modelgen.h
|
|
|
|
source/net.h
|
|
|
|
source/net_defs.h
|
|
|
|
source/net_dgrm.c
|
|
|
|
source/net_dgrm.h
|
|
|
|
source/net_loop.c
|
|
|
|
source/net_loop.h
|
|
|
|
source/net_main.c
|
|
|
|
source/net_sys.h
|
|
|
|
source/platform.h
|
|
|
|
source/pr_cmds.c
|
|
|
|
source/pr_comp.h
|
|
|
|
source/pr_edict.c
|
|
|
|
source/pr_exec.c
|
|
|
|
source/progdefs.h
|
|
|
|
source/progs.h
|
|
|
|
source/protocol.h
|
|
|
|
source/q_ctype.h
|
|
|
|
source/q_sound.h
|
|
|
|
source/q_stdinc.h
|
|
|
|
source/qs_bmp.h
|
|
|
|
source/quakedef.h
|
|
|
|
source/r_alias.c
|
|
|
|
source/r_brush.c
|
|
|
|
source/r_part.c
|
|
|
|
source/r_sprite.c
|
|
|
|
source/r_world.c
|
|
|
|
source/render.h
|
|
|
|
source/resource.h
|
|
|
|
source/sbar.c
|
|
|
|
source/sbar.h
|
|
|
|
source/screen.h
|
|
|
|
source/server.h
|
|
|
|
source/snd_codec.c
|
|
|
|
source/snd_codec.h
|
|
|
|
source/snd_codeci.h
|
|
|
|
source/snd_dma.c
|
|
|
|
source/snd_flac.c
|
|
|
|
source/snd_flac.h
|
|
|
|
source/snd_mem.c
|
|
|
|
source/snd_mikmod.c
|
|
|
|
source/snd_mikmod.h
|
|
|
|
source/snd_mix.c
|
|
|
|
source/snd_mp3.c
|
|
|
|
source/snd_mp3.h
|
|
|
|
source/snd_mpg123.c
|
|
|
|
source/snd_opus.c
|
|
|
|
source/snd_opus.h
|
|
|
|
source/snd_sdl.c
|
|
|
|
source/snd_umx.c
|
|
|
|
source/snd_umx.h
|
|
|
|
source/snd_vorbis.c
|
|
|
|
source/snd_vorbis.h
|
|
|
|
source/spritegn.h
|
|
|
|
source/stb_image_write.h
|
|
|
|
source/strl_fn.h
|
|
|
|
source/strlcat.c
|
|
|
|
source/strlcpy.c
|
|
|
|
source/sv_main.c
|
|
|
|
source/sv_move.c
|
|
|
|
source/sv_phys.c
|
|
|
|
source/sv_user.c
|
|
|
|
source/sys.h
|
|
|
|
source/vid.h
|
|
|
|
source/view.c
|
|
|
|
source/view.h
|
|
|
|
source/wad.c
|
|
|
|
source/wad.h
|
|
|
|
source/world.c
|
|
|
|
source/world.h
|
|
|
|
source/zone.c
|
|
|
|
source/zone.h)
|
|
|
|
|
2019-11-25 13:20:03 -08:00
|
|
|
set(srcs_linux
|
|
|
|
source/linux/pl_linux.c)
|
|
|
|
|
|
|
|
set(srcs_osx
|
|
|
|
source/osx/pl_osx.c)
|
|
|
|
|
|
|
|
set(srcs_unix
|
|
|
|
source/unix/net_bsd.c
|
|
|
|
source/unix/net_udp.c
|
|
|
|
source/unix/net_udp.h
|
|
|
|
source/unix/sys_sdl_unix.c)
|
|
|
|
|
|
|
|
set(srcs_windows
|
|
|
|
source/windows/net_win.c
|
|
|
|
source/windows/net_wins.c
|
|
|
|
source/windows/net_wins.h
|
|
|
|
source/windows/net_wipx.c
|
|
|
|
source/windows/net_wipx.h
|
|
|
|
source/windows/pl_win.c
|
|
|
|
source/windows/sys_sdl_win.c
|
|
|
|
source/windows/wsaerror.h)
|
|
|
|
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
|
|
|
list(APPEND srcs ${srcs_windows})
|
|
|
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
|
|
list(APPEND srcs ${srcs_unix} ${srcs_linux})
|
|
|
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
|
|
|
list(APPEND srcs ${srcs_unix} ${srcs_osx})
|
2019-11-24 22:27:51 -08:00
|
|
|
else()
|
2019-11-25 13:20:03 -08:00
|
|
|
message(FATAL_ERROR "platform not supported")
|
2019-11-24 22:27:51 -08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
add_executable(quake WIN32 ${srcs})
|
|
|
|
|
2019-11-24 22:05:46 -08:00
|
|
|
function(agw_checked_library define library)
|
2019-11-24 22:27:51 -08:00
|
|
|
if(${library}_FOUND)
|
|
|
|
target_compile_definitions(quake PUBLIC -D${define}=1)
|
|
|
|
target_link_libraries(quake PkgConfig::${library})
|
|
|
|
endif()
|
2019-11-24 22:05:46 -08:00
|
|
|
endfunction()
|
|
|
|
|
2019-11-24 22:27:51 -08:00
|
|
|
agw_checked_library(USE_CODEC_FLAC FLAC)
|
|
|
|
agw_checked_library(USE_CODEC_VORBIS Vorbis)
|
|
|
|
agw_checked_library(USE_CODEC_OPUS Opus)
|
|
|
|
agw_checked_library(USE_CODEC_MikMod MikMod)
|
2019-11-24 20:45:15 -08:00
|
|
|
|
2019-11-25 13:20:03 -08:00
|
|
|
target_compile_options(quake PUBLIC
|
|
|
|
$<$<C_COMPILER_ID:AppleClang,Clang,GNU>:
|
|
|
|
-Wall -Wextra -Werror -Wno-missing-field-initializers>
|
|
|
|
$<$<C_COMPILER_ID:MSVC>: /W4>)
|
|
|
|
target_include_directories(quake PUBLIC source)
|
2019-11-24 22:05:46 -08:00
|
|
|
target_link_libraries(quake m OpenGL::GL PkgConfig::SDL2)
|