Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,11 @@ engine/droid/project.properties

# Flatpak build artifacts
.flatpak-builder

.vscode/
.vs/
build*/
*.log
CMakeCache.txt
CMakeFiles/*
vcpkg_installed/
102 changes: 91 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ cmake_policy(SET CMP0063 NEW)

PROJECT(FTEQuake)

ADD_COMPILE_DEFINITIONS(FTE_CMAKE_BUILD=1)

INCLUDE_DIRECTORIES(
engine/common
engine/client
Expand Down Expand Up @@ -173,8 +175,8 @@ IF(FTE_DEP_BZIP2)
ENDIF()
IF(BZIP2_FOUND)
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};AVAIL_BZLIB;BZLIB_STATIC)
SET(FTE_LIBS ${FTE_LIBS} bz2)
SET(FTESV_LIBS ${FTESV_LIBS} bz2)
SET(FTE_LIBS ${FTE_LIBS} ${BZIP2_LIBRARIES})
SET(FTESV_LIBS ${FTESV_LIBS} ${BZIP2_LIBRARIES})
# MESSAGE(STATUS "bzip2 library found. bz2-compressed pk3s will work for the price of extra bloat! yay!")
ELSE()
MESSAGE(WARNING "bzip2 library NOT available. bz2-compressed pk3s will not be available, as if anyone cares.")
Expand Down Expand Up @@ -335,16 +337,20 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFTE_LIBRARY_PATH=${CMAKE_INSTALL_FULL_LIBD
FUNCTION(EMBED_PLUGIN_META PLUGNAME PLUGTITLE PLUGDESC)
SET_TARGET_PROPERTIES(plug_${PLUGNAME} PROPERTIES OUTPUT_NAME "${PLUGNAME}")
SET_TARGET_PROPERTIES(plug_${PLUGNAME} PROPERTIES PREFIX "fteplug_")
SET_TARGET_PROPERTIES(plug_${PLUGNAME} PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
IF(NOT WIN32)
SET_TARGET_PROPERTIES(plug_${PLUGNAME} PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
ENDIF()
SET(INSTALLTARGS ${INSTALLTARGS} "plug_${PLUGNAME}" PARENT_SCOPE)
#sadly we need to use a temp zip file, because otherwise zip insists on using zip64 extensions which breaks zip -A (as well as any attempts to read any files).
ADD_CUSTOM_COMMAND(
TARGET plug_${PLUGNAME} POST_BUILD
COMMAND /bin/echo -e "{\\n package fteplug_${PLUGNAME}\\n ver \"${SVNREVISION}\"\\n category Plugins\\n title \"${PLUGTITLE}\"\\n gamedir \"\"\\n desc \"${PLUGDESC}\"\\n}" | zip -q -9 -fz- $<TARGET_FILE:plug_${PLUGNAME}>.zip -
COMMAND cmake -E cat $<TARGET_FILE:plug_${PLUGNAME}>.zip >> "$<TARGET_FILE:plug_${PLUGNAME}>"
COMMAND zip -A "$<TARGET_FILE:plug_${PLUGNAME}>"
COMMAND cmake -E rm $<TARGET_FILE:plug_${PLUGNAME}>.zip
VERBATIM)
IF(NOT WIN32)
#sadly we need to use a temp zip file, because otherwise zip insists on using zip64 extensions which breaks zip -A (as well as any attempts to read any files).
ADD_CUSTOM_COMMAND(
TARGET plug_${PLUGNAME} POST_BUILD
COMMAND /bin/echo -e "{\\n package fteplug_${PLUGNAME}\\n ver \"${SVNREVISION}\"\\n category Plugins\\n title \"${PLUGTITLE}\"\\n gamedir \"\"\\n desc \"${PLUGDESC}\"\\n}" | zip -q -9 -fz- $<TARGET_FILE:plug_${PLUGNAME}>.zip -
COMMAND cmake -E cat $<TARGET_FILE:plug_${PLUGNAME}>.zip >> "$<TARGET_FILE:plug_${PLUGNAME}>"
COMMAND zip -A "$<TARGET_FILE:plug_${PLUGNAME}>"
COMMAND cmake -E rm $<TARGET_FILE:plug_${PLUGNAME}>.zip
VERBATIM)
ENDIF()
ENDFUNCTION()

SET(FTE_DEP_GNUTLS true CACHE BOOL "Link against gnutls")
Expand Down Expand Up @@ -1839,6 +1845,49 @@ ENDIF()

SET(FTE_MENU_SYS true CACHE BOOL "Compile System Menu.")
IF(FTE_MENU_SYS)
IF(WIN32)
ADD_CUSTOM_TARGET(menusys ALL
VERBATIM
DEPENDS fteqcc
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/quakec/menusys/"
COMMAND fteqcc -srcfile "menu.src" -o "${CMAKE_CURRENT_BINARY_DIR}/menu.dat" -DREVISION="${SVNREVISION}" -DDATE="${FTE_DATE}" -DBRANCH="${FTE_BRANCH}"
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/menu.dat" "${CMAKE_CURRENT_BINARY_DIR}/menu.lno"
SOURCES
quakec/menusys/menu.src
quakec/menusys/fteextensions.qc
quakec/menusys/menusys/mitems.qc
quakec/menusys/menusys/mitems_common.qc
quakec/menusys/menusys/mitem_frame.qc
quakec/menusys/menusys/mitem_desktop.qc
quakec/menusys/menusys/mitem_exmenu.qc
quakec/menusys/menusys/mitem_edittext.qc
quakec/menusys/menusys/mitem_tabs.qc
quakec/menusys/menusys/mitem_colours.qc
quakec/menusys/menusys/mitem_checkbox.qc
quakec/menusys/menusys/mitem_slider.qc
quakec/menusys/menusys/mitem_combo.qc
quakec/menusys/menusys/mitem_bind.qc
quakec/menusys/menusys/mitem_spinnymodel.qc
quakec/menusys/menu/loadsave.qc
quakec/menusys/menu/newgame.qc
quakec/menusys/menu/options_basic.qc
quakec/menusys/menu/options_effects.qc
quakec/menusys/menu/options_keys.qc
quakec/menusys/menu/options.qc
quakec/menusys/menu/presets.qc
quakec/menusys/menu/servers.qc
quakec/menusys/menu/main.qc
quakec/menusys/menu/mods.qc
quakec/menusys/menu/cvars.qc
quakec/menusys/menu/updates.qc
quakec/menusys/menu/options_audio.qc
quakec/menusys/menu/options_configs.qc
quakec/menusys/menu/options_hud.qc
quakec/menusys/menu/options_particles.qc
quakec/menusys/menu/options_video.qc
quakec/menusys/menu/quit.qc
)
ELSE()
ADD_CUSTOM_TARGET(menusys ALL
VERBATIM
DEPENDS fteqcc
Expand Down Expand Up @@ -1881,6 +1930,7 @@ IF(FTE_MENU_SYS)
quakec/menusys/menu/options_video.qc
quakec/menusys/menu/quit.qc
)
ENDIF()

INSTALL(FILES
${CMAKE_CURRENT_BINARY_DIR}/menusys.pk3
Expand All @@ -1889,6 +1939,35 @@ ENDIF()

SET(FTE_CSADDON true CACHE BOOL "CS Addon.")
IF(FTE_CSADDON)
IF(WIN32)
ADD_CUSTOM_TARGET(csaddon ALL
VERBATIM
DEPENDS fteqcc
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/quakec/csaddon/src/"
COMMAND fteqcc -srcfile "csaddon.src" -o "${CMAKE_CURRENT_BINARY_DIR}/csaddon.dat"
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/csaddon.dat" "${CMAKE_CURRENT_BINARY_DIR}/csaddon.lno"
SOURCES
quakec/csaddon/src/csaddon.src

quakec/csaddon/src/csplat.qc
quakec/csaddon/src/csfixups.qc

quakec/csaddon/src/editor_lights.qc
quakec/csaddon/src/editor_terrain.qc
quakec/csaddon/src/brush_selection.qc
quakec/csaddon/src/brush_history.qc
quakec/csaddon/src/brush_manip.qc
quakec/csaddon/src/brush_draw.qc
quakec/csaddon/src/brush_vertedit.qc
quakec/csaddon/src/editor_brushes.qc
quakec/csaddon/src/editor_ents.qc
quakec/csaddon/src/textfield.qc
quakec/csaddon/src/editor_particles.qc
quakec/csaddon/src/menu.qc
quakec/csaddon/src/cam.qc
quakec/csaddon/src/csaddon.qc
)
ELSE()
ADD_CUSTOM_TARGET(csaddon ALL
VERBATIM
DEPENDS fteqcc
Expand Down Expand Up @@ -1917,6 +1996,7 @@ IF(FTE_CSADDON)
quakec/csaddon/src/cam.qc
quakec/csaddon/src/csaddon.qc
)
ENDIF()

INSTALL(FILES
${CMAKE_CURRENT_BINARY_DIR}/csaddon.pk3
Expand Down
88 changes: 88 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 21,
"patch": 0
},
"configurePresets": [
{
"name": "windows-vs2026-min",
"displayName": "Windows VS2026 Minimal (fteqw-sv)",
"generator": "Visual Studio 18 2026",
"architecture": {
"value": "x64",
"strategy": "set"
},
"binaryDir": "${sourceDir}/build-vs2026-min",
"cacheVariables": {
"CMAKE_INSTALL_PREFIX": "${sourceDir}/local-install",
"FTE_ENGINE": "OFF",
"FTE_ENGINE_SERVER_ONLY": "ON",
"FTE_ENGINE_CLIENT_ONLY": "OFF",
"FTE_TOOL_QCC": "OFF",
"FTE_TOOL_QCCGUI": "OFF",
"FTE_MENU_SYS": "OFF",
"FTE_CSADDON": "OFF",
"FTE_TOOL_IQM": "OFF",
"FTE_TOOL_IMAGE": "OFF",
"FTE_TOOL_QTV": "OFF",
"FTE_TOOL_HTTPSV": "OFF",
"FTE_TOOL_MASTER": "OFF",
"FTE_PLUG_QUAKE3": "OFF",
"FTE_PLUG_COD": "OFF",
"FTE_PLUG_BULLET": "OFF",
"FTE_PLUG_ODE": "OFF",
"FTE_PLUG_QI": "OFF",
"FTE_PLUG_EZHUD": "OFF",
"FTE_PLUG_IRC": "OFF",
"FTE_PLUG_HL2": "OFF",
"FTE_PLUG_MODELS": "OFF",
"FTE_PLUG_FFMPEG": "OFF",
"FTE_PLUG_OPENXR": "OFF",
"FTE_PLUG_CEF": "OFF",
"FTE_PLUG_XMPP": "OFF"
}
},
{
"name": "windows-vs2026-full-vcpkg",
"displayName": "Windows VS2026 Full (vcpkg)",
"generator": "Visual Studio 18 2026",
"architecture": {
"value": "x64",
"strategy": "set"
},
"binaryDir": "${sourceDir}/build-vs2026-full-vcpkg",
"cacheVariables": {
"CMAKE_INSTALL_PREFIX": "${sourceDir}/local-install",
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/../vcpkg/scripts/buildsystems/vcpkg.cmake",
"VCPKG_TARGET_TRIPLET": "x64-windows"
},
"environment": {
"PATH": "${sourceDir}/../vcpkg/installed/x64-windows/tools/gettext/bin;$penv{PATH}"
}
}
],
"buildPresets": [
{
"name": "windows-vs2026-min-fteqw-sv",
"displayName": "Build fteqw-sv (Release)",
"configurePreset": "windows-vs2026-min",
"configuration": "Release",
"targets": [
"fteqw-sv"
],
"jobs": 4
},
{
"name": "windows-vs2026-full-allbuild",
"displayName": "Build ALL_BUILD (Release)",
"configurePreset": "windows-vs2026-full-vcpkg",
"configuration": "Release",
"targets": [
"ALL_BUILD"
],
"jobs": 4
}
]
}
15 changes: 12 additions & 3 deletions documentation/Building.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,25 @@ The setup script will install **android+emscripten** dependancies for you, so yo

- The script can also be run from cygwin, but does not support compiling for Linux then.

## Windows Systems (cygwin)
## Windows Systems (cygwin or cmake)

If you want to compile a Win64 build in cygwin, it should be as simple as:

make makelibs FTE_TARGET=win64
make gl-rel FTE_TARGET=win64

or
or to compile using the msvc toolchain that comes with Visual Studio, install the vcpkg depencies listed in the root of the repo using vcpkg the build using CMake:

# set VCPKG_DIR to wherever you've cloned VCPKG...
call "%VCPKG_DIR%\bootstrap-vcpkg.bat" -disableMetrics
"%VCPKG_DIR%\vcpkg.exe" install --triplet x64-windows --x-manifest-root="%FTEQW_DIR%"
cmake --build --preset windows-vs2026-full-allbuild

The preset used above presumes VS2026. If you can compile with a different generator, feel free to submit a new preset for it in CMakePresets.json.




TODO

You only should need gcc and make installed in cygwin for this.

Expand Down
4 changes: 4 additions & 0 deletions engine/client/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -1364,11 +1364,13 @@ qboolean WriteTGA(const char *filename, enum fs_relative fsroot, const qbyte *ft
#define LIBPNG_LOADED() 1
#define PSTATIC(n) = &n
#ifdef _MSC_VER
#ifndef FTE_CMAKE_BUILD
#ifdef _WIN64
#pragma comment(lib, MSVCLIBSPATH "libpng64.lib")
#else
#pragma comment(lib, MSVCLIBSPATH "libpng.lib")
#endif
#endif
#endif
#endif

Expand Down Expand Up @@ -2068,11 +2070,13 @@ int Image_WritePNG (const char *filename, enum fs_relative fsroot, int compressi
#define LIBJPEG_LOADED() (libjpeg_handle != NULL)
#else
#ifdef _MSC_VER
#ifndef FTE_CMAKE_BUILD
#ifdef _WIN64
#pragma comment(lib, MSVCLIBSPATH "libjpeg64.lib")
#else
#pragma comment(lib, MSVCLIBSPATH "jpeg.lib")
#endif
#endif
#endif
#define JSTATIC(n) = &n
#define LIBJPEG_LOADED() (1)
Expand Down
2 changes: 2 additions & 0 deletions engine/client/snd_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "winquake.h"
#include "fs.h"

#include <inttypes.h>

typedef struct
{
int format;
Expand Down
9 changes: 9 additions & 0 deletions engine/common/bothdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
#endif

#ifdef _WIN32
Comment thread
felakuti4life marked this conversation as resolved.
#ifndef strcasecmp
#define strcasecmp _stricmp
#endif
#ifndef strncasecmp
#define strncasecmp _strnicmp
#endif
#endif

#if defined(IQMTOOL) || defined(WEBSVONLY) || defined(FTEPLUGIN)
#ifdef _WIN32
//Windows-specific...
Expand Down
17 changes: 17 additions & 0 deletions engine/common/fs_stdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#if _POSIX_C_SOURCE >= 200112L
#include <sys/stat.h>
#endif
#if defined(_WIN32) && defined(WEBSVONLY)
#include <direct.h>
#endif

#if !defined(FTE_TARGET_WEB) && (!defined(_WIN32) || defined(WEBSVONLY))

Expand All @@ -14,6 +17,20 @@
#define fs_readonly true
#define FS_FlushFSHashFull()
int Sys_EnumerateFiles (const char *gpath, const char *match, int (QDECL *func)(const char *fname, qofs_t fsize, time_t modtime, void *parm, searchpathfuncs_t *spath), void *parm, searchpathfuncs_t *spath) {return 0;}
#ifdef _WIN32
void Sys_mkdir (const char *path)
{
_mkdir(path);
}
qboolean Sys_remove (const char *path)
{
return remove(path) == 0;
}
qboolean Sys_Rename (const char *oldfname, const char *newfname)
{
return rename(oldfname, newfname) == 0;
}
#endif
#else
#if !defined(_WIN32) || defined(FTE_SDL) || defined(WINRT) || defined(_XBOX)
#define FSSTDIO_OpenPath VFSOS_OpenPath
Expand Down
4 changes: 2 additions & 2 deletions engine/qclib/qcc_pr_comp.c
Original file line number Diff line number Diff line change
Expand Up @@ -20319,7 +20319,7 @@ void QCC_PR_ParseDefs (const char *classname, pbool fatal_unused)
pbool old_assumef64 = flag_assume_double;
pbool old_assumevar = flag_assumevar;
pbool old_subscope = pr_subscopedlocals;
if (!strcasecmp(pr_token, "C"))
if (!QC_strcasecmp(pr_token, "C"))
{
flag_qcfuncs = false; //ignore * on funcptrs, promote varg floats to doubles, some other quirks
flag_cpriority = true;
Expand All @@ -20328,7 +20328,7 @@ void QCC_PR_ParseDefs (const char *classname, pbool fatal_unused)
flag_assumevar = true;
pr_subscopedlocals = true;
}
else if (!strcasecmp(pr_token, "QC"))
else if (!QC_strcasecmp(pr_token, "QC"))
{
flag_qcfuncs = true; //no promotion, func references are simply references, etc
//flag_cpriority = false; //refrain from changing it
Expand Down
2 changes: 2 additions & 0 deletions engine/qclib/qccgui.c
Original file line number Diff line number Diff line change
Expand Up @@ -4632,11 +4632,13 @@ static void Image_ResampleTexture (unsigned *in, int inwidth, int inheight, unsi
#define LIBPNG_LOADED() 1
#define PSTATIC(n) = &n
#ifdef _MSC_VER
#ifndef FTE_CMAKE_BUILD
#ifdef _WIN64
#pragma comment(lib, MSVCLIBSPATH "libpng64.lib")
#else
#pragma comment(lib, MSVCLIBSPATH "libpng.lib")
#endif
#endif
#endif
#endif

Expand Down
Loading