Skip to content

Commit

Permalink
Merge pull request #6 from fintmc/main
Browse files Browse the repository at this point in the history
Fix CMake Support
  • Loading branch information
EvanatorM authored Oct 6, 2024
2 parents 8b26492 + e7dd7d1 commit 117e2c3
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,29 @@ A Minecraft clone made in C++ and OpenGL

## How to Run
To run the game, download the ScuffedMinecraft zip file from the [latest release](https://github.com/EvanatorM/ScuffedMinecraft/releases/latest), unzip the file, and run ScuffedMinecraft.exe. The assets folder must be in the same place as the exe file.

## Building

### Building with Visual Studio
Import the project in Visual Studio 17 or higher and build it.

### Building with CMake
In the project root directory:
Create CMake files:
```sh
mkdir -p build
cd build
cmake ../ScuffedMinecraft
```
After that you can build the project using:
```sh
cmake --build ./build
```
Run the build command in the project root directory.

The final executable can be found at `(project root)/ScuffedMinecraft/bin`

#### Note for building with CMake
If you're running from a command line, make sure to run
the executable in the same directory as it is located
to ensure all resources are loaded properly.
13 changes: 13 additions & 0 deletions ScuffedMinecraft/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@ set(CMAKE_CXX_STANDARD 20)

project(ScuffedMinecraft)

# output directories
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

# copy assets
add_custom_target(copy_assets ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/assets
${CMAKE_BINARY_DIR}/assets
COMMENT "Copying assets")

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

add_subdirectory(vendor/imgui)
Expand Down

0 comments on commit 117e2c3

Please sign in to comment.