Skip to content

Commit

Permalink
add CMakeLists.txt; add 'build/', 'install/' to .gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Dittmann committed May 3, 2022
1 parent 6d56fb4 commit 7a7223e
Show file tree
Hide file tree
Showing 6 changed files with 211 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ x86/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Bb]uild/
[Ii]nstall/
[Oo]bj/
[Ll]og/
[Ll]ogs/
Expand Down
33 changes: 33 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
cmake_minimum_required(VERSION 3.0)
project(UnrealEngineModLoader)

set(CMAKE_CXX_STANDARD 17) # required by i.e. #include <filesystem>
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

# TODO: optimize: avoid restricted default folder "C:/Program Files (x86)/..."
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/install" CACHE FILEPATH "Install path prefix, prependen onto install directories." FORCE)

add_subdirectory(UnrealEngineModLoader)
add_subdirectory(UnrealEngineModLauncher)
add_subdirectory(LoaderAutoInjector) # xinput1_3.dll
add_subdirectory(ExampleMod)

# ADD YOUR MODS HERE
#add_subdirectory(MyMod1)
#add_subdirectory(MyMod2)
# ...

# install
install(FILES "ModLoaderInfo.ini"
DESTINATION $<CONFIG>/Binaries/Win64
)

install(DIRECTORY "Profiles"
DESTINATION $<CONFIG>/Binaries/Win64
)

#if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../WindowsNoEditor/Arise/Content/Paks/pakchunk32-WindowsNoEditor.pak")
# install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../WindowsNoEditor/Arise/Content/Paks/pakchunk32-WindowsNoEditor.pak"
# DESTINATION $<CONFIG>/Content/Paks/LogicMods RENAME MultiplayerMod.pak
# )
#endif()
42 changes: 42 additions & 0 deletions ExampleMod/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# CONFIG: Choose a proper project/target name
project(ExampleMod)

# CONFIG: Set bigobj files (*.cpp) with thousands of functions to export
set(EXAMPLEMOD_BIGOBJ_FILES
# ...
)

# CONFIG: Set other header/source files (*.h/*.hpp/*.cpp) here
set(EXAMPLEMOD_FILES
${EXAMPLEMOD_BIGOBJ_FILES} # bigobj from above are also source code files
../UnrealEngineModLoader/UE4/Basic.cpp
../UnrealEngineModLoader/UE4/CoreUObject_functions.cpp
../UnrealEngineModLoader/UE4/Ue4.hpp
dllmain.cpp
ExampleMod.cpp
ExampleMod.h
)
set_source_files_properties(${EXAMPLEMOD_BIGOBJ_FILES} PROPERTIES COMPILE_OPTIONS "/bigobj")

add_library(${PROJECT_NAME} SHARED ${EXAMPLEMOD_FILES})
target_link_libraries(${PROJECT_NAME} PUBLIC UnrealEngineModLoader)

# definitions
target_compile_definitions(${PROJECT_NAME} PRIVATE _UNICODE)

# includes
# CONFIG: set your include directories here
#target_include_directories(${PROJECT_NAME} PUBLIC PATH_TO_INCLUDE_FOLDER)

# linking
# CONFIG: set folders with libraries here
#target_link_directories(${PROJECT_NAME} PUBLIC YOUR_PATH_TO_LIBRARY)
# CONFIG: set library names only here (no folders)
#target_link_libraries(${PROJECT_NAME} PUBLIC UnrealEngineModLoader YOUR_LIBRARY_NAME)

# install
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION $<CONFIG>/Content/CoreMods
)

install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> DESTINATION $<CONFIG>/Content/CoreMods OPTIONAL)
32 changes: 32 additions & 0 deletions LoaderAutoInjector/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
project(LoaderAutoInjector LANGUAGES CXX ASM_MASM)

set(LOADERAUTOINJECTOR_FILES
Loader/Loader.cpp
Loader/Loader.h
xinput1_3/xinput1_3.cpp
xinput1_3/xinput1_3.def
xinput1_3/xinput1_3_asm.asm
)


add_library(${PROJECT_NAME} SHARED ${LOADERAUTOINJECTOR_FILES})

# change output name from LoaderAutoInjector to xinput1_3
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME xinput1_3)

# definitions
target_compile_definitions(${PROJECT_NAME} PRIVATE LOADERAUTOINJECTOR_EXPORTS _UNICODE) # work-around, 'LoaderAutoInjector_EXPORTS' should be used in source code
target_compile_definitions(${PROJECT_NAME} PUBLIC _USRDLL _CRT_SECURE_NO_WARNINGS)

