Skip to content

Commit

Permalink
added CMake build files and instructions for CMake-based build
Browse files Browse the repository at this point in the history
  • Loading branch information
youbetterdont committed Nov 16, 2019
1 parent 234945f commit 6ddb39c
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
53 changes: 53 additions & 0 deletions BH/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
project(BH)

set(SOURCE_FILES "AsyncDrawBuffer.cpp"
"BH.cpp"
"BitReader.cpp"
"Common.cpp"
"Config.cpp"
"D2Handlers.cpp"
"D2Helpers.cpp"
"D2Intercepts.cpp"
"D2Stubs.cpp"
"D2Version.cpp"
"DllMain.cpp"
"JSONObject.cpp"
"MPQInit.cpp"
"MPQReader.cpp"
"Mustache.cpp"
"Patch.cpp"
"TableReader.cpp"
"Task.cpp")

set(MODULE_SOURCES "Modules/Module.cpp"
"Modules/ModuleManager.cpp"
"Modules/AutoTele/AutoTele.cpp"
"Modules/Bnet/Bnet.cpp"
"Modules/ChatColor/ChatColor.cpp"
"Modules/Gamefilter/Gamefilter.cpp"
"Modules/Item/Item.cpp"
"Modules/Item/ItemDisplay.cpp"
"Modules/ItemMover/ItemMover.cpp"
"Modules/Maphack/Maphack.cpp"
"Modules/Party/Party.cpp"
"Modules/ScreenInfo/ScreenInfo.cpp"
"Modules/StashExport/StashExport.cpp")

set(DRAWING_SOURCES "Drawing/Hook.cpp"
"Drawing/Advanced/Checkhook/Checkhook.cpp"
"Drawing/Advanced/Colorhook/Colorhook.cpp"
"Drawing/Advanced/Combohook/Combohook.cpp"
"Drawing/Advanced/Inputhook/Inputhook.cpp"
"Drawing/Advanced/Keyhook/Keyhook.cpp"
"Drawing/Basic/Boxhook/Boxhook.cpp"
"Drawing/Basic/Crosshook/Crosshook.cpp"
"Drawing/Basic/Framehook/Framehook.cpp"
"Drawing/Basic/Linehook/Linehook.cpp"
"Drawing/Basic/Texthook/Texthook.cpp"
"Drawing/Stats/StatsDisplay.cpp"
"Drawing/UI/UI.cpp"
"Drawing/UI/UITab.cpp")

set(SOURCE_FILES ${SOURCE_FILES} ${MODULE_SOURCES} ${DRAWING_SOURCES})
add_library(BH ${SOURCE_FILES})
target_link_libraries(BH ${STORM_LIBRARY} Shlwapi)
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 3.7)
find_library(STORM_LIBRARY NAMES StormLib HINTS "ThirdParty")
add_subdirectory("BH")
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -590,3 +590,9 @@ Which renders as:
* Chipped Ruby (L1) **x8**

* Flawed Emerald (L1) **x7**

# Building

To build with CMake, first install "Visual Studio Build Tools 2017" and a version of CMake>=3.7. Visual Studio Build Tools comes with a "Developer Command Prompt" that sets up the path with the right compilers and build tools. Next, create a build directory within the project root directory and make it the current working directory. Then, run the command `cmake -G"Visual Studio 15 2017" -DCMAKE_BUILD_SHARED_LIBS=TRUE -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=TRUE ..` (save this command as a bat script if you like). This will create all necessary build files. Next, run `cmake --build . --config Release` to build the project.

To enable multi-processor support when buildling, set the CXXFLAGS environment variable with `set CXXFLAGS=/MP` prior to running the cmake command above.

0 comments on commit 6ddb39c

Please sign in to comment.