Skip to content

Commit

Permalink
Removed/changed comments and debug stuff and improved Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Supermario1313 committed Oct 2, 2022
1 parent bc9d483 commit 96b7f11
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 56 deletions.
13 changes: 2 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
cmake_minimum_required (VERSION 3.7.2)
project(LunaLua C CXX)

#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${LunaLua_BINARY_DIR}")

if(NOT MSVC)
message(FATAL_ERROR "NON-Microsoft Compilers are not supported right now")
endif()
Expand All @@ -11,9 +9,7 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
endif()

# /Fd\"Release\\vc140.pdb\"
#set(CMAKE_CXX_FLAGS "" CACHE
# STRING "compiler flags" FORCE)

set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Zi /Gm- /O2 /Zc:inline /fp:precise /errorReport:prompt /WX- /Zc:forScope /Gd /Oy- /Oi /MT /EHsc /nologo /FAcs /Ot" CACHE
STRING "compiler flags" FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" CACHE
Expand All @@ -23,8 +19,6 @@ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" CACHE
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" CACHE
STRING "compiler flags" FORCE)

#set(CMAKE_C_FLAGS "" CACHE
# STRING "compiler flags" FORCE)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/Zi /Gm- /O2 /Zc:inline /fp:precise /errorReport:prompt /WX- /Zc:forScope /Gd /Oy- /Oi /MT /EHsc /nologo /FAcs /Ot" CACHE
STRING "compiler flags" FORCE)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_RELWITHDEBINFO}" CACHE
Expand All @@ -34,10 +28,7 @@ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELWITHDEBINFO}" CACHE
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_RELWITHDEBINFO}" CACHE
STRING "compiler flags" FORCE)

# /PDB:"C:\Repos\LunaLUA\Release\LunaDll.pdb"
#set(CMAKE_SHARED_LINKER_FLAGS "" CACHE
# STRING "compiler flags" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "/VERBOSE /NXCOMPAT /DYNAMICBASE /MAPINFO:EXPORTS /DEBUG /DLL /MACHINE:X86 /OPT:REF /SAFESEH:NO /INCREMENTAL:NO /SUBSYSTEM:WINDOWS\",5.01\" /MANIFESTUAC:\"level='asInvoker' uiAccess='false'\" /MAP /OPT:ICF /ERRORREPORT:PROMPT /NOLOGO /TLBID:1" CACHE
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "/NXCOMPAT /DYNAMICBASE /MAPINFO:EXPORTS /DEBUG /DLL /MACHINE:X86 /OPT:REF /SAFESEH:NO /INCREMENTAL:NO /SUBSYSTEM:WINDOWS\",5.01\" /MANIFESTUAC:\"level='asInvoker' uiAccess='false'\" /MAP /OPT:ICF /ERRORREPORT:PROMPT /NOLOGO /TLBID:1" CACHE
STRING "compiler flags" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO}" CACHE
STRING "compiler flags" FORCE)
Expand Down
18 changes: 9 additions & 9 deletions CrossCompilation/Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
.PHONY: all clean

.EXPORT_ALL_VARIABLES:
CURRENT_FOLDER = $(shell pwd)
export MSVC_BASE = $(CURRENT_FOLDER)/msvc
export WINSDK_BASE = $(CURRENT_FOLDER)/winsdk
export WINSDK_VER = v7.1A
export HOST_ARCH = x86
export MSVC_VER = 1900

MSVC_BASE = $(shell pwd)/msvc
WINSDK_BASE = $(shell pwd)/winsdk
WINSDK_VER = v7.1A
HOST_ARCH = x86
MSVC_VER = 1900

all: LunaDLL.dll
all: compile_commands.json LunaDLL.dll

LunaDLL.dll: build/build.ninja
cmake --build build
Expand All @@ -19,8 +18,9 @@ compile_commands.json: build/build.ninja
build/build.ninja:
mkdir -p build
cd build && cmake ../.. -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=$(shell pwd)/clang-cl-msvc.cmake \
-DCMAKE_TOOLCHAIN_FILE=$(CURRENT_FOLDER)/clang-cl-msvc.cmake \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1

