Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
103 changes: 103 additions & 0 deletions BUILD_DARKAGES.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
@echo off
REM ============================================================================
REM DOOM: The Dark Ages - Windows Build Script
REM Run this on your ThinkPad T460s with Visual Studio installed
REM ============================================================================

echo =============================================
echo DOOM: The Dark Ages - Build Script
echo =============================================
echo.

REM Try to find Visual Studio
set "VS_FOUND=0"

REM Visual Studio 2022
if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" (
call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat"
set "VS_FOUND=1"
echo Found Visual Studio 2022 Community
)
if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Professional\Common7\Tools\VsDevCmd.bat" (
call "%ProgramFiles%\Microsoft Visual Studio\2022\Professional\Common7\Tools\VsDevCmd.bat"
set "VS_FOUND=1"
echo Found Visual Studio 2022 Professional
)

REM Visual Studio 2019
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat" (
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat"
set "VS_FOUND=1"
echo Found Visual Studio 2019 Community
)

REM Visual Studio 2017
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" (
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat"
set "VS_FOUND=1"
echo Found Visual Studio 2017 Community
)

if "%VS_FOUND%"=="0" (
echo ERROR: Visual Studio not found!
echo Please install Visual Studio 2017/2019/2022 with C++ tools
echo Or open "Developer Command Prompt" and run this script from there
pause
exit /b 1
)

echo.
echo [1/3] Building DOOM: The Dark Ages...
echo.

cd /d "%~dp0neo"

REM Build Release configuration
msbuild doom3.sln /p:Configuration=Release /p:Platform=Win32 /m /v:minimal

if errorlevel 1 (
echo.
echo BUILD FAILED! Check errors above.
pause
exit /b 1
)

echo.
echo [2/3] Build successful!
echo.

REM Copy output
set OUTPUT_DIR=%~dp0build\Win32\Release
echo Output directory: %OUTPUT_DIR%

if exist "%OUTPUT_DIR%\DarkAges.exe" (
echo.
echo [3/3] Packaging standalone...

REM Create standalone directory
set STANDALONE_DIR=%~dp0DOOM_Dark_Ages_Standalone
mkdir "%STANDALONE_DIR%" 2>nul

copy "%OUTPUT_DIR%\DarkAges.exe" "%STANDALONE_DIR%\" /Y
xcopy "%~dp0darkages" "%STANDALONE_DIR%\darkages\" /E /I /Y /Q
xcopy "%~dp0base\renderprogs" "%STANDALONE_DIR%\base\renderprogs\" /E /I /Y /Q
copy "%~dp0darkages\icon\darkages.ico" "%STANDALONE_DIR%\" /Y

echo.
echo =============================================
echo BUILD COMPLETE!
echo =============================================
echo.
echo EXE: %STANDALONE_DIR%\DarkAges.exe
echo Icon: darkages.ico (embedded in EXE)
echo.
echo To play: Run DarkAges.exe
echo =============================================
) else (
echo WARNING: DarkAges.exe not found at expected location
echo Check: %OUTPUT_DIR%
dir "%OUTPUT_DIR%\*.exe" 2>nul
)

echo.
pause
64 changes: 64 additions & 0 deletions BUILD_DARKAGES_CMAKE.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
@echo off
REM ============================================================================
REM DOOM: The Dark Ages - CMake Build Script for Windows
REM Alternative build using CMake (requires CMake + Visual Studio)
REM ============================================================================

echo =============================================
echo DOOM: The Dark Ages - CMake Build
echo =============================================
echo.

where cmake >nul 2>&1
if errorlevel 1 (
echo ERROR: CMake not found! Install from https://cmake.org/download/
pause
exit /b 1
)

echo [1/4] Configuring with CMake...
mkdir build_cmake 2>nul
cd build_cmake

cmake .. -G "Visual Studio 17 2022" -A Win32 ^
-DDARKAGES_PORTABLE=ON ^
-DDARKAGES_OPTIMIZE_T460S=ON ^
-DCMAKE_BUILD_TYPE=Release

