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
15 changes: 13 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set(OPENTS_VERSION_PRERELEASE "")
option(OPENTS_OFFICIAL_BUILD "Build as an official release of the declared version" OFF)

option(OPENTS_EXPERIMENTAL_CLANG_CL "Build with clang-cl using the MSVC ABI" OFF)
option(OPENTS_EXPERIMENTAL_NATIVE "Configure a native build for the host platform" OFF)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

project() enables ASM_MASM before this option exists, CMake searches for ml/ml64 and a linux or mac host then fails before reaching the opt-in. Move MASM out of project().


if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
AND CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
Expand All @@ -24,14 +25,24 @@ elseif(MSVC)
if(MSVC_VERSION LESS 1930)
message(FATAL_ERROR "OpenTS requires MSVC 19.30 or newer.")
endif()
elseif(OPENTS_EXPERIMENTAL_NATIVE)
message(STATUS "OpenTS: configuring an unsupported native build for the host platform.")

# The tree declares imports and exports with __declspec throughout, which clang only
# accepts with the Microsoft extensions enabled.
add_compile_options(-fms-extensions)
else()
message(FATAL_ERROR
"OpenTS requires the Visual Studio 2022 MSVC toolchain. "
"For the unsupported clang-cl experiment, configure with "
"-DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/clang-cl-msvc.cmake.")
"-DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/clang-cl-msvc.cmake. "
"For the unsupported native build, configure with "
"-DOPENTS_EXPERIMENTAL_NATIVE=ON.")
endif()

enable_language(RC)
if(WIN32)
enable_language(RC)
endif()

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
18 changes: 10 additions & 8 deletions code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING "" FORCE)

# OpenTS currently supports 32-bit (x86) builds only.
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 4)
if(WIN32 AND NOT CMAKE_SIZEOF_VOID_P EQUAL 4)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This permits 64bit native builds, cool, but SaveStreamClass::Serialize(T *&) writes sizeof(pointer) bytes. A 64-bit binary would then use a different save representation under the same packed project version. I guess try and contain native builds from save/network runtime use, retain the 32-bit constraint.

message(FATAL_ERROR "OpenTS must be built as 32-bit x86. Reconfigure with -A Win32.")
endif()

Expand Down Expand Up @@ -165,7 +165,7 @@ set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/bgfxbackend.cpp" PROPER
"${BGFX_ROOT}/include;${CMAKE_SOURCE_DIR}/thirdparty/bgfx.cmake/bx/include;${BGFX_ROOT}/examples/common/imgui"
COMPILE_DEFINITIONS
"BX_CONFIG_DEBUG=$<IF:$<CONFIG:Debug>,1,$<BOOL:${BX_CONFIG_DEBUG}>>"
COMPILE_OPTIONS "/Zc:preprocessor"
COMPILE_OPTIONS "$<$<BOOL:${MSVC}>:/Zc:preprocessor>"
)

# bx rewrites __stdcall while its headers are being parsed by clang-cl. Force the
Expand Down Expand Up @@ -358,12 +358,14 @@ add_custom_command(TARGET OpenTS POST_BUILD
"${TS_RUN_DIR}"
)

# Copy the linker-generated .pdb alongside the exe
add_custom_command(TARGET OpenTS POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"$<TARGET_PDB_FILE:OpenTS>"
"${TS_RUN_DIR}"
)
# Copy the linker-generated .pdb alongside the exe. Only the MSVC linker writes one.
if(MSVC)
add_custom_command(TARGET OpenTS POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"$<TARGET_PDB_FILE:OpenTS>"
"${TS_RUN_DIR}"
)
endif()