clean:
rm -rf build
rm ../compile_commands.json
1 change: 0 additions & 1 deletion LunaDll/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ target_link_libraries(LunaLuaLibShared
odbccp32
winmm
shlwapi
#libluabind
lua51
dbghelp
ws2_32
Expand Down
2 changes: 1 addition & 1 deletion LunaDll/Misc/ErrorReporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void ErrorReport::SnapshotError(EXCEPTION_RECORD* exception, CONTEXT* context)
fullErrorDescription << "== Crash Summary ==\n";
fullErrorDescription << "LunaLua Version: " + std::string(LUNALUA_VERSION) + "\n";
#ifdef __clang__
fullErrorDescription << "This LunaLua build has been compiled with Clang. Clang support is still experimental so errors might happen.\n";
fullErrorDescription << "This LunaLua build has been compiled with Clang. Support for this compiler is still experimental so errors might happen.\n";
#endif
fullErrorDescription << "Exception Code: 0x" << std::hex << exception->ExceptionCode;

Expand Down
36 changes: 2 additions & 34 deletions LunaDll/Misc/RuntimeHook.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,20 +187,6 @@ _declspec(naked) static void __stdcall _RenderBelowPriorityHookImpl() {

"call %P[getRenderer]\n" // Pointer to the renderer is put in eax
"mov ecx, eax\n" // The pointer to this is stored in ecx in the __thiscall convention

/*
".if %c[priorityAbove100]\n"
"push 0x7FEFFFFF\n" // Push most significant dword of DBL_MAX
"push 0xFFFFFFFF\n" // Push least significant dword of DBL_MAX
".else\n"
"push eax\n" // Allocate the first 4 bytes on the stack for the priority argument of Renderer::RenderBelowPriority, the next four bytes will be allocated by push priority.
// The following 3 instructions are for converting priority to a dfloat.
"push %c[priorityValue]\n"
"fild dword ptr [esp]\n"
"fstp qword ptr [esp]\n"
".endif\n"
*/

"push %c[PriorityMostSignificantDWord]\n" // Push most significant dword of priority
"push %c[PriorityLeastSignificantDWord]\n" // Push least significant dword of priority
Expand All @@ -214,9 +200,7 @@ _declspec(naked) static void __stdcall _RenderBelowPriorityHookImpl() {
"ret\n"
".att_syntax\n"
:
: //[priorityAbove100] "i" (priority >= 100),
//[priorityValue] "i" (priority),
[PriorityMostSignificantDWord] "i" (DoubleMostSignificantDWord(priority >= 100 ? DBL_MAX : priority)),
: [PriorityMostSignificantDWord] "i" (DoubleMostSignificantDWord(priority >= 100 ? DBL_MAX : priority)),
[PriorityLeastSignificantDWord] "i" (DoubleLeastSignificantDWord(priority >= 100 ? DBL_MAX : priority)),
[getRenderer] "i" (&Renderer::Get),
[RenderBelowPriority] "i" (&Renderer::RenderBelowPriority)
Expand Down Expand Up @@ -258,20 +242,6 @@ _declspec(naked) static void __stdcall _RenderBelowPriorityHookWithSkipImpl() {
"call %P[getRenderer]\n" // Pointer to the renderer is put in eax
"mov ecx, eax\n" // The pointer to this is stored in ecx in the __thiscall convention

/*
".if %c[priorityAbove100]\n"
"push 0x7FEFFFFF\n" // Push most significant dword of DBL_MAX
"push 0xFFFFFFFF\n" // Push least significant dword of DBL_MAX
".else\n"
"push eax\n" // Allocate the first 4 bytes on the stack for the priority argument of Renderer::RenderBelowPriority, the next four bytes will be allocated by push priority.
// The following 3 instructions are for converting priority to a dfloat.
"push %c[priorityValue]\n"
"fild dword ptr [esp]\n"
"fstp qword ptr [esp]\n"
".endif\n"
*/

"push %c[PriorityMostSignificantDWord]\n" // Push most significant dword of priority
"push %c[PriorityLeastSignificantDWord]\n" // Push least significant dword of priority

Expand All @@ -289,9 +259,7 @@ _declspec(naked) static void __stdcall _RenderBelowPriorityHookWithSkipImpl() {
"ret\n"
".att_syntax\n"
:
: //[priorityAbove100] "i" (priority >= 100),
//[priorityValue] "i" (priority),
[PriorityMostSignificantDWord] "i" (DoubleMostSignificantDWord(priority >= 100 ? DBL_MAX : priority)),
: [PriorityMostSignificantDWord] "i" (DoubleMostSignificantDWord(priority >= 100 ? DBL_MAX : priority)),
[PriorityLeastSignificantDWord] "i" (DoubleLeastSignificantDWord(priority >= 100 ? DBL_MAX : priority)),
[skipTargetAddrValue] "i" (skipTargetAddr),
[skipAddrValue] "i" (skipAddr),
Expand Down

0 comments on commit 96b7f11

Please sign in to comment.