From 6efedaefa7a9e92417e8beff6b601b38f4777b2d Mon Sep 17 00:00:00 2001 From: Eric Froemling Date: Thu, 3 Jun 2021 12:23:42 -0500 Subject: [PATCH] More work on win compiles --- .efrocachemap | 38 ++++---- ballisticacore-cmake/CMakeLists.txt | 3 + src/ballistica/ballistica.cc | 2 +- src/ballistica/config/config_windows_common.h | 89 +++++++++++++++++++ .../config/config_windows_generic.h | 19 ++++ .../config/config_windows_headless.h | 18 ++++ 6 files changed, 149 insertions(+), 20 deletions(-) create mode 100644 src/ballistica/config/config_windows_common.h create mode 100644 src/ballistica/config/config_windows_generic.h create mode 100644 src/ballistica/config/config_windows_headless.h diff --git a/.efrocachemap b/.efrocachemap index 64bfe1b9..35fa556c 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -3933,27 +3933,27 @@ "assets/build/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/1c/e1/4a1a2eddda2f4aebd5f8b64ab08e", "assets/build/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/50/8d/bc2600ac9491f1b14d659709451f", "ballisticacore-windows/Generic/BallisticaCore.ico": "https://files.ballistica.net/cache/ba1/89/c0/e32c7d2a35dc9aef57cc73b0911a", - "ballisticacore-windows/build/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/c0/40/9fdab51c7fa8fba261618358f928", - "build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/74/f5/cc58a7bcf2e1615e0fa3bd6d5d0d", + "ballisticacore-windows/build/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/45/76/12988204e32839b08a160d08bd84", + "build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/2e/f7/b12845cae61171552b89749ecd57", "build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/74/1d/fc9e33e565475daaac80da5252f0", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2f/01/da01f984477a5c174187a6574b1c", - "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/b9/48/9ebca395c79a78a73d886f2cf79e", - "build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/ae/67/58655e787268082e7e1502d1a787", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/16/0d/63822a96173bf2920c12ab7630c6", + "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/7c/5c/aecdc845e170b39d2a04d1a9f20d", + "build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/2c/6a/3b1b7d66bac496f6a3b019a13758", "build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/9c/7b/ac1a200be0f37078af0991faca3b", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/14/57/c84a61d1fc1696964619dbdee287", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a3/a1/79b409f8281bf8ecb4cca37863b8", - "build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/5b/79/22275b3d5ca8448bfa483f3b9b34", - "build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/a3/90/ff8b627c70adc3d588e3c89d0c15", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c9/2c/82c01a070a2980159d91ec741707", - "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/b9/aa/b7dbcd94a062856664359ff68a6d", - "build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/d7/c0/9a394fdaeab40c66235590de6dba", - "build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/65/24/c3d7e4552caeb825e7be6dd2ac4f", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/dc/45/96900412696ba52e7057951735bf", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2f/61/31fcd63001ff4bfebb9896e8f227", - "build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/61/65/e7811e813273ec28b741a07bbfcf", - "build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/77/f0/b8ebac6ebc3e95592b47f93f6c5c", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/67/37/ae25e8bb39288bf2ad27d2265954", - "build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/41/9c/e8d910d7b498051103143e5ef8c2", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/65/a2/ab7a878985c162e4e98eb62c55e0", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/45/3a/654c7b2e849abdaf42afbafaf175", + "build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/f4/ed/0374312c647056a816b7ce8b6db2", + "build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/f7/f0/4c58353a613a96694b5bbff2991e", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/38/31/dda9f6548c1e69a34fb6863a26c6", + "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/9e/b9/e7629c8f74f949de760475541530", + "build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/5a/f3/7ed03d9ca862fec1a0ad9aa6ba61", + "build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/9b/c1/39884c20fc3c4f1f0a94f8e7fed3", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/65/e0/f9524f6731668303cca3628df795", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/7e/05/7d254ca951f0241406283397cea7", + "build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/84/e9/db6266a9efe6728de54364735682", + "build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/c3/28/a9cce46c8b9ebde12d9b09556d84", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/66/67/14d56e4e90f25734712dbcedd94a", + "build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/78/66/a36de2580256b478e3cbdb11fb7f", "build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/0f/fc/cd29b733f94c767231f5d3e3b49b", "build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b2/bb/dd0a84740970e62169e8690c0906", "build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/72/a8/bdf8597296d539357b344f75082d", diff --git a/ballisticacore-cmake/CMakeLists.txt b/ballisticacore-cmake/CMakeLists.txt index a2e95531..4038233c 100644 --- a/ballisticacore-cmake/CMakeLists.txt +++ b/ballisticacore-cmake/CMakeLists.txt @@ -226,6 +226,9 @@ add_executable(ballisticacore ${BA_SRC_ROOT}/ballistica/ballistica.h ${BA_SRC_ROOT}/ballistica/config/config_cmake.h ${BA_SRC_ROOT}/ballistica/config/config_common.h + ${BA_SRC_ROOT}/ballistica/config/config_windows_common.h + ${BA_SRC_ROOT}/ballistica/config/config_windows_generic.h + ${BA_SRC_ROOT}/ballistica/config/config_windows_headless.h ${BA_SRC_ROOT}/ballistica/core/context.cc ${BA_SRC_ROOT}/ballistica/core/context.h ${BA_SRC_ROOT}/ballistica/core/exception.cc diff --git a/src/ballistica/ballistica.cc b/src/ballistica/ballistica.cc index 23f0008b..0de4d0e0 100644 --- a/src/ballistica/ballistica.cc +++ b/src/ballistica/ballistica.cc @@ -21,7 +21,7 @@ namespace ballistica { // These are set automatically via script; don't modify them here. -const int kAppBuildNumber = 20372; +const int kAppBuildNumber = 20373; const char* kAppVersion = "1.6.4"; // Our standalone globals. diff --git a/src/ballistica/config/config_windows_common.h b/src/ballistica/config/config_windows_common.h new file mode 100644 index 00000000..8ddf1e5a --- /dev/null +++ b/src/ballistica/config/config_windows_common.h @@ -0,0 +1,89 @@ +// Released under the MIT License. See LICENSE for details. + +#ifndef BALLISTICA_CONFIG_CONFIG_WINDOWS_COMMON_H_ +#define BALLISTICA_CONFIG_CONFIG_WINDOWS_COMMON_H_ + +#if _DEBUG +#define BA_DEBUG_BUILD 1 +#endif + +// will need to turn this off eventually.. +#define BA_TEST_BUILD 1 + +#ifndef M_PI +#define M_PI (3.1415926536f) +#endif + +// disable warnings about strcpy/fopen/etc being unsafe +#define _CRT_SECURE_NO_WARNINGS + +// Windows defines min/max macros which screw up the ability +// to use std::min and std::max. Don't want. +#define NOMINMAX + +// Disable warnings about converting double to float, etc. +// 4068: Don't warn on unrecognized pragmas +#pragma warning(disable : 4800 4244 4355 4305 4068) + +// Map gcc's __PRETTY_FUNCTION__ macro to the closest thing VC has +#define __PRETTY_FUNCTION__ __FUNCSIG__ + +#include "targetver.h" // NOLINT + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +#define BA_PLATFORM_STRING "x86_windows" +#define BA_OSTYPE_WINDOWS 1 + +#define BA_SOCKET_SEND_DATA_TYPE char +#define BA_SOCKET_SEND_LENGTH_TYPE int +#define BA_SOCKET_SETSOCKOPT_VAL_TYPE char + +// Make ssize_t available (copy/paste from mMinGW) +#ifdef _MSC_VER +#ifndef _SSIZE_T_DEFINED +#define _SSIZE_T_DEFINED +#undef ssize_t +#ifdef _WIN64 +typedef __int64 ssize_t; +#else +typedef int ssize_t; +#endif /* _WIN64 */ +#endif /* _SSIZE_T_DEFINED */ +#endif /* _MSC_VER */ + +#define BA_STAT _stat + +// Some ODE stuff. +#define dTRIMESH_ENABLED 1 +#define PENTIUM 1 +#if !BA_DEBUG_BUILD +#define dNODEBUG 1 +#endif + +#if !BA_HEADLESS_BUILD +#define BA_ENABLE_AUDIO 1 +#define BA_ENABLE_OPENGL 1 +#endif + +// We want main() by default. +// In our SDL builds, main is #defined as SDL_main which is called +// by SDLMain.lib regardless if whether we're built as a console or gui app. + +#ifndef BA_DEFINE_MAIN +#define BA_DEFINE_MAIN 1 +#endif + +// By default we run as a console-mode app which conveniently exposes our +// python interpreter. +#ifndef BA_WINDOWS_CONSOLE_BUILD +#define BA_WINDOWS_CONSOLE_BUILD 1 +#endif + +// Include some common stuff for our precompiled header. +#include +#include + +#include + +#endif // BALLISTICA_CONFIG_CONFIG_WINDOWS_COMMON_H_ diff --git a/src/ballistica/config/config_windows_generic.h b/src/ballistica/config/config_windows_generic.h new file mode 100644 index 00000000..da1b56ee --- /dev/null +++ b/src/ballistica/config/config_windows_generic.h @@ -0,0 +1,19 @@ +// Released under the MIT License. See LICENSE for details. + +#ifndef BALLISTICA_CONFIG_CONFIG_WINDOWS_GENERIC_H_ +#define BALLISTICA_CONFIG_CONFIG_WINDOWS_GENERIC_H_ + +// note: define overrides BEFORE common makefile + +#define BA_USE_STDIN_THREAD 1 + +#define BA_SDL_BUILD 1 +#define BA_SDL2_BUILD 1 +#define BA_ENABLE_SDL_JOYSTICKS 1 + +#include "ballistica/config/config_windows_common.h" + +// This must always be last. +#include "ballistica/config/config_common.h" + +#endif // BALLISTICA_CONFIG_CONFIG_WINDOWS_GENERIC_H_ diff --git a/src/ballistica/config/config_windows_headless.h b/src/ballistica/config/config_windows_headless.h new file mode 100644 index 00000000..cc98856d --- /dev/null +++ b/src/ballistica/config/config_windows_headless.h @@ -0,0 +1,18 @@ +// Released under the MIT License. See LICENSE for details. + +#ifndef BALLISTICA_CONFIG_CONFIG_WINDOWS_HEADLESS_H_ +#define BALLISTICA_CONFIG_CONFIG_WINDOWS_HEADLESS_H_ + +// note: define overrides BEFORE common header +#define BA_HEADLESS_BUILD 1 + +#define BA_USE_STDIN_THREAD 1 + +#define BA_MINSDL_BUILD 1 + +#include "ballistica/config/config_windows_common.h" + +// This must always be last. +#include "ballistica/config/config_common.h" + +#endif // BALLISTICA_CONFIG_CONFIG_WINDOWS_HEADLESS_H_