if errorlevel 1 (
echo Trying Visual Studio 2019...
cmake .. -G "Visual Studio 16 2019" -A Win32 ^
-DDARKAGES_PORTABLE=ON ^
-DDARKAGES_OPTIMIZE_T460S=ON ^
-DCMAKE_BUILD_TYPE=Release
)

if errorlevel 1 (
echo ERROR: CMake configuration failed!
pause
exit /b 1
)

echo.
echo [2/4] Building Release...
cmake --build . --config Release --parallel

if errorlevel 1 (
echo BUILD FAILED!
pause
exit /b 1
)

echo.
echo [3/4] Creating package...
cpack -G ZIP -C Release

echo.
echo [4/4] Done!
echo.
echo Output: build_cmake\Release\DarkAges.exe
echo Package: build_cmake\DOOM-The-Dark-Ages-v1.0.0-Portable.zip
echo.

cd ..
pause
224 changes: 224 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
cmake_minimum_required(VERSION 3.16)
project(DoomTheDarkAges VERSION 1.0.0 LANGUAGES C CXX)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_C_STANDARD 99)

# Build options
option(DARKAGES_PORTABLE "Build portable standalone executable" ON)
option(DARKAGES_OPTIMIZE_T460S "Optimize for ThinkPad T460s (Intel HD 520)" ON)
option(USE_OPENGL "Use OpenGL renderer" ON)
option(USE_OPENAL "Use OpenAL for audio" ON)

