Skip to content

Commit

Permalink
Merge branch 'release/1.6.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
Bam4d committed Dec 31, 2022
2 parents 8a05644 + dc1510f commit 8085a94
Show file tree
Hide file tree
Showing 29 changed files with 422 additions and 235 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. mac/linux/windows]
- Version [e.g. 1.6.3]
- Version [e.g. 1.6.4]

**Additional context**
Add any other context about the problem here.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,7 @@ test-output.xml
**/cmake-build*

python/testdir/
.cmake/
griddlyConfig.cmake
griddlyConfigVersion.cmake

104 changes: 38 additions & 66 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.18.0)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version")
project(Griddly VERSION 1.6.3)
project(Griddly VERSION 1.6.4)

string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWERCASE)

Expand Down Expand Up @@ -40,12 +40,6 @@ set(GRIDDLY_TEST_SRC_DIR ${GRIDDLY_TEST_DIR}/src)
# project resources folder (e.g. map files, shaders, configs etc.)
set(GRIDDLY_RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/resources)

# the dependency folder specifying all required libs for conan
set(GRIDDLY_DEPS_DIR deps)

# The dependencies to load by Conan are in this file
set(CONANFILE conanfile.txt)

option(BUILD_SHARED_LIBS "Enable compilation of shared libraries" OFF)
option(ENABLE_CACHE "Enable cache if available" ON)
option(ENABLE_CLANG_TIDY "Enable static analysis with clang-tidy" OFF)
Expand All @@ -62,6 +56,7 @@ option(ENABLE_SANITIZER_UNDEFINED_BEHAVIOR "Enable undefined behavior sanitizer"
option(ENABLE_PYTHON_BINDINGS "Enable to build the bindings to other languages." ON)
option(ENABLE_TESTING "Enable Test Builds" ON)
option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" OFF)
option(WASM "Enable Web-assembly build" OFF)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIR})
Expand All @@ -75,13 +70,10 @@ add_library(project_warnings INTERFACE)

message(STATUS ${CMAKE_SYSTEM_NAME})

