Added cmake support (#11)
* Update README.md * added submodules * moved submodules to release tag * fix include for fixed width integer * added cmake support and build instruction * Update README.md * fix cmake links * upd CMakeLists.txt
This commit is contained in:
parent
d535c74f6d
commit
30ad8385c9
3
.gitignore
vendored
3
.gitignore
vendored
@ -3,10 +3,13 @@ Debug/src/**/*.o
|
||||
|
||||
Debug/voxel_engine
|
||||
|
||||
build
|
||||
|
||||
world
|
||||
|
||||
.vscode
|
||||
|
||||
.cache
|
||||
.settings
|
||||
.cproject
|
||||
.project
|
||||
|
||||
6
.gitmodules
vendored
Normal file
6
.gitmodules
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
[submodule "libs/glm"]
|
||||
path = libs/glm
|
||||
url = https://github.com/g-truc/glm.git
|
||||
[submodule "libs/glfw"]
|
||||
path = libs/glfw
|
||||
url = https://github.com/glfw/glfw.git
|
||||
35
CMakeLists.txt
Normal file
35
CMakeLists.txt
Normal file
@ -0,0 +1,35 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(VoxelEngine)
|
||||
|
||||
file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp)
|
||||
file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${HEADERS} ${SOURCES})
|
||||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
|
||||
|
||||
option(VE_USE_SYSTEM_LIBS "Use system installed libraries" ON)
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(GLEW REQUIRED)
|
||||
find_package(OpenAL REQUIRED)
|
||||
find_package(PNG REQUIRED)
|
||||
|
||||
set(LIBS "")
|
||||
if(NOT VE_USE_SYSTEM_LIBS)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libs/glfw)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libs/glm)
|
||||
set(LIBS glm)
|
||||
else()
|
||||
find_package(glfw3 REQUIRED)
|
||||
find_package(glm REQUIRED)
|
||||
endif(NOT VE_USE_SYSTEM_LIBS)
|
||||
|
||||
if(UNIX)
|
||||
find_package(Threads REQUIRED)
|
||||
set(LIBS ${LIBS} Threads::Threads)
|
||||
endif(UNIX)
|
||||
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} ${LIBS} glfw OpenGL::GL ${OPENAL_LIBRARY} GLEW::GLEW PNG::PNG)
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/res DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/build)
|
||||
16
README.md
16
README.md
@ -12,6 +12,16 @@
|
||||
|
||||
`$ ./voxel_engine`
|
||||
|
||||
#### Build with CMake
|
||||
```sh
|
||||
git clone --recursive https://github.com/MihailRis/VoxelEngine-Cpp.git
|
||||
cd VoxelEngine-Cpp
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ../
|
||||
cmake --build .
|
||||
```
|
||||
|
||||
## Instal libs:
|
||||
#### Debian-based distro:
|
||||
`$ sudo apt install libglfw3-dev libglfw3 libglew-dev libglm-dev libpng-dev libopenal-dev`
|
||||
@ -19,6 +29,12 @@
|
||||
#### RHEL-based distro:
|
||||
`$ sudo dnf install glfw-devel glfw glew-devel glm-devel libpng-devel openal-devel`
|
||||
|
||||
#### Arch-based distro:
|
||||
If you use X11
|
||||
`$ sudo pacman -S glfw-x11 glew glm libpng openal`
|
||||
|
||||
If you use Wayland
|
||||
`$ sudo pacman -S glfw-wayland glew glm libpng openal`
|
||||
|
||||
# Note for MinGW compiling:
|
||||
To fix problem with `#include <mingw.thread.h>` get headers `mingw.thread.h` and `mingw.invoke.h` from:
|
||||
|
||||
1
libs/glfw
Submodule
1
libs/glfw
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 7482de6071d21db77a7236155da44c172a7f6c9e
|
||||
1
libs/glm
Submodule
1
libs/glm
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit bf71a834948186f4097caa076cd2663c69a10e1e
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <cstdint>
|
||||
|
||||
#include <AL/al.h>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user