# Performance flags for T460s (Intel HD 520, Core i5-6300U)
if(DARKAGES_OPTIMIZE_T460S)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=skylake -mtune=skylake")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2 -mavx -mavx2")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -flto -ffast-math")
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG -flto -ffast-math")
elseif(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2")
set(CMAKE_CXX_FLAGS_RELEASE "/O2 /Ob2 /GL /GF /Gy /DNDEBUG")
set(CMAKE_C_FLAGS_RELEASE "/O2 /Ob2 /GL /GF /Gy /DNDEBUG")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG /OPT:REF /OPT:ICF")
endif()
endif()

# Portable build - static linking
if(DARKAGES_PORTABLE)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
endif()
if(WIN32)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
endif()

# Source directories
set(NEO_DIR ${CMAKE_SOURCE_DIR}/neo)
set(BASE_DIR ${CMAKE_SOURCE_DIR}/darkages)

# idLib sources
file(GLOB_RECURSE IDLIB_SOURCES
${NEO_DIR}/idlib/*.cpp
${NEO_DIR}/idlib/*.h
)

# Renderer sources
file(GLOB RENDERER_SOURCES
${NEO_DIR}/renderer/*.cpp
${NEO_DIR}/renderer/*.h
)

# Framework sources
file(GLOB FRAMEWORK_SOURCES
${NEO_DIR}/framework/*.cpp
${NEO_DIR}/framework/*.h
)

# Sound sources
file(GLOB SOUND_SOURCES
${NEO_DIR}/sound/*.cpp
${NEO_DIR}/sound/*.h
)

# AAS sources
file(GLOB AAS_SOURCES
${NEO_DIR}/aas/*.cpp
${NEO_DIR}/aas/*.h
)

# Collision Model sources
file(GLOB CM_SOURCES
${NEO_DIR}/cm/*.cpp
${NEO_DIR}/cm/*.h
)

# UI sources
file(GLOB UI_SOURCES
${NEO_DIR}/ui/*.cpp
${NEO_DIR}/ui/*.h
)

# SWF sources
file(GLOB SWF_SOURCES
${NEO_DIR}/swf/*.cpp
${NEO_DIR}/swf/*.h
)

# Game sources (d3xp)
file(GLOB_RECURSE GAME_SOURCES
${NEO_DIR}/d3xp/*.cpp
${NEO_DIR}/d3xp/*.h
)

# Dark Ages specific sources
file(GLOB_RECURSE DARKAGES_SOURCES
${NEO_DIR}/darkages/*.cpp
${NEO_DIR}/darkages/*.h
)

# System sources
if(WIN32)
file(GLOB SYS_SOURCES
${NEO_DIR}/sys/*.cpp
${NEO_DIR}/sys/*.h
${NEO_DIR}/sys/win32/*.cpp
${NEO_DIR}/sys/win32/*.h
)
# Windows resource file with icon
set(WIN_RC_FILE ${NEO_DIR}/sys/win32/darkages.rc)
else()
file(GLOB SYS_SOURCES
${NEO_DIR}/sys/*.cpp
${NEO_DIR}/sys/*.h
)
set(WIN_RC_FILE "")
endif()

# All sources
set(ALL_SOURCES
${IDLIB_SOURCES}
${RENDERER_SOURCES}
${FRAMEWORK_SOURCES}
${SOUND_SOURCES}
${AAS_SOURCES}
${CM_SOURCES}
${UI_SOURCES}
${SWF_SOURCES}
${GAME_SOURCES}
${DARKAGES_SOURCES}
${SYS_SOURCES}
)

# Include directories
include_directories(
${NEO_DIR}
${NEO_DIR}/idlib
${NEO_DIR}/d3xp
${NEO_DIR}/darkages
)

# Definitions
add_definitions(
-D__DOOM_DLL__
-DGAME_DLL
-DDARKAGES_BUILD
-DGAME_VERSION="DarkAges-1.0"
)

if(WIN32)
add_definitions(-D_WIN32 -DWIN32 -D_WINDOWS)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
endif()

# Find packages
if(USE_OPENGL)
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
add_definitions(-DUSE_OPENGL)
endif()

# Executable - WIN32 flag creates a Windows GUI app (no console window)
if(WIN32)
enable_language(RC)
add_executable(DoomTheDarkAges WIN32 ${ALL_SOURCES} ${WIN_RC_FILE})
set_target_properties(DoomTheDarkAges PROPERTIES
OUTPUT_NAME "DarkAges"
WIN32_EXECUTABLE TRUE
SUFFIX ".exe"
)
else()
add_executable(DoomTheDarkAges ${ALL_SOURCES})
set_target_properties(DoomTheDarkAges PROPERTIES
OUTPUT_NAME "DarkAges"
)
endif()

if(USE_OPENGL)
target_link_libraries(DoomTheDarkAges ${OPENGL_LIBRARIES})
endif()

if(WIN32)
target_link_libraries(DoomTheDarkAges
winmm
ws2_32
iphlpapi
dbghelp
dinput8
dxguid
dsound
xinput
)
elseif(UNIX)
find_package(Threads REQUIRED)
target_link_libraries(DoomTheDarkAges
${CMAKE_THREAD_LIBS_INIT}
dl
)
if(USE_OPENAL)
find_package(PkgConfig)
pkg_check_modules(OPENAL openal)
if(OPENAL_FOUND)
target_link_libraries(DoomTheDarkAges ${OPENAL_LIBRARIES})
target_include_directories(DoomTheDarkAges PRIVATE ${OPENAL_INCLUDE_DIRS})
endif()
endif()
endif()

# Installation
install(TARGETS DoomTheDarkAges DESTINATION .)
install(DIRECTORY ${BASE_DIR}/ DESTINATION darkages)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/base/renderprogs DESTINATION darkages)
install(FILES ${CMAKE_SOURCE_DIR}/darkages/icon/darkages.ico DESTINATION .)

# Package settings for portable build
set(CPACK_GENERATOR "ZIP")
set(CPACK_PACKAGE_NAME "DoomTheDarkAges")
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "DOOM: The Dark Ages - Medieval FPS")
set(CPACK_PACKAGE_FILE_NAME "DOOM-The-Dark-Ages-v${PROJECT_VERSION}-Portable")
include(CPack)
Loading