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
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,9 @@ ENDIF ()
# Adds the Windows icon resource file when building on windows.
IF (WIN32)
SET(OD_SOURCEFILES ${OD_SOURCEFILES} ${CMAKE_SOURCE_DIR}/dist/icon.rc)
IF (MSVC)
SET(OD_SOURCEFILES ${OD_SOURCEFILES} ${CMAKE_SOURCE_DIR}/dist/opendungeons.manifest)
ENDIF ()
ENDIF ()

##################################
Expand Down Expand Up @@ -569,7 +572,7 @@ if(WIN32 AND ${OGRE_FOUND})

find_package(Boost REQUIRED COMPONENTS ${OD_BOOST_COMPONENTS})
if(Boost_FOUND)
set(OD_BOOST_LIB_DIRS ${Boost_INCLUDE_DIRS}/stage/lib)
set(OD_BOOST_LIB_DIRS ${Boost_LIBRARY_DIRS})
set(OD_BOOST_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
endif()
else()
Expand Down Expand Up @@ -661,6 +664,12 @@ target_link_libraries(

target_link_libraries(opendungeons-plus pybind11::embed)

if(MSVC AND PYTHON_DEBUG_LIBRARY AND NOT PYTHON_IS_DEBUG)
# Keep pybind11's headers consistent with the selected debug Python library.
# Python's Windows header defines Py_DEBUG without a value as well.
target_compile_definitions(${PROJECT_BINARY_NAME} PRIVATE "$<$<CONFIG:Debug>:Py_DEBUG=>")
endif()

# Set linker options in MSVC
if(WIN32 AND MSVC)
# We need to force output because of the boost lib used, defining two times the
Expand Down Expand Up @@ -962,4 +971,3 @@ elseif(WIN32)
install(FILES ${EXT_LIBS}
DESTINATION ${OD_BIN_PATH})
endif()

4 changes: 4 additions & 0 deletions dist/icon.rc
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
1 ICON "OD-Logo.ico"

#ifdef __GNUC__
1 24 "opendungeons.manifest"
#endif
9 changes: 9 additions & 0 deletions dist/opendungeons.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
</windowsSettings>
</application>
</assembly>
7 changes: 3 additions & 4 deletions gui/WindowSettings.layout
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@
</Window>
<Window type="OD/Checkbox" name="VSyncCheckbox" >
<Property name="Area" value="{{0,22},{0,120},{0,166},{0,135}}" />
<Property name="Text" value="VSync*" />
<Property name="TooltipText" value="* Needs a restart to be potentially applied." />
<Property name="Text" value="VSync" />
</Window>
</Window>
</Window>
Expand Down Expand Up @@ -102,12 +101,12 @@
<Window type="OD/Checkbox" name="KeyboardGrabCheckbox" >
<Property name="Area" value="{{0,32},{0,40},{0,150},{0,60}}" />
<Property name="Text" value="Keyboard grab" />
<Property name="TooltipText" value="When checked, the keyboard is grabbed and can't be used in other applications (requires restart)." />
<Property name="TooltipText" value="When checked, the keyboard is grabbed and can't be used in other applications." />
</Window>
<Window type="OD/Checkbox" name="MouseGrabCheckbox" >
<Property name="Area" value="{{0,32},{0,80},{0,150},{0,100}}" />
<Property name="Text" value="Mouse grab" />
<Property name="TooltipText" value="When checked, the mouse is grabbed and can't be used in other applications (requires restart)." />
<Property name="TooltipText" value="When checked, the mouse is grabbed and can't be used in other applications." />
</Window>
<Window type="OD/Checkbox" name="AutoscrollCheckbox" >
<Property name="Area" value="{{0,32},{0,120},{0,150},{0,140}}" />
Expand Down
13 changes: 13 additions & 0 deletions scripts/win32/Enter-OpenDungeonsPlus.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$taskDependencyRoot = 'C:\Users\mario\od-deps'
$taskVsPath = 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools'
Import-Module "$taskVsPath\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath $taskVsPath -SkipAutomaticLocation -DevCmdArguments '-arch=x64 -host_arch=x64'
$env:Path = "$taskDependencyRoot\tools\cmake-3.31.8-windows-x86_64\bin;$taskDependencyRoot\install\bin;$taskDependencyRoot\install\lib;C:\Users\mario\AppData\Local\Programs\Python\Python310;" + $env:Path
$env:CMAKE_PREFIX_PATH = "$taskDependencyRoot\install"
$env:CEGUI_HOME = "$taskDependencyRoot\install"
$env:OIS_HOME = "$taskDependencyRoot\install"
$env:BOOST_ROOT = "$taskDependencyRoot\install"
$env:BOOST_INCLUDEDIR = "$taskDependencyRoot\install\include\boost-1_82"
$env:BOOST_LIBRARYDIR = "$taskDependencyRoot\install\lib"
$env:LIB = "$taskDependencyRoot\install\lib;" + $env:LIB
Write-Output 'OpenDungeonsPlus development environment loaded (Windows x64).'
17 changes: 17 additions & 0 deletions scripts/win32/configure-windows-prereqs.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
$ErrorActionPreference = 'Stop'
. (Join-Path $PSScriptRoot 'Enter-OpenDungeonsPlus.ps1')
$taskRepo = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
$taskRoot = 'C:\Users\mario\od-deps'
$taskPythonRoot = 'C:/Users/mario/AppData/Local/Programs/Python/Python310'
$taskOptions = @('-S', $taskRepo, '-B', "$taskRepo\build\windows",
'-G', 'Visual Studio 17 2022', '-A', 'x64', '-DOD_BUILD_TESTING=OFF', '-DBUILD_TESTING=OFF',
"-DCMAKE_INSTALL_PREFIX=$taskRepo/build/windows/install",
"-DPYTHON_EXECUTABLE=$taskPythonRoot/python.exe", "-DPYTHON_LIBRARY=$taskPythonRoot/libs/python310.lib",
"-DPYTHON_DEBUG_LIBRARY=$taskPythonRoot/libs/python310_d.lib", "-DPYTHON_INCLUDE_DIR=$taskPythonRoot/include")
Write-Output 'Checking the original project configuration with the installed prerequisites'
$ErrorActionPreference = 'Continue'
& cmake @taskOptions *> "$taskRoot\logs\opendungeons-configure.log"
$ErrorActionPreference = 'Stop'
if ($LASTEXITCODE -ne 0) { Get-Content -LiteralPath "$taskRoot\logs\opendungeons-configure.log" -Tail 60; throw 'Project configuration failed' }
Write-Output 'Original project configuration succeeded'
& (Join-Path $PSScriptRoot 'prepare-windows-runtime.ps1')
39 changes: 39 additions & 0 deletions scripts/win32/install-base-prereqs.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
param([string[]]$Only)

$ErrorActionPreference = 'Stop'
$taskRoot = 'C:\Users\mario\od-deps'
$taskCmake = "$taskRoot\tools\cmake-3.31.8-windows-x86_64\bin\cmake.exe"
$taskPrefix = "$taskRoot\install"

$taskPackages = @(
@{ Name = 'expat'; Source = 'expat/expat'; Options = @('-DEXPAT_BUILD_TOOLS=OFF', '-DEXPAT_BUILD_EXAMPLES=OFF', '-DEXPAT_BUILD_TESTS=OFF', '-DEXPAT_BUILD_DOCS=OFF', '-DEXPAT_SHARED_LIBS=ON') },
@{ Name = 'ois'; Source = 'ois'; Options = @('-DOIS_BUILD_DEMOS=OFF', '-DOIS_BUILD_SHARED_LIBS=ON') },
@{ Name = 'sfml'; Source = 'sfml'; Options = @('-DSFML_BUILD_EXAMPLES=OFF', '-DSFML_BUILD_DOC=OFF') },
@{ Name = 'freetype'; Source = 'freetype'; Options = @('-DFT_DISABLE_ZLIB=ON', '-DFT_DISABLE_BZIP2=ON', '-DFT_DISABLE_PNG=ON', '-DFT_DISABLE_HARFBUZZ=ON', '-DFT_DISABLE_BROTLI=ON') },
@{ Name = 'pybind11'; Source = 'pybind11'; Options = @('-DPYBIND11_TEST=OFF', '-DPYBIND11_INSTALL=ON', '-DPYTHON_EXECUTABLE=C:/Users/mario/AppData/Local/Programs/Python/Python310/python.exe') },
@{ Name = 'pcre'; Source = 'pcre-8.45'; Options = @('-DPCRE_BUILD_TESTS=OFF', '-DPCRE_BUILD_PCREGREP=OFF', '-DPCRE_BUILD_PCRECPP=OFF', '-DPCRE_SUPPORT_UTF=ON', '-DPCRE_SUPPORT_UNICODE_PROPERTIES=ON') }
)

foreach ($taskPackage in $taskPackages) {
if ($Only -and $taskPackage.Name -notin $Only) { continue }
$taskName = $taskPackage.Name
$taskBuild = "$taskRoot\build\$taskName"
$taskConfigureLog = "$taskRoot\logs\$taskName-configure.log"
$taskOptions = @('-S', "$taskRoot\src\$($taskPackage.Source)", '-B', $taskBuild,
'-G', 'Visual Studio 17 2022', '-A', 'x64', "-DCMAKE_INSTALL_PREFIX=$taskPrefix",
"-DCMAKE_PREFIX_PATH=$taskPrefix", '-DBUILD_SHARED_LIBS=ON', '-DCMAKE_DEBUG_POSTFIX=_d') + $taskPackage.Options
Write-Output "Configuring $taskName"
$ErrorActionPreference = 'Continue'
& $taskCmake @taskOptions *> $taskConfigureLog
$ErrorActionPreference = 'Stop'
if ($LASTEXITCODE -ne 0) { Get-Content -LiteralPath $taskConfigureLog -Tail 45; throw "$taskName configuration failed" }
foreach ($taskConfiguration in @('Release', 'Debug')) {
$taskBuildLog = "$taskRoot\logs\$taskName-$taskConfiguration.log"
Write-Output "Building and installing $taskName ($taskConfiguration)"
$ErrorActionPreference = 'Continue'
& $taskCmake --build $taskBuild --config $taskConfiguration --target INSTALL --parallel 8 *> $taskBuildLog
$ErrorActionPreference = 'Stop'
if ($LASTEXITCODE -ne 0) { Get-Content -LiteralPath $taskBuildLog -Tail 45; throw "$taskName $taskConfiguration build failed" }
}
Write-Output "Installed $taskName"
}
20 changes: 20 additions & 0 deletions scripts/win32/install-boost-prereq.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
$ErrorActionPreference = 'Stop'
$taskRoot = 'C:\Users\mario\od-deps'
$taskVsPath = 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools'
Import-Module "$taskVsPath\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath $taskVsPath -SkipAutomaticLocation -DevCmdArguments '-arch=x64 -host_arch=x64'
Set-Location -LiteralPath "$taskRoot\src\boost_1_82_0"
Write-Output 'Preparing Boost build tool'
$ErrorActionPreference = 'Continue'
& .\bootstrap.bat *> "$taskRoot\logs\boost-bootstrap.log"
$ErrorActionPreference = 'Stop'
if ($LASTEXITCODE -ne 0) { Get-Content -LiteralPath "$taskRoot\logs\boost-bootstrap.log" -Tail 40; throw 'Boost bootstrap failed' }
$taskCompiler = (Get-Command cl.exe).Source.Replace('\', '/')
$taskCompilerSetup = "$taskVsPath\VC\Auxiliary\Build\vcvarsall.bat".Replace('\', '/')
'using msvc : 14.3 : "{0}" : <setup>"{1}" ;' -f $taskCompiler, $taskCompilerSetup | Set-Content -LiteralPath "$taskRoot\boost-user-config.jam" -Encoding ASCII
Write-Output 'Building and installing Boost libraries for Release and Debug'
$ErrorActionPreference = 'Continue'
& .\b2.exe -j8 "--user-config=$taskRoot\boost-user-config.jam" --reconfigure toolset=msvc-14.3 architecture=x86 address-model=64 variant=release,debug link=static,shared runtime-link=shared threading=multi --layout=versioned --with-filesystem --with-locale --with-program_options --with-thread --with-system --with-chrono --with-date_time --with-atomic "--prefix=$taskRoot\install" install *> "$taskRoot\logs\boost-build.log"
$ErrorActionPreference = 'Stop'
if ($LASTEXITCODE -ne 0) { Get-Content -LiteralPath "$taskRoot\logs\boost-build.log" -Tail 50; throw 'Boost build failed' }
Write-Output 'Boost installed'
42 changes: 42 additions & 0 deletions scripts/win32/install-cegui-prereq.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
$ErrorActionPreference = 'Stop'
$taskRoot = 'C:\Users\mario\od-deps'
$taskCmake = "$taskRoot\tools\cmake-3.31.8-windows-x86_64\bin\cmake.exe"
$taskPatch = Join-Path $PSScriptRoot 'patches/cegui-msvc-snprintf.patch'
$ErrorActionPreference = 'Continue'
& git -C "$taskRoot\src\cegui" apply --reverse --check $taskPatch *> $null
if ($LASTEXITCODE -ne 0) {
Write-Output 'Applying CEGUI snprintf compatibility fix for modern MSVC'
& git -C "$taskRoot\src\cegui" apply $taskPatch
if ($LASTEXITCODE -ne 0) { throw 'CEGUI compatibility patch failed' }
}
$ErrorActionPreference = 'Stop'
$taskOptions = @('-S', "$taskRoot\src\cegui", '-B', "$taskRoot\build\cegui",
'-G', 'Visual Studio 17 2022', '-A', 'x64', "-DCMAKE_INSTALL_PREFIX=$taskRoot\install",
"-DCMAKE_PREFIX_PATH=$taskRoot\install", '-DCMAKE_CXX_FLAGS=/DWIN32 /D_WINDOWS /W3 /GR /EHsc /MP4',
'-DCEGUI_BUILD_RENDERER_OGRE=ON', '-DCEGUI_BUILD_RENDERER_OPENGL=OFF',
'-DCEGUI_BUILD_RENDERER_OPENGL3=OFF', '-DCEGUI_BUILD_RENDERER_OPENGLES=OFF',
'-DCEGUI_BUILD_RENDERER_DIRECT3D9=OFF', '-DCEGUI_BUILD_RENDERER_DIRECT3D10=OFF',
'-DCEGUI_BUILD_RENDERER_DIRECT3D11=OFF', '-DCEGUI_BUILD_XMLPARSER_EXPAT=ON',
'-DCEGUI_BUILD_XMLPARSER_LIBXML2=OFF', '-DCEGUI_BUILD_IMAGECODEC_FREEIMAGE=OFF',
'-DCEGUI_SAMPLES_ENABLED=OFF', '-DCEGUI_BUILD_APPLICATION_TEMPLATES=OFF',
'-DCEGUI_BUILD_TESTS=OFF', '-DCEGUI_BUILD_PERFORMANCE_TESTS=OFF', '-DCEGUI_BUILD_DATAFILES_TEST=OFF',
'-DCEGUI_BUILD_LUA_MODULE=OFF', '-DCEGUI_BUILD_LUA_GENERATOR=OFF', '-DCEGUI_BUILD_PYTHON_MODULES=OFF',
'-DCEGUI_LIB_INSTALL_DIR:PATH=lib', '-DCEGUI_INCLUDE_INSTALL_DIR:PATH=include/cegui-0',
"-DFREETYPE_LIB_DBG=$taskRoot/install/lib/freetyped.lib",
"-DEXPAT_LIB_DBG=$taskRoot/install/lib/libexpatd.lib",
"-DPCRE_LIB_DBG=$taskRoot/install/lib/pcred.lib",
"-DBOOST_ROOT=$taskRoot/install", "-DBOOST_INCLUDEDIR=$taskRoot/install/include/boost-1_82",
'-DPYTHON_EXECUTABLE=C:/Users/mario/AppData/Local/Programs/Python/Python310/python.exe')
Write-Output 'Configuring CEGUI'
$ErrorActionPreference = 'Continue'
& $taskCmake @taskOptions *> "$taskRoot\logs\cegui-configure.log"
$ErrorActionPreference = 'Stop'
if ($LASTEXITCODE -ne 0) { Get-Content -LiteralPath "$taskRoot\logs\cegui-configure.log" -Tail 60; throw 'CEGUI configuration failed' }
foreach ($taskConfiguration in @('Release', 'Debug')) {
Write-Output "Building and installing CEGUI ($taskConfiguration)"
$ErrorActionPreference = 'Continue'
& $taskCmake --build "$taskRoot\build\cegui" --config $taskConfiguration --target INSTALL --parallel 4 *> "$taskRoot\logs\cegui-$taskConfiguration.log"
$ErrorActionPreference = 'Stop'
if ($LASTEXITCODE -ne 0) { Get-Content -LiteralPath "$taskRoot\logs\cegui-$taskConfiguration.log" -Tail 60; throw "CEGUI $taskConfiguration build failed" }
}
Write-Output 'CEGUI installed'
41 changes: 41 additions & 0 deletions scripts/win32/install-ogre-prereq.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
$ErrorActionPreference = 'Stop'
$taskRoot = 'C:\Users\mario\od-deps'
$taskCmake = "$taskRoot\tools\cmake-3.31.8-windows-x86_64\bin\cmake.exe"
$taskPatch = Join-Path $PSScriptRoot 'patches/ogre-multiwindow-settings.patch'
$ErrorActionPreference = 'Continue'
& git -C "$taskRoot\src\ogre" apply --recount --reverse --check $taskPatch *> $null
if ($LASTEXITCODE -ne 0) {
Write-Output 'Applying OGRE multi-window settings compatibility fixes'
& git -C "$taskRoot\src\ogre" apply --recount $taskPatch
if ($LASTEXITCODE -ne 0) { throw 'OGRE compatibility patch failed' }
}
$ErrorActionPreference = 'Stop'
$taskOptions = @('-S', "$taskRoot\src\ogre", '-B', "$taskRoot\build\ogre",
'-G', 'Visual Studio 17 2022', '-A', 'x64', "-DCMAKE_INSTALL_PREFIX=$taskRoot\install",
"-DCMAKE_PREFIX_PATH=$taskRoot\install", '-DOGRE_BUILD_DEPENDENCIES=OFF',
'-DOGRE_STATIC=OFF', '-DOGRE_CONFIG_THREAD_PROVIDER=std', '-DOGRE_CONFIG_THREADS=3',
'-DOGRE_BUILD_RENDERSYSTEM_GL3PLUS=ON', '-DOGRE_BUILD_RENDERSYSTEM_GL=OFF',
'-DOGRE_BUILD_RENDERSYSTEM_D3D9=OFF', '-DOGRE_BUILD_RENDERSYSTEM_D3D11=OFF',
'-DOGRE_BUILD_RENDERSYSTEM_GLES2=OFF', '-DOGRE_BUILD_PLUGIN_FREEIMAGE=OFF',
'-DOGRE_BUILD_PLUGIN_EXRCODEC=OFF', '-DOGRE_BUILD_PLUGIN_BSP=OFF',
'-DOGRE_BUILD_PLUGIN_PCZ=OFF', '-DOGRE_BUILD_PLUGIN_DOT_SCENE=OFF',
'-DOGRE_BUILD_COMPONENT_JAVA=OFF', '-DOGRE_BUILD_COMPONENT_PYTHON=OFF',
'-DOGRE_BUILD_COMPONENT_CSHARP=OFF', '-DOGRE_BUILD_COMPONENT_VOLUME=OFF',
'-DOGRE_BUILD_COMPONENT_PAGING=OFF', '-DOGRE_BUILD_COMPONENT_TERRAIN=OFF',
'-DOGRE_BUILD_COMPONENT_PROPERTY=OFF', '-DOGRE_BUILD_COMPONENT_MESHLODGENERATOR=OFF',
'-DOGRE_BUILD_COMPONENT_HLMS=OFF', '-DOGRE_BUILD_COMPONENT_OVERLAY_IMGUI=OFF',
'-DOGRE_BUILD_SAMPLES=OFF', '-DOGRE_BUILD_TOOLS=OFF', '-DOGRE_BUILD_TESTS=OFF',
'-DOGRE_ENABLE_PRECOMPILED_HEADERS=ON', '-DOGRE_BUILD_MSVC_MP=OFF', '-DCMAKE_CXX_FLAGS=/DWIN32 /D_WINDOWS /W3 /GR /EHsc /MP4')
Write-Output 'Configuring OGRE'
$ErrorActionPreference = 'Continue'
& $taskCmake @taskOptions *> "$taskRoot\logs\ogre-configure.log"
$ErrorActionPreference = 'Stop'
if ($LASTEXITCODE -ne 0) { Get-Content -LiteralPath "$taskRoot\logs\ogre-configure.log" -Tail 55; throw 'OGRE configuration failed' }
foreach ($taskConfiguration in @('Release', 'Debug')) {
Write-Output "Building and installing OGRE ($taskConfiguration)"
$ErrorActionPreference = 'Continue'
& $taskCmake --build "$taskRoot\build\ogre" --config $taskConfiguration --target INSTALL --parallel 4 *> "$taskRoot\logs\ogre-$taskConfiguration.log"
$ErrorActionPreference = 'Stop'
if ($LASTEXITCODE -ne 0) { Get-Content -LiteralPath "$taskRoot\logs\ogre-$taskConfiguration.log" -Tail 55; throw "OGRE $taskConfiguration build failed" }
}
Write-Output 'OGRE installed'
8 changes: 8 additions & 0 deletions scripts/win32/patches/cegui-msvc-snprintf.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
diff --git a/cegui/include/CEGUI/PropertyHelper.h b/cegui/include/CEGUI/PropertyHelper.h
--- a/cegui/include/CEGUI/PropertyHelper.h
+++ b/cegui/include/CEGUI/PropertyHelper.h
@@ -51,3 +51,3 @@
-#ifdef _MSC_VER
+#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif
Loading