11cmake_minimum_required (VERSION 3.16.0 FATAL_ERROR )
22
33# Set the project version and language
4- project (Ghostship VERSION 1.0.1 LANGUAGES C CXX ASM )
4+ project (Ghostship VERSION 1.0.2 LANGUAGES C CXX ASM )
55include (FetchContent )
66
77include (cmake/ghostship-cvars.cmake )
@@ -137,9 +137,9 @@ set(CMAKE_CXX_FLAGS_DEBUG "-g -ffast-math -DDEBUG")
137137set (CMAKE_C_FLAGS_RELEASE "-O3 -ffast-math -DNDEBUG" )
138138set (CMAKE_CXX_FLAGS_RELEASE "-O3 -ffast-math -DNDEBUG" )
139139else ()
140- set (CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG" )
141- set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG" )
142- set (CMAKE_OBJCXX_FLAGS_RELEASE "-O2 -DNDEBUG" )
140+ set (CMAKE_C_FLAGS_RELEASE "-O1 -DNDEBUG" )
141+ set (CMAKE_CXX_FLAGS_RELEASE "-O1 -DNDEBUG" )
142+ set (CMAKE_OBJCXX_FLAGS_RELEASE "-O1 -DNDEBUG" )
143143endif ()
144144
145145# Set game compilation version
@@ -153,6 +153,7 @@ add_compile_definitions(
153153 ENABLE_RUMBLE=1
154154 F3D_OLD=1
155155 F3D_GBI=1
156+ USE_GBI_TRACE=1
156157 GBI_FLOATS=1
157158 _LANGUAGE_C
158159 _USE_MATH_DEFINES
@@ -426,75 +427,44 @@ endif()
426427# Compile and link options
427428################################################################################
428429if (MSVC )
429- if ("${CMAKE_VS_PLATFORM_NAME} " STREQUAL "x64" )
430- target_compile_options (${PROJECT_NAME } PRIVATE
431- $<$<CONFIG :Debug >:
432- /w ;
433- /Od ;
434- /MTd
435- >
436- $<$<CONFIG :Release >:
437- /Oi ;
438- /Gy ;
439- /W3 ;
440- /MT
441- >
442- /permissive-;
443- /MP;
444- ${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT} ;
445- ${DEFAULT_CXX_EXCEPTION_HANDLING}
446- )
447- target_compile_options (${PROJECT_NAME } PRIVATE $<$<CONFIG :Debug >:/ZI ;>)
448- target_compile_options (${PROJECT_NAME } PRIVATE $<$<CONFIG :Release >:/Zi ;>)
449- elseif ("${CMAKE_VS_PLATFORM_NAME} " STREQUAL "Win32" )
450- target_compile_options (${PROJECT_NAME } PRIVATE
451- $<$<CONFIG :Debug >:
452- /MTd
453- >
454- $<$<CONFIG :Release >:
455- /O2 ;
456- /Oi ;
457- /Gy ;
458- /MT
459- >
460- /permissive-;
461- /MP;
462- /w;
463- ${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT} ;
464- ${DEFAULT_CXX_EXCEPTION_HANDLING}
465- )
466- endif ()
467- if ("${CMAKE_VS_PLATFORM_NAME} " STREQUAL "x64" )
468- target_link_options (${PROJECT_NAME } PRIVATE
469- $<$<CONFIG :Debug >:
470- /INCREMENTAL
471- >
472- $<$<CONFIG :Release >:
473- /OPT :REF ;
474- /OPT :ICF ;
475- /INCREMENTAL :NO ;
476- /FORCE :MULTIPLE
477- >
478- /MANIFEST:NO;
479- /DEBUG;
480- /SUBSYSTEM:WINDOWS
481- )
482- elseif ("${CMAKE_VS_PLATFORM_NAME} " STREQUAL "Win32" )
483- target_link_options (${PROJECT_NAME } PRIVATE
484- $<$<CONFIG :Debug >:
485- /STACK :8777216
486- >
487- $<$<CONFIG :Release >:
488- /OPT :REF ;
489- /OPT :ICF ;
490- /INCREMENTAL :NO ;
491- /FORCE :MULTIPLE
492- >
493- /MANIFEST:NO;
494- /DEBUG;
495- /SUBSYSTEM:WINDOWS
496- )
497- endif ()
430+ target_compile_options (${PROJECT_NAME } PRIVATE
431+ $<$<CONFIG :Debug >:
432+ /w ;
433+ /Od
434+ >
435+ $<$<CONFIG :Release >:
436+ /Oi ;
437+ /Gy ;
438+ /W3
439+ >
440+
441+ /wd4024 #different types for formal and actual parameter [x]. Usually seen along side 4047.
442+ /wd4047 #'uintptr_t' differs in levels of indirection from 'Gfx *'. Usually caused by passing a uintptr_t into a function expecting a pointer-types
443+ /wd4090 #'initializing': different 'const' qualifiers. Caused when initializing a non const struct member with a const char*.
444+ /wd4101 # unreferenced local variable. Things like stack pads.
445+ /wd4133 #incompatible types. Usually caused by passing a c string into a function that takes a pointer.
446+ /wd4244 #conversion from [a] to [b]. Used to warn when copying to smaller type without a cast.
447+ /sdl-;
448+ /permissive-;
449+ /MP;
450+ ${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT} ;
451+ ${DEFAULT_CXX_EXCEPTION_HANDLING}
452+ )
453+ target_compile_options (${PROJECT_NAME } PRIVATE $<$<CONFIG :Debug >:/ZI ;>)
454+ target_link_options (${PROJECT_NAME } PRIVATE
455+ $<$<CONFIG :Debug >:
456+ /INCREMENTAL
457+ >
458+ $<$<CONFIG :Release >:
459+ /OPT :REF ;
460+ /OPT :ICF ;
461+ /INCREMENTAL :NO ;
462+ /FORCE :MULTIPLE
463+ >
464+ /MANIFEST:NO;
465+ /DEBUG;
466+ /SUBSYSTEM:WINDOWS
467+ )
498468
499469 # Remove /RTC from msvc flags
500470 foreach (fentry
@@ -662,6 +632,11 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
662632 install (FILES "${CMAKE_BINARY_DIR } /config.yml" DESTINATION . COMPONENT ${PROJECT_NAME } )
663633endif ()
664634
635+ if ("${CMAKE_SYSTEM_NAME } " STREQUAL "Windows" )
636+ install (FILES $<TARGET_PDB_FILE :${PROJECT_NAME } > DESTINATION ./debug COMPONENT ${PROJECT_NAME } )
637+ install (FILES "${CMAKE_BINARY_DIR } /ghostship.o2r" DESTINATION . COMPONENT ${PROJECT_NAME } )
638+ endif ()
639+
665640if (CMAKE_SYSTEM_NAME MATCHES "Darwin" )
666641add_custom_target (CreateOSXIcons
667642 COMMAND mkdir -p ${CMAKE_BINARY_DIR } /macosx/ghostship.iconset
0 commit comments