if(${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
set(WASM ON)
if(WASM)
message(STATUS "Compiling for webassembly using emscripten")
target_compile_definitions(project_options INTERFACE "-DWASM")
target_compile_options(project_options INTERFACE "-fexceptions")
else()
set(WASM OFF)
endif()

if(MSVC)
Expand Down Expand Up @@ -127,58 +119,38 @@ enable_sanitizers(project_options)
include(${CMAKE_CONFIG_FOLDER}/settings/StaticAnalyzers.cmake)

include(${CMAKE_CONFIG_FOLDER}/settings/Conan.cmake)
run_conan()
include(${PROJECT_BINARY_DIR}/conanbuildinfo.cmake)
include(${PROJECT_BINARY_DIR}/conan_paths.cmake)

# find the dependencies from conan
set(PYBIND11_FINDPYTHON FALSE)

# set(Python_ROOT_DIR /opt/python/$ENV{PYBIN})
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
message(STATUS "PYTHON INFO::")
message(STATUS "Python_FOUND = ${Python_FOUND}")
message(STATUS "Python_ROOT_DIR = ${Python_ROOT_DIR}")
message(STATUS "Python_Interpreter_FOUND = ${Python_Interpreter_FOUND}")
message(STATUS "Python_EXECUTABLE = ${Python_EXECUTABLE}")
message(STATUS "Python_INTERPRETER_ID = ${Python_INTERPRETER_ID}")
message(STATUS "Python_STDLIB = ${Python_STDLIB}")
message(STATUS "Python_STDARCH = ${Python_STDARCH}")
message(STATUS "Python_SITELIB = ${Python_SITELIB}")
message(STATUS "Python_SITEARCH = ${Python_SITEARCH}")
message(STATUS "Python_SOABI = ${Python_SOABI}")
message(STATUS "Python_Compiler_FOUND = ${Python_Compiler_FOUND}")
message(STATUS "Python_COMPILER = ${Python_COMPILER}")
message(STATUS "Python_COMPILER_ID = ${Python_COMPILER_ID}")
message(STATUS "Python_DOTNET_LAUNCHER = ${Python_DOTNET_LAUNCHER}")
message(STATUS "Python_Development_FOUND = ${Python_Development_FOUND}")
message(STATUS "Python_Development.Module_FOUND = ${Python_Development.Module_FOUND}")
message(STATUS "Python_Development.Embed_FOUND = ${Python_Development.Embed_FOUND}")
message(STATUS "Python_INCLUDE_DIRS = ${Python_INCLUDE_DIRS}")
message(STATUS "Python_LINK_OPTIONS = ${Python_LINK_OPTIONS}")
message(STATUS "Python_LIBRARIES = ${Python_LIBRARIES}")
message(STATUS "Python_LIBRARY_DIRS = ${Python_LIBRARY_DIRS}")
message(STATUS "Python_RUNTIME_LIBRARY_DIRS = ${Python_RUNTIME_LIBRARY_DIRS}")
message(STATUS "Python_VERSION = ${Python_VERSION}")

# pybind11
find_package(pybind11 REQUIRED)

# glm
find_package(glm REQUIRED)

# Yaml-Cpp
find_package(yaml-cpp REQUIRED)

# stb
find_package(stb REQUIRED)
# spdlog
find_package(spdlog REQUIRED)

# Vulkan
find_package(volk REQUIRED)
if(NOT WASM)
# find the dependencies from conan
set(PYBIND11_FINDPYTHON FALSE)

# set(Python_ROOT_DIR /opt/python/$ENV{PYBIN})
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
# pybind11
find_package(pybind11 REQUIRED)

# GTest
if(ENABLE_TESTING)
find_package(GTest REQUIRED)
endif()

# GTest
if(ENABLE_TESTING)
find_package(GTest REQUIRED)
# stb
find_package(stb REQUIRED)

# Vulkan
find_package(volk REQUIRED)

# ShaderC for compiling shaders
find_package(shaderc REQUIRED)
endif()

include(${CMAKE_CONFIG_FOLDER}/targets/griddly.cmake)
Expand All @@ -190,26 +162,26 @@ else()
if(NOT WASM)
message(STATUS "Compiling shaders...")

set(ENV{GLSLC_BIN} ${CONAN_BIN_DIRS_SHADERC}/glslc)
set(ENV{GLSLC_BIN} ${CONAN_SHADERC_ROOT}/bin/glslc)

if(MSVC)
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/compile_shaders.bat RESULT_VARIABLE rv)
else()
execute_process(COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/compile_shaders.sh RESULT_VARIABLE rv)
endif()
endif()

if(ENABLE_PYTHON_BINDINGS)
message("Configuring Python Bindings.")
include(${CMAKE_CONFIG_FOLDER}/targets/python_griddly.cmake)
endif()
if(ENABLE_PYTHON_BINDINGS)
message("Configuring Python Bindings.")
include(${CMAKE_CONFIG_FOLDER}/targets/python_griddly.cmake)
endif()

if(ENABLE_TESTING)
message("Configuring Tests.")
set_property(GLOBAL PROPERTY CTEST_TARGETS_ADDED 1) # prevent CTest from flooding the target space with CI/CD targets
include(CTest)
enable_testing()
include(${CMAKE_CONFIG_FOLDER}/targets/test.cmake)
if(ENABLE_TESTING)
message("Configuring Tests.")
set_property(GLOBAL PROPERTY CTEST_TARGETS_ADDED 1) # prevent CTest from flooding the target space with CI/CD targets
include(CTest)
enable_testing()
include(${CMAKE_CONFIG_FOLDER}/targets/test.cmake)
endif()
endif()

include(CMakePackageConfigHelpers)
Expand Down
45 changes: 45 additions & 0 deletions CMakeUserPresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 21,
"patch": 0
},
"configurePresets": [
{
"name": "Debug Native",
"displayName": "Debug Native",
"description": "",
"generator": "Ninja",
"cacheVariables": {
"CMAKE_POLICY_DEFAULT_CMP0091": "NEW",
"CMAKE_BUILD_TYPE": "Debug"
},
"toolchainFile": "/home/bam4d/qmul/Griddly/build/conan_toolchain.cmake",
"binaryDir": "/home/bam4d/qmul/Griddly/build"
},
{
"name": "Debug WASM",
"displayName": "Debug WASM",
"description": "",
"generator": "Ninja",
"cacheVariables": {
"CMAKE_POLICY_DEFAULT_CMP0091": "NEW",
"CMAKE_BUILD_TYPE": "Debug",
"WASM": "ON"
},
"toolchainFile": "/home/bam4d/qmul/Griddly/build_wasm/conan_toolchain.cmake",
"binaryDir": "/home/bam4d/qmul/Griddly/build_wasm"
}
],
"buildPresets": [
{
"name": "Debug WASM",
"configurePreset": "Debug WASM"
},
{
"name": "Debug Native",
"configurePreset": "Debug Native"
}
]
}
96 changes: 81 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,83 @@ Build Status
</div>


