2015-01-28 05:46:39 +00:00
|
|
|
# SRB2 Core
|
|
|
|
|
|
|
|
# Core sources
|
|
|
|
set(SRB2_CORE_SOURCES
|
|
|
|
am_map.c
|
|
|
|
b_bot.c
|
|
|
|
command.c
|
|
|
|
comptime.c
|
|
|
|
console.c
|
|
|
|
d_clisrv.c
|
|
|
|
d_main.c
|
|
|
|
d_net.c
|
|
|
|
d_netcmd.c
|
|
|
|
d_netfil.c
|
|
|
|
dehacked.c
|
|
|
|
f_finale.c
|
|
|
|
f_wipe.c
|
|
|
|
filesrch.c
|
2020-03-19 20:13:39 +00:00
|
|
|
g_demo.c
|
2015-01-28 05:46:39 +00:00
|
|
|
g_game.c
|
|
|
|
g_input.c
|
|
|
|
hu_stuff.c
|
|
|
|
i_tcp.c
|
|
|
|
info.c
|
|
|
|
lzf.c
|
2016-06-05 20:29:40 +00:00
|
|
|
m_aatree.c
|
2015-01-28 05:46:39 +00:00
|
|
|
m_anigif.c
|
|
|
|
m_argv.c
|
|
|
|
m_bbox.c
|
|
|
|
m_cheat.c
|
|
|
|
m_cond.c
|
|
|
|
m_fixed.c
|
|
|
|
m_menu.c
|
|
|
|
m_misc.c
|
|
|
|
m_queue.c
|
|
|
|
m_random.c
|
|
|
|
md5.c
|
|
|
|
mserv.c
|
|
|
|
s_sound.c
|
|
|
|
screen.c
|
|
|
|
sounds.c
|
|
|
|
st_stuff.c
|
2015-01-28 06:58:30 +00:00
|
|
|
#string.c
|
2015-01-28 05:46:39 +00:00
|
|
|
tables.c
|
|
|
|
v_video.c
|
|
|
|
w_wad.c
|
|
|
|
y_inter.c
|
|
|
|
z_zone.c
|
|
|
|
)
|
|
|
|
|
|
|
|
set(SRB2_CORE_HEADERS
|
|
|
|
am_map.h
|
|
|
|
b_bot.h
|
|
|
|
byteptr.h
|
|
|
|
command.h
|
|
|
|
console.h
|
|
|
|
d_clisrv.h
|
|
|
|
d_event.h
|
|
|
|
d_main.h
|
|
|
|
d_net.h
|
|
|
|
d_netcmd.h
|
|
|
|
d_netfil.h
|
|
|
|
d_player.h
|
|
|
|
d_think.h
|
|
|
|
d_ticcmd.h
|
|
|
|
dehacked.h
|
|
|
|
doomdata.h
|
|
|
|
doomdef.h
|
|
|
|
doomstat.h
|
|
|
|
doomtype.h
|
|
|
|
endian.h
|
|
|
|
f_finale.h
|
|
|
|
fastcmp.h
|
|
|
|
filesrch.h
|
2020-03-19 20:13:39 +00:00
|
|
|
g_demo.h
|
2015-01-28 05:46:39 +00:00
|
|
|
g_game.h
|
|
|
|
g_input.h
|
|
|
|
g_state.h
|
|
|
|
hu_stuff.h
|
|
|
|
i_joy.h
|
|
|
|
i_net.h
|
|
|
|
i_sound.h
|
|
|
|
i_system.h
|
|
|
|
i_tcp.h
|
|
|
|
i_video.h
|
|
|
|
info.h
|
|
|
|
keys.h
|
|
|
|
lzf.h
|
2016-06-05 20:29:40 +00:00
|
|
|
m_aatree.h
|
2015-01-28 05:46:39 +00:00
|
|
|
m_anigif.h
|
|
|
|
m_argv.h
|
|
|
|
m_bbox.h
|
|
|
|
m_cheat.h
|
|
|
|
m_cond.h
|
|
|
|
m_dllist.h
|
|
|
|
m_fixed.h
|
|
|
|
m_menu.h
|
|
|
|
m_misc.h
|
|
|
|
m_queue.h
|
|
|
|
m_random.h
|
|
|
|
m_swap.h
|
|
|
|
md5.h
|
|
|
|
mserv.h
|
|
|
|
p5prof.h
|
|
|
|
s_sound.h
|
|
|
|
screen.h
|
|
|
|
sounds.h
|
|
|
|
st_stuff.h
|
|
|
|
tables.h
|
|
|
|
v_video.h
|
|
|
|
w_wad.h
|
|
|
|
y_inter.h
|
|
|
|
z_zone.h
|
|
|
|
|
2015-03-08 08:26:54 +00:00
|
|
|
config.h.in
|
2015-01-28 05:46:39 +00:00
|
|
|
)
|
|
|
|
|
2015-03-08 08:26:54 +00:00
|
|
|
set(SRB2_CORE_RENDER_SOURCES
|
|
|
|
r_bsp.c
|
|
|
|
r_data.c
|
|
|
|
r_draw.c
|
|
|
|
r_main.c
|
|
|
|
r_plane.c
|
|
|
|
r_segs.c
|
2020-03-08 19:48:23 +00:00
|
|
|
r_skins.c
|
2015-03-08 08:26:54 +00:00
|
|
|
r_sky.c
|
|
|
|
r_splats.c
|
|
|
|
r_things.c
|
2019-10-28 18:28:42 +00:00
|
|
|
r_patch.c
|
2019-06-01 11:07:23 +00:00
|
|
|
r_portal.c
|
2015-03-08 08:26:54 +00:00
|
|
|
|
|
|
|
r_bsp.h
|
|
|
|
r_data.h
|
|
|
|
r_defs.h
|
|
|
|
r_draw.h
|
|
|
|
r_local.h
|
|
|
|
r_main.h
|
|
|
|
r_plane.h
|
|
|
|
r_segs.h
|
2020-03-08 19:48:23 +00:00
|
|
|
r_skins.h
|
2015-03-08 08:26:54 +00:00
|
|
|
r_sky.h
|
|
|
|
r_splats.h
|
|
|
|
r_state.h
|
|
|
|
r_things.h
|
2019-10-28 18:28:42 +00:00
|
|
|
r_patch.h
|
2019-06-01 11:07:23 +00:00
|
|
|
r_portal.h
|
2015-01-28 05:46:39 +00:00
|
|
|
)
|
|
|
|
|
2015-03-08 08:26:54 +00:00
|
|
|
set(SRB2_CORE_GAME_SOURCES
|
|
|
|
p_ceilng.c
|
|
|
|
p_enemy.c
|
|
|
|
p_floor.c
|
|
|
|
p_inter.c
|
|
|
|
p_lights.c
|
|
|
|
p_map.c
|
|
|
|
p_maputl.c
|
|
|
|
p_mobj.c
|
|
|
|
p_polyobj.c
|
|
|
|
p_saveg.c
|
|
|
|
p_setup.c
|
|
|
|
p_sight.c
|
2015-04-19 21:21:19 +00:00
|
|
|
p_slopes.c
|
2015-03-08 08:26:54 +00:00
|
|
|
p_spec.c
|
|
|
|
p_telept.c
|
|
|
|
p_tick.c
|
|
|
|
p_user.c
|
2015-01-28 05:46:39 +00:00
|
|
|
|
2015-03-08 08:26:54 +00:00
|
|
|
p_local.h
|
|
|
|
p_maputl.h
|
|
|
|
p_mobj.h
|
|
|
|
p_polyobj.h
|
|
|
|
p_pspr.h
|
|
|
|
p_saveg.h
|
|
|
|
p_setup.h
|
2015-04-19 21:21:19 +00:00
|
|
|
p_slopes.h
|
2015-03-08 08:26:54 +00:00
|
|
|
p_spec.h
|
|
|
|
p_tick.h
|
2015-01-28 05:46:39 +00:00
|
|
|
)
|
|
|
|
|
2016-02-06 02:49:24 +00:00
|
|
|
if(NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
|
2015-03-08 08:26:54 +00:00
|
|
|
set(SRB2_CORE_SOURCES ${SRB2_CORE_SOURCES} string.c)
|
|
|
|
endif()
|
2015-01-28 05:46:39 +00:00
|
|
|
|
2015-03-25 00:32:58 +00:00
|
|
|
prepend_sources(SRB2_CORE_SOURCES)
|
|
|
|
prepend_sources(SRB2_CORE_HEADERS)
|
|
|
|
prepend_sources(SRB2_CORE_RENDER_SOURCES)
|
|
|
|
prepend_sources(SRB2_CORE_GAME_SOURCES)
|
|
|
|
|
|
|
|
set(SRB2_CORE_HEADERS ${SRB2_CORE_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
2015-03-08 08:26:54 +00:00
|
|
|
source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS})
|
|
|
|
source_group("Renderer" FILES ${SRB2_CORE_RENDER_SOURCES})
|
|
|
|
source_group("Game" FILES ${SRB2_CORE_GAME_SOURCES})
|
2015-01-28 05:46:39 +00:00
|
|
|
|
2015-03-25 00:32:58 +00:00
|
|
|
|
2015-02-02 03:25:02 +00:00
|
|
|
set(SRB2_ASM_SOURCES
|
2015-03-08 09:16:16 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/vid_copy.s
|
2015-02-02 03:25:02 +00:00
|
|
|
)
|
|
|
|
|
2015-02-02 01:18:25 +00:00
|
|
|
set(SRB2_NASM_SOURCES
|
2015-03-08 09:16:16 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tmap_mmx.nas
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tmap.nas
|
2015-02-02 01:18:25 +00:00
|
|
|
)
|
|
|
|
|
2015-02-02 03:25:02 +00:00
|
|
|
if(MSVC)
|
2015-03-08 09:16:16 +00:00
|
|
|
list(APPEND SRB2_NASM_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/tmap_vc.nas)
|
2015-02-02 03:25:02 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set(SRB2_NASM_OBJECTS
|
2015-03-08 09:16:16 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/tmap_mmx.obj
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/tmap.obj
|
2015-02-02 03:25:02 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
if(MSVC)
|
2015-03-08 09:16:16 +00:00
|
|
|
list(APPEND SRB2_NASM_OBJECTS ${CMAKE_CURRENT_BINARY_DIR}/tmap_vc.obj)
|
2015-02-02 03:25:02 +00:00
|
|
|
endif()
|
|
|
|
|
2015-03-08 08:26:54 +00:00
|
|
|
source_group("Assembly" FILES ${SRB2_ASM_SOURCES} ${SRB2_NASM_SOURCES})
|
2015-02-02 01:18:25 +00:00
|
|
|
|
2015-02-02 03:25:02 +00:00
|
|
|
|
2015-01-28 05:46:39 +00:00
|
|
|
### Configuration
|
|
|
|
set(SRB2_CONFIG_HAVE_PNG ON CACHE BOOL
|
|
|
|
"Enable PNG support. Depends on zlib, so will be disabled if you don't enable that too.")
|
|
|
|
set(SRB2_CONFIG_HAVE_ZLIB ON CACHE BOOL
|
2015-03-08 08:26:54 +00:00
|
|
|
"Enable zlib support.")
|
2015-01-28 07:20:43 +00:00
|
|
|
set(SRB2_CONFIG_HAVE_GME ON CACHE BOOL
|
2015-03-08 08:26:54 +00:00
|
|
|
"Enable GME support.")
|
2019-01-04 02:17:18 +00:00
|
|
|
set(SRB2_CONFIG_HAVE_OPENMPT ON CACHE BOOL
|
2019-01-02 08:27:24 +00:00
|
|
|
"Enable OpenMPT support.")
|
2015-01-28 05:46:39 +00:00
|
|
|
set(SRB2_CONFIG_HWRENDER ON CACHE BOOL
|
2015-03-08 08:26:54 +00:00
|
|
|
"Enable hardware rendering through OpenGL.")
|
2015-01-28 05:46:39 +00:00
|
|
|
set(SRB2_CONFIG_USEASM OFF CACHE BOOL
|
2015-02-02 01:18:25 +00:00
|
|
|
"Enable NASM tmap implementation for software mode speedup.")
|
2015-02-02 03:25:02 +00:00
|
|
|
set(SRB2_CONFIG_YASM OFF CACHE BOOL
|
|
|
|
"Use YASM in place of NASM.")
|
2015-01-28 07:20:43 +00:00
|
|
|
set(SRB2_CONFIG_STATIC_OPENGL OFF CACHE BOOL
|
|
|
|
"Use statically linked OpenGL. NOT RECOMMENDED.")
|
2015-01-28 05:46:39 +00:00
|
|
|
|
2016-09-25 19:33:07 +00:00
|
|
|
### use internal libraries?
|
2018-11-14 20:58:45 +00:00
|
|
|
if(${CMAKE_SYSTEM} MATCHES "Windows") ###set on Windows only
|
2018-11-14 01:37:14 +00:00
|
|
|
set(SRB2_CONFIG_USE_INTERNAL_LIBRARIES OFF CACHE BOOL
|
2019-01-02 08:27:24 +00:00
|
|
|
"Use SRB2's internal copies of required dependencies (SDL2, PNG, zlib, GME, OpenMPT).")
|
2018-11-14 01:37:14 +00:00
|
|
|
endif()
|
2016-09-25 19:33:07 +00:00
|
|
|
|
2020-03-19 17:36:14 +00:00
|
|
|
set(SRB2_LUA_SOURCES
|
|
|
|
lua_baselib.c
|
|
|
|
lua_blockmaplib.c
|
|
|
|
lua_consolelib.c
|
|
|
|
lua_hooklib.c
|
|
|
|
lua_hudlib.c
|
|
|
|
lua_infolib.c
|
|
|
|
lua_maplib.c
|
|
|
|
lua_mathlib.c
|
|
|
|
lua_mobjlib.c
|
|
|
|
lua_playerlib.c
|
|
|
|
lua_script.c
|
|
|
|
lua_skinlib.c
|
|
|
|
lua_thinkerlib.c
|
|
|
|
)
|
|
|
|
set(SRB2_LUA_HEADERS
|
|
|
|
lua_hook.h
|
|
|
|
lua_hud.h
|
|
|
|
lua_libs.h
|
|
|
|
lua_script.h
|
|
|
|
)
|
2015-01-28 05:46:39 +00:00
|
|
|
|
2020-03-19 17:36:14 +00:00
|
|
|
prepend_sources(SRB2_LUA_SOURCES)
|
|
|
|
prepend_sources(SRB2_LUA_HEADERS)
|
2015-03-25 00:32:58 +00:00
|
|
|
|
2020-03-19 17:36:14 +00:00
|
|
|
source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS})
|
2015-01-28 05:46:39 +00:00
|
|
|
|
2020-03-19 17:36:14 +00:00
|
|
|
set(SRB2_BLUA_SOURCES
|
|
|
|
blua/lapi.c
|
|
|
|
blua/lauxlib.c
|
|
|
|
blua/lbaselib.c
|
|
|
|
blua/lcode.c
|
|
|
|
blua/ldebug.c
|
|
|
|
blua/ldo.c
|
|
|
|
blua/ldump.c
|
|
|
|
blua/lfunc.c
|
|
|
|
blua/lgc.c
|
|
|
|
blua/linit.c
|
|
|
|
blua/liolib.c
|
|
|
|
blua/llex.c
|
|
|
|
blua/lmem.c
|
|
|
|
blua/lobject.c
|
|
|
|
blua/lopcodes.c
|
|
|
|
blua/lparser.c
|
|
|
|
blua/lstate.c
|
|
|
|
blua/lstring.c
|
|
|
|
blua/lstrlib.c
|
|
|
|
blua/ltable.c
|
|
|
|
blua/ltablib.c
|
|
|
|
blua/ltm.c
|
|
|
|
blua/lundump.c
|
|
|
|
blua/lvm.c
|
|
|
|
blua/lzio.c
|
|
|
|
)
|
|
|
|
set(SRB2_BLUA_HEADERS
|
|
|
|
blua/lapi.h
|
|
|
|
blua/lauxlib.h
|
|
|
|
blua/lcode.h
|
|
|
|
blua/ldebug.h
|
|
|
|
blua/ldo.h
|
|
|
|
blua/lfunc.h
|
|
|
|
blua/lgc.h
|
|
|
|
blua/llex.h
|
|
|
|
blua/llimits.h
|
|
|
|
blua/lmem.h
|
|
|
|
blua/lobject.h
|
|
|
|
blua/lopcodes.h
|
|
|
|
blua/lparser.h
|
|
|
|
blua/lstate.h
|
|
|
|
blua/lstring.h
|
|
|
|
blua/ltable.h
|
|
|
|
blua/ltm.h
|
|
|
|
blua/lua.h
|
|
|
|
blua/luaconf.h
|
|
|
|
blua/lualib.h
|
|
|
|
blua/lundump.h
|
|
|
|
blua/lvm.h
|
|
|
|
blua/lzio.h
|
|
|
|
)
|
2015-03-25 00:32:58 +00:00
|
|
|
|
2020-03-19 17:36:14 +00:00
|
|
|
prepend_sources(SRB2_BLUA_SOURCES)
|
|
|
|
prepend_sources(SRB2_BLUA_HEADERS)
|
2015-03-25 00:32:58 +00:00
|
|
|
|
2020-03-19 17:36:14 +00:00
|
|
|
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
|
2015-01-28 05:46:39 +00:00
|
|
|
|
2015-01-28 07:20:43 +00:00
|
|
|
if(${SRB2_CONFIG_HAVE_GME})
|
2016-09-25 19:33:07 +00:00
|
|
|
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
|
|
|
set(GME_FOUND ON)
|
|
|
|
set(GME_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/gme/include)
|
2018-10-31 00:50:36 +00:00
|
|
|
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
|
|
|
set(GME_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/gme/win64 -lgme")
|
|
|
|
else() # 32-bit
|
|
|
|
set(GME_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/gme/win32 -lgme")
|
|
|
|
endif()
|
2016-09-25 19:33:07 +00:00
|
|
|
else()
|
|
|
|
find_package(GME)
|
|
|
|
endif()
|
2015-01-28 07:20:43 +00:00
|
|
|
if(${GME_FOUND})
|
|
|
|
set(SRB2_HAVE_GME ON)
|
2016-03-06 19:32:07 +00:00
|
|
|
add_definitions(-DHAVE_LIBGME)
|
2015-01-28 07:20:43 +00:00
|
|
|
else()
|
|
|
|
message(WARNING "You have specified that GME is available but it was not found.")
|
|
|
|
endif()
|
2015-01-28 05:46:39 +00:00
|
|
|
endif()
|
|
|
|
|
2019-01-02 08:27:24 +00:00
|
|
|
if(${SRB2_CONFIG_HAVE_OPENMPT})
|
|
|
|
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
|
|
|
set(OPENMPT_FOUND ON)
|
2019-01-04 02:17:18 +00:00
|
|
|
set(OPENMPT_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/libopenmpt/inc)
|
2019-01-02 08:27:24 +00:00
|
|
|
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
2019-01-04 02:17:18 +00:00
|
|
|
set(OPENMPT_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/libopenmpt/lib/x86_64/mingw -lopenmpt")
|
2019-01-02 08:27:24 +00:00
|
|
|
else() # 32-bit
|
2019-01-04 02:17:18 +00:00
|
|
|
set(OPENMPT_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/libopenmpt/lib/x86/mingw -lopenmpt")
|
2019-01-02 08:27:24 +00:00
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
find_package(OPENMPT)
|
|
|
|
endif()
|
|
|
|
if(${OPENMPT_FOUND})
|
|
|
|
set(SRB2_HAVE_OPENMPT ON)
|
|
|
|
add_definitions(-DHAVE_OPENMPT)
|
|
|
|
else()
|
|
|
|
message(WARNING "You have specified that OpenMPT is available but it was not found.")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2015-01-28 05:46:39 +00:00
|
|
|
if(${SRB2_CONFIG_HAVE_ZLIB})
|
2016-09-25 19:33:07 +00:00
|
|
|
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
|
|
|
set(ZLIB_FOUND ON)
|
|
|
|
set(ZLIB_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/zlib)
|
2016-09-26 20:58:25 +00:00
|
|
|
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
|
|
|
set(ZLIB_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/zlib/win32 -lz64")
|
|
|
|
else() # 32-bit
|
|
|
|
set(ZLIB_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/zlib/win32 -lz32")
|
|
|
|
endif()
|
2016-09-25 19:33:07 +00:00
|
|
|
else()
|
|
|
|
find_package(ZLIB)
|
|
|
|
endif()
|
2015-01-28 05:46:39 +00:00
|
|
|
if(${ZLIB_FOUND})
|
|
|
|
set(SRB2_HAVE_ZLIB ON)
|
2018-11-23 03:44:47 +00:00
|
|
|
add_definitions(-DHAVE_ZLIB)
|
2015-01-28 05:46:39 +00:00
|
|
|
else()
|
|
|
|
message(WARNING "You have specified that ZLIB is available but it was not found. SRB2 may not compile correctly.")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(${SRB2_CONFIG_HAVE_PNG} AND ${SRB2_CONFIG_HAVE_ZLIB})
|
|
|
|
if (${ZLIB_FOUND})
|
2016-09-25 19:33:07 +00:00
|
|
|
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
|
|
|
set(PNG_FOUND ON)
|
|
|
|
set(PNG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/libpng-src)
|
2016-09-26 20:58:25 +00:00
|
|
|
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
|
|
|
set(PNG_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/libpng-src/projects -lpng64")
|
|
|
|
else() # 32-bit
|
|
|
|
set(PNG_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/libpng-src/projects -lpng32")
|
|
|
|
endif()
|
2016-09-25 19:33:07 +00:00
|
|
|
else()
|
|
|
|
find_package(PNG)
|
|
|
|
endif()
|
2015-01-28 05:46:39 +00:00
|
|
|
if(${PNG_FOUND})
|
|
|
|
set(SRB2_HAVE_PNG ON)
|
|
|
|
add_definitions(-DHAVE_PNG)
|
|
|
|
add_definitions(-D_LARGEFILE64_SOURCE)
|
2019-02-16 11:18:22 +00:00
|
|
|
set(SRB2_PNG_SOURCES apng.c)
|
|
|
|
set(SRB2_PNG_HEADERS apng.h)
|
|
|
|
prepend_sources(SRB2_PNG_SOURCES)
|
|
|
|
prepend_sources(SRB2_PNG_HEADERS)
|
|
|
|
source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS}
|
|
|
|
${SRB2_PNG_SOURCES} ${SRB2_PNG_HEADERS})
|
2015-01-28 05:46:39 +00:00
|
|
|
else()
|
|
|
|
message(WARNING "You have specified that PNG is available but it was not found. SRB2 may not compile correctly.")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(${SRB2_CONFIG_HWRENDER})
|
2015-01-28 07:20:43 +00:00
|
|
|
add_definitions(-DHWRENDER)
|
2015-03-08 08:26:54 +00:00
|
|
|
set(SRB2_HWRENDER_SOURCES
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_bsp.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_cache.c
|
2017-01-09 22:13:26 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.c
|
2015-03-08 08:26:54 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_draw.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_light.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.c
|
2018-12-19 01:36:39 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md3load.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_model.c
|
2015-03-08 08:26:54 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_trick.c
|
2018-12-19 01:36:39 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/u_list.c
|
2015-03-08 08:26:54 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
set (SRB2_HWRENDER_HEADERS
|
2017-01-09 22:13:26 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.h
|
2015-03-08 08:26:54 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_data.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_defs.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_dll.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_drv.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glide.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_light.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.h
|
2018-12-19 01:36:39 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md3load.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_model.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/u_list.h
|
2015-03-08 08:26:54 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
set(SRB2_R_OPENGL_SOURCES
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/r_opengl/r_opengl.c
|
|
|
|
)
|
|
|
|
|
|
|
|
set(SRB2_R_OPENGL_HEADERS
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/r_opengl/r_opengl.h
|
|
|
|
)
|
|
|
|
|
2015-01-28 07:20:43 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(${SRB2_CONFIG_HWRENDER} AND ${SRB2_CONFIG_STATIC_OPENGL})
|
2015-01-28 05:46:39 +00:00
|
|
|
find_package(OpenGL)
|
|
|
|
if(${OPENGL_FOUND})
|
|
|
|
add_definitions(-DHWRENDER)
|
2015-01-28 07:20:43 +00:00
|
|
|
add_definitions(-DSTATIC_OPENGL)
|
2015-01-28 05:46:39 +00:00
|
|
|
else()
|
2015-01-28 07:20:43 +00:00
|
|
|
message(WARNING "You have specified static opengl but opengl was not found. Not setting HWRENDER.")
|
2015-01-28 05:46:39 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(${SRB2_CONFIG_USEASM})
|
2017-01-11 01:16:48 +00:00
|
|
|
#SRB2_ASM_FLAGS can be used to pass flags to either nasm or yasm.
|
|
|
|
if(${CMAKE_SYSTEM} MATCHES "Linux")
|
|
|
|
set(SRB2_ASM_FLAGS "-DLINUX ${SRB2_ASM_FLAGS}")
|
|
|
|
endif()
|
|
|
|
|
2015-02-02 03:25:02 +00:00
|
|
|
if(${SRB2_CONFIG_YASM})
|
|
|
|
set(CMAKE_ASM_YASM_SOURCE_FILE_EXTENSIONS ${CMAKE_ASM_YASM_SOURCE_FILE_EXTENSIONS} nas)
|
2017-01-11 19:52:14 +00:00
|
|
|
set(CMAKE_ASM_YASM_FLAGS "${SRB2_ASM_FLAGS}" CACHE STRING "Flags used by the assembler during all build types.")
|
2015-02-02 03:25:02 +00:00
|
|
|
enable_language(ASM_YASM)
|
|
|
|
else()
|
|
|
|
set(CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS ${CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS} nas)
|
2017-01-11 19:52:14 +00:00
|
|
|
set(CMAKE_ASM_NASM_FLAGS "${SRB2_ASM_FLAGS}" CACHE STRING "Flags used by the assembler during all build types.")
|
2015-02-02 03:25:02 +00:00
|
|
|
enable_language(ASM_NASM)
|
|
|
|
endif()
|
2015-01-28 05:46:39 +00:00
|
|
|
set(SRB2_USEASM ON)
|
|
|
|
add_definitions(-DUSEASM)
|
|
|
|
else()
|
|
|
|
set(SRB2_USEASM OFF)
|
2017-01-06 20:26:10 +00:00
|
|
|
add_definitions(-DNONX86 -DNORUSEASM)
|
2015-01-28 05:46:39 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Targets
|
|
|
|
|
|
|
|
# Compatibility flag with later versions of GCC
|
|
|
|
# We should really fix our code to not need this
|
2016-02-06 02:49:24 +00:00
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
2015-02-02 03:25:02 +00:00
|
|
|
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -mno-ms-bitfields)
|
2015-01-28 06:58:30 +00:00
|
|
|
endif()
|
2015-01-28 05:46:39 +00:00
|
|
|
|
2016-02-06 03:38:40 +00:00
|
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
|
|
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-absolute-value)
|
|
|
|
endif()
|
|
|
|
|
2015-01-29 00:03:41 +00:00
|
|
|
add_definitions(-DCMAKECONFIG)
|
|
|
|
|
2015-03-25 00:32:58 +00:00
|
|
|
#add_library(SRB2Core STATIC
|
|
|
|
# ${SRB2_CORE_SOURCES}
|
|
|
|
# ${SRB2_CORE_HEADERS}
|
|
|
|
# ${SRB2_CORE_RENDER_SOURCES}
|
|
|
|
# ${SRB2_CORE_GAME_SOURCES}
|
|
|
|
# ${SRB2_LUA_SOURCES}
|
|
|
|
# ${SRB2_LUA_HEADERS}
|
|
|
|
# ${SRB2_BLUA_SOURCES}
|
|
|
|
# ${SRB2_BLUA_HEADERS}
|
|
|
|
#)
|
2015-03-08 08:26:54 +00:00
|
|
|
|
2015-01-28 05:46:39 +00:00
|
|
|
add_subdirectory(sdl)
|
2015-03-08 08:26:54 +00:00
|
|
|
|
2019-12-15 06:47:58 +00:00
|
|
|
if(NOT ${SRB2_SDL2_AVAILABLE})
|
2015-03-08 08:26:54 +00:00
|
|
|
message(FATAL_ERROR "There are no targets available to build an SRB2 executable. :(")
|
2016-02-06 02:49:24 +00:00
|
|
|
endif()
|