Skip to content

Commit

Permalink
Make the beta 4 patch 4 hotfix LunaLua build compilable with Clang
Browse files Browse the repository at this point in the history
  • Loading branch information
Supermario1313 committed Sep 27, 2022
1 parent f2e4725 commit aabf57f
Show file tree
Hide file tree
Showing 84 changed files with 938 additions and 226 deletions.
24 changes: 23 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,26 @@ HardcodedGraphicsData
/LunaLoader-bin.zip
/SMBX-Launcher.zip

*.bak
*.bak

# clangd
compile_commands.json
.cache

# cmake
/CrossCompilation/build/

# Windows SDK
/CrossCompilation/msvc/include/**
/CrossCompilation/msvc/lib/x86/**
/CrossCompilation/winsdk/Include/v7.1A/ucrt/**
/CrossCompilation/winsdk/Include/v7.1A/um/**
/CrossCompilation/winsdk/Lib/v7.1A/ucrt/x86/**
/CrossCompilation/winsdk/Lib/v7.1A/um/x86/**

!/CrossCompilation/msvc/include/.gitkeep
!/CrossCompilation/msvc/lib/x86/.gitkeep
!/CrossCompilation/winsdk/Include/v7.1A/ucrt/.gitkeep
!/CrossCompilation/winsdk/Include/v7.1A/um/.gitkeep
!/CrossCompilation/winsdk/Lib/v7.1A/ucrt/x86/.gitkeep
!/CrossCompilation/winsdk/Lib/v7.1A/um/x86/.gitkeep
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "LunaDll/libs/PGE_File_Formats"]
path = LunaDll/libs/PGE_File_Formats
url = https://github.com/WohlSoft/PGE-File-Library-STL
[submodule "LunaDll/libs/luabind-deboostified"]
path = LunaDll/libs/luabind-deboostified
url = https://github.com/WohlSoft/luabind-deboostified
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required (VERSION 3.7.2)
project(LunaLua C CXX)

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${LunaLua_BINARY_DIR}")
#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${LunaLua_BINARY_DIR}")

if(NOT MSVC)
message(FATAL_ERROR "NON-Microsoft Compilers are not supported right now")
Expand All @@ -12,8 +12,8 @@ if(NOT CMAKE_BUILD_TYPE)
endif()

# /Fd\"Release\\vc140.pdb\"
set(CMAKE_CXX_FLAGS "" CACHE
STRING "compiler flags" FORCE)
#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 +23,8 @@ 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 "" 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 @@ -35,9 +35,9 @@ 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 "/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 "" 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
STRING "compiler flags" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO}" CACHE
STRING "compiler flags" FORCE)
Expand Down
21 changes: 21 additions & 0 deletions CrossCompilation/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Roy van Dam

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
26 changes: 26 additions & 0 deletions CrossCompilation/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.PHONY: all clean

.EXPORT_ALL_VARIABLES:

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

all: LunaDLL.dll

LunaDLL.dll: build/build.ninja
cmake --build build

compile_commands.json: build/build.ninja
cp build/compile_commands.json ..

build/build.ninja:
mkdir -p build
cd build && cmake ../.. -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=$(shell pwd)/clang-cl-msvc.cmake \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1

clean:
rm -rf build
Loading

0 comments on commit aabf57f

Please sign in to comment.