Skip to content

Commit

Permalink
Improvements for building umodel with vs2015+ (using UCRT headers etc…
Browse files Browse the repository at this point in the history
…) with OLDCRT=1

- added _NO_CRT_STDIO_INLINE to prevent using new UCRT printf functions
- added operator delete(void*, size_t) which is always used with alignment 1 instead of operator delete(void*)
  • Loading branch information
gildor2 committed Apr 15, 2019
1 parent 4fe2575 commit d1df0f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions Core/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,12 @@ FORCEINLINE void operator delete(void* ptr)
appFree(ptr);
}

// C++17 (delete with alignment)
FORCEINLINE void operator delete(void* ptr, size_t)
{
appFree(ptr);
}

FORCEINLINE void operator delete[](void* ptr)
{
appFree(ptr);
Expand Down
9 changes: 6 additions & 3 deletions common.project
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ OLDCRT = 1 # OLDCRT=0 is required for VS2015+ (TODO: try to fix that)
# Compiler-specific options
#------------------------------------------------

STDDEFS = # common defines
WARNINGS = # warnings for our source code (i.e. excluding thirs-parties), empty by default

!if "$COMPILER" eq "VisualC"
Expand All @@ -29,7 +30,8 @@ WARNINGS = # warnings for our source code (i.e. excluding thirs-parties), e
# WARNINGS += -W4 # maximal warning level for Visual C++
WDKCRT = $R/../Libs/msvcrt
!if "$OLDCRT" eq "1" && -e "$WDKCRT/msvcrt.project"
DEFINES += OLDCRT
STDDEFS += OLDCRT # used in code to distinguish which functions are available
STDDEFS += _NO_CRT_STDIO_INLINE # UCRT (VS 2015+): without that, all printf functions will use some "common" function
!include $WDKCRT/msvcrt.project
!endif
LINKFLAGS += -largeaddressaware # allow 32-bit build to use more than 2Gb or RAM
Expand Down Expand Up @@ -61,6 +63,7 @@ WARNINGS = # warnings for our source code (i.e. excluding thirs-parties), e
!endif


DEFINES = $STDDEFS
#OPTIONS += -analyze

#------------------------------------------------
Expand Down Expand Up @@ -90,7 +93,7 @@ pop(INCLUDES)
push(DEFINES)
push(INCLUDES)

DEFINES = DYNAMIC_CRC_TABLE BUILDFIXED NO_GZIP
DEFINES = $STDDEFS DYNAMIC_CRC_TABLE BUILDFIXED NO_GZIP
INCLUDES = $R/libs/include

sources(UE3_LIBS) = {
Expand All @@ -107,7 +110,7 @@ sources(UE3_LIBS) = {

# ... PNG for compressed source textures
INCLUDES += $R/libs/zlib
DEFINES = PNG_USER_CONFIG
DEFINES = $STDDEFS PNG_USER_CONFIG
sources(UE3_LIBS) = {
$R/libs/libpng/*.c
}
Expand Down

0 comments on commit d1df0f6

Please sign in to comment.