# includes
target_include_directories(${PROJECT_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../UnrealEngineModLoader
${CMAKE_CURRENT_SOURCE_DIR}
)

# install
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION $<CONFIG>/Binaries/Win64
)

install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> DESTINATION $<CONFIG>/Binaries/Win64 OPTIONAL)
14 changes: 14 additions & 0 deletions UnrealEngineModLauncher/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
project(UnrealEngineModLauncher)

add_executable(${PROJECT_NAME} resource.h UnrealEngineModLauncher.cpp u4mdl_logo_ZfM_icon.ico)
target_sources(${PROJECT_NAME} PRIVATE UnrealEngineModLauncher.rc)

# definitions
target_compile_definitions(${PROJECT_NAME} PRIVATE _UNICODE)

# install
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION $<CONFIG>/Binaries/Win64
)

install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> DESTINATION $<CONFIG>/Binaries/Win64 OPTIONAL)
88 changes: 88 additions & 0 deletions UnrealEngineModLoader/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
project(UnrealEngineModLoader)

set(IMGUI_FILES
ImGui/imconfig.h
ImGui/imgui.cpp
ImGui/imgui.h
ImGui/imgui_demo.cpp
ImGui/imgui_draw.cpp
ImGui/imgui_impl_dx11.cpp
ImGui/imgui_impl_dx11.h
ImGui/imgui_impl_win32.cpp
ImGui/imgui_impl_win32.h
ImGui/imgui_internal.h
ImGui/imgui_tables.cpp
ImGui/imgui_widgets.cpp
ImGui/imstb_rectpack.h
ImGui/imstb_textedit.h
ImGui/imstb_truetype.h
)

set(INI_FILES
INI/INI.h
)

set(MINHOOK_FILES
MinHook/include/MinHook.h
)

set(UE4_FILES
UE4/Basic.cpp
UE4/Basic.hpp
UE4/CoreUObject_classes.hpp
UE4/CoreUObject_functions.cpp
UE4/CoreUObject_parameters.hpp
UE4/CoreUObject_structs.hpp
UE4/Ue4.hpp
)

set(UNREALENGINEMODLOADER_FILES
EventSystem.h
Hooks.cpp
Hooks.h
LoaderUI.cpp
LoaderUI.h
PakLoader.cpp
PakLoader.h
UMLDefs.h
UnrealEngineModLoader/GameInfo/GameInfo.cpp
UnrealEngineModLoader/GameInfo/GameInfo.h
UnrealEngineModLoader/Memory/CoreModLoader.cpp
UnrealEngineModLoader/Memory/CoreModLoader.h
UnrealEngineModLoader/Memory/mem.cpp
UnrealEngineModLoader/Memory/mem.h
UnrealEngineModLoader/Mod/Mod.cpp
UnrealEngineModLoader/Mod/Mod.h
UnrealEngineModLoader/Utilities/Dumper.cpp
UnrealEngineModLoader/Utilities/Dumper.h
UnrealEngineModLoader/Utilities/EngineDefFinder.cpp
UnrealEngineModLoader/Utilities/EngineDefFinder.h
UnrealEngineModLoader/Utilities/Globals.cpp
UnrealEngineModLoader/Utilities/Globals.h
UnrealEngineModLoader/Utilities/Logger.cpp
UnrealEngineModLoader/Utilities/Logger.h
UnrealEngineModLoader/Utilities/MinHook.h
UnrealEngineModLoader/Utilities/Pattern.h
UnrealEngineModLoader/Utilities/Version.h
UnrealEngineModLoader/dllmain.cpp
)


add_library(${PROJECT_NAME} SHARED ${IMGUI_FILES} ${INI_FILES} ${MINHOOK_FILES} ${UE4_FILES} ${UNREALENGINEMODLOADER_FILES})

# definitions
target_compile_definitions(${PROJECT_NAME} PRIVATE UNREALENGINEMODLOADER_EXPORTS _UNICODE) # work-around, 'UnrealEngineModLoader_EXPORTS' should be used in source code
target_compile_definitions(${PROJECT_NAME} PUBLIC _USRDLL _CRT_SECURE_NO_WARNINGS)

target_include_directories(${PROJECT_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/INI
${CMAKE_CURRENT_SOURCE_DIR}/MinHook
${CMAKE_CURRENT_SOURCE_DIR}/UE4
${CMAKE_CURRENT_SOURCE_DIR}/
${CMAKE_CURRENT_SOURCE_DIR}/UnrealEngineModLoader
)

target_link_directories(${PROJECT_NAME} PUBLIC MinHook/lib)
target_link_libraries(${PROJECT_NAME} libMinHook-x64-v141-mtd)

# TODO: install

0 comments on commit 7a7223e

Please sign in to comment.