# Copy the linker-generated .map (sits next to the exe, no GenEx for it)
add_custom_command(TARGET OpenTS POST_BUILD
Expand Down
2 changes: 1 addition & 1 deletion code/addon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "ccfile.h"
#include "data.h"
#include "init.h"
#include "language\language.h"
#include "language/language.h"
#include "ownrdraw.h"

BOOL CALLBACK Select_Game_Type_Dialog_Proc(HWND window, UINT message, WPARAM wparam, LPARAM lparam);
Expand Down
2 changes: 1 addition & 1 deletion code/chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "globals.h"
#include "house.h"
#include "ipxmgr.h"
#include "language\language.h"
#include "language/language.h"
#include "rules.h"
#include "session.h"
#include "stimer.h"
Expand Down
2 changes: 1 addition & 1 deletion code/conquer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
#include "init.h"
#include "ipxmgr.h"
#include "keyboard.h"
#include "language\language.h"
#include "language/language.h"
#include "logic.h"
#include "mainloop.h"
#include "movie.h"
Expand Down
2 changes: 1 addition & 1 deletion code/credits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#include "dsurface.h"
#include "globals.h"
#include "house.h"
#include "language\language.h"
#include "language/language.h"
#include "rules.h"
#include "scenario.h"
#include "scheme.h"
Expand Down
2 changes: 1 addition & 1 deletion code/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
#include "inline.h"
#include "isotype.h"
#include "keyboard.h"
#include "language\language.h"
#include "language/language.h"
#include "logic.h"
#include "mixfile.h"
#include "overtype.h"
Expand Down
2 changes: 1 addition & 1 deletion code/dropship.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "house.h"
#include "infatype.h"
#include "keyboard.h"
#include "language\language.h"
#include "language/language.h"
#include "misc.h"
#include "mixfile.h"
#include "mouse.h"
Expand Down
2 changes: 1 addition & 1 deletion code/dsaudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "data.h"
#include "dbgprint.h"
#include "globals.h" // for GameInFocus
#include "language\language.h"
#include "language/language.h"
#include "soscomp.h"
#include "winfix.h"

Expand Down
2 changes: 1 addition & 1 deletion code/egos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
#include "globals.h"
#include "goptions.h"
#include "gscreen.h"
#include "language\language.h"
#include "language/language.h"
#include "misc.h"
#include "ownrdraw.h"
#include "scheme.h"
Expand Down
2 changes: 1 addition & 1 deletion code/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#include "foot.h"
#include "goptions.h"
#include "house.h"
#include "language\language.h"
#include "language/language.h"
#include "mouse.h"
#include "netsemantic.h"
#include "rules.h"
Expand Down
2 changes: 1 addition & 1 deletion code/gamedlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include "dsaudio.h"
#include "globals.h"
#include "init.h"
#include "language\language.h"
#include "language/language.h"
#include "ownrdraw.h"
#include "queue.h"
#include "session.h"
Expand Down
2 changes: 1 addition & 1 deletion code/goptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include "data.h"
#include "dbgprint.h"
#include "gamedlg.h"
#include "language\language.h"
#include "language/language.h"
#include "loaddlg.h"
#include "ownrdraw.h"
#include "queue.h"
Expand Down
2 changes: 1 addition & 1 deletion code/house.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
#include "infatype.h"
#include "inline.h"
#include "ion.h"
#include "language\language.h"
#include "language/language.h"
#include "lightcon.h"
#include "logic.h"
#include "mono.h"
Expand Down
2 changes: 1 addition & 1 deletion code/infantry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
#include "inline.h"
#include "ion.h"
#include "isotype.h"
#include "language\language.h"
#include "language/language.h"
#include "lightcon.h"
#include "mixfile.h"
#include "mono.h"
Expand Down
2 changes: 1 addition & 1 deletion code/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
#include "ionblast.h"
#include "ipxmgr.h"
#include "keyboard.h"
#include "language\language.h"
#include "language/language.h"
#include "laser.h"
#include "light.h"
#include "lightcon.h"
Expand Down
2 changes: 1 addition & 1 deletion code/ion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "globals.h"
#include "gscreen.h"
#include "house.h"
#include "language\language.h"
#include "language/language.h"
#include "laser.h"
#include "lightcon.h"
#include "mixfile.h"
Expand Down
2 changes: 1 addition & 1 deletion code/list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
#include "dialog.h"
#include "dsurface.h"
#include "font.h"
#include "language\language.h"
#include "language/language.h"
#include "scheme.h"
#include "vector.h"
#include "wwmouse.h"
Expand Down
2 changes: 1 addition & 1 deletion code/loaddlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#include "globals.h"
#include "houstype.h"
#include "init.h"
#include "language\language.h"
#include "language/language.h"
#include "msgbox.h"
#include "ownrdraw.h"
#include "saveload.h"
Expand Down
2 changes: 1 addition & 1 deletion code/mainloop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "globals.h"
#include "goptions.h"
#include "ipxmgr.h"
#include "language\language.h"
#include "language/language.h"
#include "logic.h"
#include "misc.h"
#include "mpscore.h"
Expand Down
2 changes: 1 addition & 1 deletion code/mainopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "gamedlg.h"
#include "globals.h"
#include "init.h"
#include "language\language.h"
#include "language/language.h"
#include "misc.h"
#include "video.h"
#include "mixfile.h"
Expand Down
2 changes: 1 addition & 1 deletion code/mapgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "init.h"
#include "inline.h"
#include "isotype.h"
#include "language\language.h"
#include "language/language.h"
#include "netshare.h"
#include "nodes.h"
#include "overtype.h"
Expand Down
2 changes: 1 addition & 1 deletion code/mpscore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "houstype.h"
#include "incdec.h"
#include "keyboard.h"
#include "language\language.h"
#include "language/language.h"
#include "msanim.h"
#include "msengine.h"
#include "msfont.h"
Expand Down
2 changes: 1 addition & 1 deletion code/msgbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#pragma once

#include "language\language.h"
#include "language/language.h"
#include "win.h"

class WWMessageBox
Expand Down
2 changes: 1 addition & 1 deletion code/netdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
#include "globals.h"
#include "houstype.h"
#include "ipxmgr.h"
#include "language\language.h"
#include "language/language.h"
#include "list.h"
#include "queue.h"
#include "rules.h"
Expand Down
2 changes: 1 addition & 1 deletion code/netdlg2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "houstype.h"
#include "init.h"
#include "ipxmgr.h"
#include "language\language.h"
#include "language/language.h"
#include "mapgen.h"
#include "mplayer.h"
#include "msgbox.h"
Expand Down
2 changes: 1 addition & 1 deletion code/netshare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "globals.h"
#include "goptions.h"
#include "ipxmgr.h"
#include "language\language.h"
#include "language/language.h"
#include "lzopipe.h"
#include "lzostraw.h"
#include "mapgen.h"
Expand Down
2 changes: 1 addition & 1 deletion code/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
#include "init.h"
#include "ipxmgr.h"
#include "keyboard.h"
#include "language\language.h"
#include "language/language.h"
#include "mouse.h"
#include "msgbox.h"
#include "ownrdraw.h"
Expand Down
2 changes: 1 addition & 1 deletion code/ownrdraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "goptions.h"
#include "hsv.h"
#include "keyboard.h"
#include "language\language.h"
#include "language/language.h"
#include "mainloop.h"
#include "misc.h"
#include "msgroute.h"
Expand Down
2 changes: 1 addition & 1 deletion code/power.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
#include "draw.h"
#include "globals.h"
#include "house.h"
#include "language\language.h"
#include "language/language.h"
#include "mixfile.h"
#include "savestream.h"
#include "surface.h"
Expand Down
2 changes: 1 addition & 1 deletion code/preview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "cell.h"
#include "dbgprint.h"
#include "dsurface.h"
#include "language\language.h"
#include "language/language.h"
#include "lzopipe.h"
#include "lzostraw.h"
#include "overtype.h"
Expand Down
2 changes: 1 addition & 1 deletion code/progress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "draw.h"
#include "gscreen.h"
#include "init.h"
#include "language\language.h"
#include "language/language.h"
#include "lightcon.h"
#include "mixfile.h"
#include "ownrdraw.h"
Expand Down
2 changes: 1 addition & 1 deletion code/queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
#include "infatype.h"
#include "ipxmgr.h"
#include "keyboard.h"
#include "language\language.h"
#include "language/language.h"
#include "light.h"
#include "mainloop.h"
#include "mono.h"
Expand Down
2 changes: 1 addition & 1 deletion code/radar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
#include "infantry.h"
#include "infatype.h"
#include "init.h"
#include "language\language.h"
#include "language/language.h"
#include "lightcon.h"
#include "mixfile.h"
#include "movies.h"
Expand Down
2 changes: 1 addition & 1 deletion code/restate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "dbgprint.h"
#include "globals.h"
#include "keyboard.h"
#include "language\language.h"
#include "language/language.h"
#include "movie.h"
#include "msanim.h"
#include "msengine.h"
Expand Down
2 changes: 1 addition & 1 deletion code/saveload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
#include "infatype.h"
#include "init.h"
#include "ion.h"
#include "language\language.h"
#include "language/language.h"
#include "loaddlg.h"
#include "light.h"
#include "logic.h"
Expand Down
2 changes: 1 addition & 1 deletion code/scenario.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
#include "ion.h"
#include "ipxmgr.h"
#include "isotype.h"
#include "language\language.h"
#include "language/language.h"
#include "light.h"
#include "logic.h"
#include "mainopt.h"
Expand Down
2 changes: 1 addition & 1 deletion code/score.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
#include "goptions.h"
#include "houstype.h"
#include "keyboard.h"
#include "language\language.h"
#include "language/language.h"
#include "misc.h"
#include "mixfile.h"
#include "movie.h"
Expand Down
Loading