mirror of
https://github.com/izzy2lost/Ghostship.git
synced 2026-06-19 01:17:03 -07:00
Fixed more msvc compile issues ( Debug is broken currently )
This commit is contained in:
+243
@@ -261,6 +261,72 @@ include_directories(
|
||||
${GLEW_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||
"$<$<CONFIG:Debug>:"
|
||||
"_DEBUG;"
|
||||
"_CRT_SECURE_NO_WARNINGS;"
|
||||
"ENABLE_DX11;"
|
||||
">"
|
||||
"$<$<CONFIG:Release>:"
|
||||
"NDEBUG"
|
||||
">"
|
||||
"INCLUDE_GAME_PRINTF;"
|
||||
"UNICODE;"
|
||||
"_UNICODE"
|
||||
STORMLIB_NO_AUTO_LINK
|
||||
"_CRT_SECURE_NO_WARNINGS;"
|
||||
)
|
||||
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||
"$<$<CONFIG:Debug>:"
|
||||
"NOINCLUDE_GAME_PRINTF;"
|
||||
"_DEBUG;"
|
||||
"_CRT_SECURE_NO_WARNINGS;"
|
||||
"ENABLE_OPENGL"
|
||||
">"
|
||||
"$<$<CONFIG:Release>:"
|
||||
"NDEBUG;"
|
||||
">"
|
||||
"INCLUDE_GAME_PRINTF;"
|
||||
"WIN32;"
|
||||
"UNICODE;"
|
||||
"_UNICODE"
|
||||
STORMLIB_NO_AUTO_LINK
|
||||
)
|
||||
endif()
|
||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "CafeOS")
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||
"$<$<CONFIG:Debug>:"
|
||||
"_DEBUG"
|
||||
">"
|
||||
"$<$<CONFIG:Release>:"
|
||||
"NDEBUG"
|
||||
">"
|
||||
"SPDLOG_ACTIVE_LEVEL=3;"
|
||||
"SPDLOG_NO_THREAD_ID;"
|
||||
"SPDLOG_NO_TLS;"
|
||||
"STBI_NO_THREAD_LOCALS;"
|
||||
)
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|AppleClang")
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||
"$<$<CONFIG:Debug>:"
|
||||
"_DEBUG"
|
||||
">"
|
||||
"$<$<CONFIG:Release>:"
|
||||
"NDEBUG"
|
||||
">"
|
||||
"$<$<BOOL:${BUILD_CROWD_CONTROL}>:ENABLE_CROWD_CONTROL>"
|
||||
"SPDLOG_ACTIVE_LEVEL=0;"
|
||||
"_CONSOLE;"
|
||||
"_CRT_SECURE_NO_WARNINGS;"
|
||||
"ENABLE_OPENGL;"
|
||||
"UNICODE;"
|
||||
"_UNICODE"
|
||||
)
|
||||
endif()
|
||||
|
||||
add_subdirectory(libultraship ${CMAKE_CURRENT_SOURCE_DIR}/libultraship)
|
||||
|
||||
add_dependencies(${PROJECT_NAME} libultraship)
|
||||
@@ -271,6 +337,183 @@ if(APPLE)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE SDL2::SDL2)
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
# Compile and link options
|
||||
################################################################################
|
||||
if(MSVC)
|
||||
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||
$<$<CONFIG:Debug>:
|
||||
/w;
|
||||
/Od
|
||||
>
|
||||
$<$<CONFIG:Release>:
|
||||
/Oi;
|
||||
/Gy;
|
||||
/W3
|
||||
>
|
||||
/sdl-;
|
||||
/permissive-;
|
||||
/MP;
|
||||
${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT};
|
||||
${DEFAULT_CXX_EXCEPTION_HANDLING}
|
||||
)
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE $<$<CONFIG:Debug>:/ZI;>)
|
||||
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||
$<$<CONFIG:Debug>:
|
||||
/RTCs
|
||||
>
|
||||
$<$<CONFIG:Release>:
|
||||
/O2;
|
||||
/Oi;
|
||||
/Gy
|
||||
>
|
||||
/permissive-;
|
||||
/MP;
|
||||
/sdl-;
|
||||
/w;
|
||||
${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT};
|
||||
${DEFAULT_CXX_EXCEPTION_HANDLING}
|
||||
)
|
||||
endif()
|
||||
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
|
||||
target_link_options(${PROJECT_NAME} PRIVATE
|
||||
$<$<CONFIG:Debug>:
|
||||
/INCREMENTAL
|
||||
>
|
||||
$<$<CONFIG:Release>:
|
||||
/OPT:REF;
|
||||
/OPT:ICF;
|
||||
/INCREMENTAL:NO;
|
||||
/FORCE:MULTIPLE
|
||||
>
|
||||
/MANIFEST:NO;
|
||||
/DEBUG;
|
||||
/SUBSYSTEM:WINDOWS
|
||||
)
|
||||
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
|
||||
target_link_options(${PROJECT_NAME} PRIVATE
|
||||
$<$<CONFIG:Debug>:
|
||||
/STACK:8777216
|
||||
>
|
||||
$<$<CONFIG:Release>:
|
||||
/OPT:REF;
|
||||
/OPT:ICF;
|
||||
/INCREMENTAL:NO;
|
||||
/FORCE:MULTIPLE
|
||||
>
|
||||
/MANIFEST:NO;
|
||||
/DEBUG;
|
||||
/SUBSYSTEM:WINDOWS
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||
-Wall -Wextra -Wno-error
|
||||
-Wno-return-type
|
||||
-Wno-unused-parameter
|
||||
-Wno-unused-function
|
||||
-Wno-unused-variable
|
||||
-Wno-missing-field-initializers
|
||||
-Wno-parentheses
|
||||
-Wno-narrowing
|
||||
-Wno-missing-braces
|
||||
$<$<COMPILE_LANGUAGE:C>:
|
||||
-Werror-implicit-function-declaration
|
||||
-Wno-incompatible-pointer-types
|
||||
>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-fpermissive>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:
|
||||
-Wno-c++11-narrowing
|
||||
-Wno-deprecated-enum-enum-conversion
|
||||
>
|
||||
-pthread
|
||||
)
|
||||
|
||||
target_link_options(${PROJECT_NAME} PRIVATE
|
||||
-pthread
|
||||
)
|
||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch")
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||
-Wall -Wextra -Wno-error
|
||||
-Wno-return-type
|
||||
-Wno-unused-parameter
|
||||
-Wno-unused-function
|
||||
-Wno-unused-variable
|
||||
-Wno-missing-field-initializers
|
||||
-Wno-parentheses
|
||||
-Wno-narrowing
|
||||
-Wno-missing-braces
|
||||
$<$<COMPILE_LANGUAGE:C>:
|
||||
-Werror-implicit-function-declaration
|
||||
-Wno-incompatible-pointer-types
|
||||
>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-fpermissive>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:
|
||||
-Wno-c++11-narrowing
|
||||
-Wno-deprecated-enum-enum-conversion
|
||||
>
|
||||
-pthread
|
||||
)
|
||||
|
||||
target_link_options(${PROJECT_NAME} PRIVATE
|
||||
-pthread
|
||||
)
|
||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "CafeOS")
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||
-O2
|
||||
|
||||
# disable some warnings to not clutter output
|
||||
-Wno-multichar
|
||||
-Wno-return-type
|
||||
-Wno-narrowing
|
||||
-Wno-switch-outside-range
|
||||
$<$<COMPILE_LANGUAGE:C>:
|
||||
-Werror-implicit-function-declaration
|
||||
-Wno-incompatible-pointer-types
|
||||
-Wno-discarded-array-qualifiers
|
||||
-Wno-discarded-qualifiers
|
||||
-Wno-int-conversion
|
||||
-Wno-builtin-declaration-mismatch
|
||||
-Wno-switch-unreachable
|
||||
-Wno-stringop-overflow
|
||||
>
|
||||
)
|
||||
else()
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
|
||||
set(CPU_OPTION -msse2 -mfpmath=sse)
|
||||
endif()
|
||||
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||
-Wall -Wextra -Wno-error
|
||||
-Wno-unused-parameter
|
||||
-Wno-unused-function
|
||||
-Wno-unused-variable
|
||||
-Wno-missing-field-initializers
|
||||
-Wno-parentheses
|
||||
-Wno-narrowing
|
||||
-Wno-missing-braces
|
||||
$<$<COMPILE_LANGUAGE:C>:
|
||||
-Werror-implicit-function-declaration
|
||||
-Wno-incompatible-pointer-types
|
||||
>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-fpermissive>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-enum-enum-conversion>
|
||||
-pthread
|
||||
${CPU_OPTION}
|
||||
)
|
||||
|
||||
target_link_options(${PROJECT_NAME} PRIVATE
|
||||
-pthread
|
||||
-Wl,-export-dynamic
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#==============================================================================#
|
||||
# Sound File Generation #
|
||||
#==============================================================================#
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#define IS_64_BIT (UINTPTR_MAX == 0xFFFFFFFFFFFFFFFFU)
|
||||
#define IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
||||
|
||||
#if (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)) || defined(__BIG_ENDIAN__)
|
||||
#define IS_BIG_ENDIAN
|
||||
#endif
|
||||
#define DOUBLE_SIZE_ON_64_BIT(size) ((size) * (sizeof(void *) / 4))
|
||||
|
||||
#endif // PLATFORM_INFO_H
|
||||
|
||||
@@ -18,6 +18,11 @@
|
||||
#include <libultra/os.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define bzero(b,len) (memset((b), '\0', (len)), (void) 0)
|
||||
#define bcopy(b1, b2, len) (memmove((b2), (b1), (len)), (void) 0)
|
||||
#endif
|
||||
|
||||
// Crash handler enhancement
|
||||
#ifdef CRASH_SCREEN_INCLUDED
|
||||
#define DEBUG_ASSERT(exp) do { if (!(exp)) _n64_assert(__FILE__, __LINE__, #exp, 1); } while (0)
|
||||
|
||||
@@ -93,7 +93,8 @@
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
typedef size_t ssize_t;
|
||||
#include <BaseTsd.h>
|
||||
typedef SSIZE_T ssize_t;
|
||||
#endif
|
||||
|
||||
struct NotePool;
|
||||
|
||||
@@ -734,12 +734,14 @@ s16 atan2s(f32 y, f32 x) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
/**
|
||||
* Compute the atan2 in radians by calling atan2s and converting the result.
|
||||
*/
|
||||
f32 atan2f(f32 y, f32 x) {
|
||||
return (f32) atan2s(y, x) * M_PI / 0x8000;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define CURVE_BEGIN_1 1
|
||||
#define CURVE_BEGIN_2 2
|
||||
|
||||
@@ -624,9 +624,9 @@ void setup_game_memory(void) {
|
||||
* Main game loop thread. Runs forever as long as the game continues.
|
||||
*/
|
||||
|
||||
struct LevelCommand *addr;
|
||||
static struct LevelCommand *addr;
|
||||
|
||||
void thread5_game_loop() {
|
||||
void thread5_game_loop(void) {
|
||||
|
||||
setup_game_memory();
|
||||
#if ENABLE_RUMBLE
|
||||
|
||||
@@ -50,7 +50,7 @@ extern u16 sRenderingFramebuffer;
|
||||
extern u32 gGlobalTimer;
|
||||
|
||||
void setup_game_memory(void);
|
||||
void thread5_game_loop();
|
||||
void thread5_game_loop(void);
|
||||
void clear_framebuffer(s32 color);
|
||||
void clear_viewport(Vp *viewport, s32 color);
|
||||
void make_viewport_clip_rect(Vp *viewport);
|
||||
|
||||
+5
-1
@@ -8,7 +8,7 @@ extern "C" {
|
||||
#include "game/game_init.h"
|
||||
}
|
||||
|
||||
bool sAudioEnabled = false;
|
||||
bool sAudioEnabled = true;
|
||||
|
||||
void alloc_pool() {
|
||||
static u64 pool[1024 * 1024 * 4];
|
||||
@@ -38,7 +38,11 @@ void push_frame() {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
int SDL_main(int argc, char **argv) {
|
||||
#else
|
||||
int main(){
|
||||
#endif
|
||||
GameEngine::Create();
|
||||
alloc_pool();
|
||||
audio_init();
|
||||
|
||||
@@ -15,7 +15,7 @@ u64 osClockRate = 62500000;
|
||||
|
||||
s8 gShowProfiler = FALSE;
|
||||
s8 gShowDebugText = FALSE;
|
||||
s8 gDebugLevelSelect = TRUE;
|
||||
s8 gDebugLevelSelect = FALSE;
|
||||
|
||||
OSIoMesg gDmaIoMesg;
|
||||
OSMesg gMainReceivedMesg;
|
||||
|
||||
Reference in New Issue
Block a user