# ![Installing](resources/images/gvgai/oryx/staff1.png) Building locally
# ![Building Locally](resources/images/gvgai/oryx/staff1.png) Building locally

Firstly sync up the git submodules:
Firstly you will need to configure the repo for the build.

You can do this using the `configure.sh` script in the root directory.


## Web Assembly Binaries

Build a debug version of the web-assembly binaries.


### Manually

You can run all the build commands manually

```bash

# Download the build requirements
conan install deps/wasm/conanfile_wasm.txt --profile:host deps/wasm/emscripten.profile --profile:build default -s build_type=Debug --build missing -if build_wasm

# Configure the cmake build
cmake . -B build_wasm -GNinja -DWASM=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake

# Run the build
cmake --build build_wasm --config Debug
```
git submodule init
git submodule update
```

### Using [Cmake Presets]()

We provide two presets for CMake to use to develop locally using your IDE (provided it supports CMakePresets)

```bash

# Download the build requirements
./configure.sh -p=WASM -b=Debug

# Configure build with preset
cmake --preset="Debug WASM"

# Build with preset
cmake --build build_wasm --config Debug
```
cmake . -DCMAKE_BUILD_TYPE={Debug|Release}
cmake --build .

## Native Binaries

### Manually

Build native griddly binaries:

```bash

# Download the build requirements
conan install deps/conanfile.txt --profile default --profile deps/build.profile -s build_type=Debug --build missing -if build

# Configure the cmake build
cmake . -B build -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake

# Run the build
cmake --build build --config Debug
```

Artifacts can then be found in {Debug|Release}/bin
### Using [Cmake Presets]()

We provide two presets for CMake to use to develop locally using your IDE (provided it supports CMakePresets)

```bash

# Download the build requirements
./configure.sh -b=Debug

# Configure build with preset
cmake --preset="Debug Native"

# Build with preset
cmake --build build --config Debug
```

## Tests

Expand Down Expand Up @@ -165,19 +227,24 @@ python setup.py install

## Prerequisites

We use [Conan](https://conan.io) to install all build dependencies and libraries used to compile Griddly.

You will need to set up a python environment of your choice and then install conan using:

```
pip install conan
```

### Ubuntu

```
wget -qO - http://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-bionic.list http://packages.lunarg.com/vulkan/lunarg-vulkan-bionic.list
sudo apt update
sudo apt install vulkan-sdk
1. Install [cmake](https://cmake.org/download/)
```

### Windows

1. Install [cmake](https://cmake.org/download/)
2. Install MinGW (posix 8.1.0) *or* MSVC
3. Install [Vulkan](https://vulkan.lunarg.com/sdk/home)
2. Install [Visual Studio Build Tools](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022)

### MacOS

Expand All @@ -193,4 +260,3 @@ xcode-select --install
```
brew install cmake
```
4. Install [Vulkan](https://vulkan.lunarg.com/sdk/home)
Loading

0 comments on commit 8085a94

Please sign in to comment.