Skip to content

Commit

Permalink
Merge branch 'release/1.6.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Bam4d committed Dec 16, 2022
2 parents 11f6432 + d64acc5 commit 8a05644
Show file tree
Hide file tree
Showing 19 changed files with 443 additions and 387 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.2]
- Version [e.g. 1.6.3]

**Additional context**
Add any other context about the problem here.
219 changes: 118 additions & 101 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.2)
project(Griddly VERSION 1.6.3)

string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWERCASE)

Expand All @@ -12,26 +12,37 @@ set(PROJ_CXX_STANDARD C++17)

# Require (at least) it
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Don't use e.g. GNU extension (like -std=gnu++11) for portability
set(CMAKE_CXX_EXTENSIONS OFF)

# Relevant cmake files are in this folder
set(CMAKE_CONFIG_FOLDER ${CMAKE_SOURCE_DIR}/cmake)

# the main library name
set(GRIDDLY_LIB_NAME Griddly)

# the griddly test target name
set(GRIDDLY_TEST_BIN_NAME ${GRIDDLY_LIB_NAME}_Test)

# project main directory for all c++ related files
set(GRIDDLY_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)

# project main directory for all c++ related files
set(GRIDDLY_PYBINDING_DIR ${CMAKE_CURRENT_SOURCE_DIR}/bindings)

# project test directory
set(GRIDDLY_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tests)

# main test sources folder
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)

Expand All @@ -52,54 +63,53 @@ option(ENABLE_PYTHON_BINDINGS "Enable to build the bindings to other languages."
option(ENABLE_TESTING "Enable Test Builds" ON)
option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" OFF)


set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIR})


# Link this 'library' to set the c++ standard / compile-time options requested
add_library(project_options INTERFACE)

# Link this 'library' to use the warnings specified in CompilerWarnings.cmake
add_library(project_warnings INTERFACE)

message(STATUS ${CMAKE_SYSTEM_NAME})
if (${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
set(WASM ON)
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)
message("Compiling with MSVC")
if(${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
set(WASM ON)
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()

target_compile_options(project_options INTERFACE "/bigobj")
set_target_properties(project_options PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
if(MSVC)
message("Compiling with MSVC")

endif ()
target_compile_options(project_options INTERFACE "/bigobj")
set_target_properties(project_options PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()

target_compile_features(project_options INTERFACE ${PROJ_CXX_STD_FEATURE})

if (ENABLE_PCH)
target_precompile_headers(project_options
INTERFACE
<vector>
<string>
<map>
<utility>
<memory>
<array>
<optional>
)
endif ()
if(ENABLE_PCH)
target_precompile_headers(project_options
INTERFACE
<vector>
<string>
<map>
<utility>
<memory>
<array>
<optional>
)
endif()

# import utility methods for cmake
include(${CMAKE_CONFIG_FOLDER}/settings/Utilities.cmake)

#enable clang-format and clang-tidy project wide
# enable clang-format and clang-tidy project wide
include(${CMAKE_CONFIG_FOLDER}/settings/Clang-cxx-dev-tools.cmake)

# enable cache system
Expand All @@ -123,6 +133,7 @@ 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::")
Expand All @@ -149,88 +160,94 @@ 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

# glm
find_package(glm REQUIRED)

# Yaml-Cpp
find_package(yaml-cpp REQUIRED)

# stb
find_package(stb REQUIRED)

# Vulkan
find_package(volk REQUIRED)

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

include(${CMAKE_CONFIG_FOLDER}/targets/griddly.cmake)

if (WASM)
include(${CMAKE_CONFIG_FOLDER}/targets/wasm.cmake)
else ()
# Compile shaders and copy them into resources directory in build output
if (NOT WASM)
message(STATUS "Compiling shaders...")
set(ENV{GLSLC_BIN} ${CONAN_BIN_DIRS_SHADERC}/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_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 ()

include(CMakePackageConfigHelpers)

# Want the python lib to be output in the same directory as the other dll/so
if (MSVC)
foreach (OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
set_target_properties(${PYTHON_MODULE} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${BIN_OUTPUT_DIR})
endforeach (OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES)
endif ()

write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWERCASE}ConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
install(TARGETS project_options EXPORT ${PROJECT_NAME_LOWERCASE}Options)
install(TARGETS ${GRIDDLY_LIB_NAME}_interface ${GRIDDLY_LIB_NAME}_shared ${GRIDDLY_LIB_NAME}_static
EXPORT ${PROJECT_NAME_LOWERCASE}Targets
LIBRARY DESTINATION lib COMPONENT Runtime
ARCHIVE DESTINATION lib COMPONENT Development
RUNTIME DESTINATION bin COMPONENT Runtime
PUBLIC_HEADER DESTINATION include COMPONENT Development
BUNDLE DESTINATION bin COMPONENT Runtime
)

include(CMakePackageConfigHelpers)
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME_LOWERCASE}Config.cmake.in"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWERCASE}Config.cmake"
INSTALL_DESTINATION lib/cmake/${PROJECT_NAME_LOWERCASE}
)
install(EXPORT ${PROJECT_NAME_LOWERCASE}Options DESTINATION lib/cmake/${PROJECT_NAME_LOWERCASE})
install(EXPORT ${PROJECT_NAME_LOWERCASE}Targets DESTINATION lib/cmake/${PROJECT_NAME_LOWERCASE})
install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWERCASE}ConfigVersion.cmake"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWERCASE}Config.cmake"
DESTINATION lib/cmake/${PROJECT_NAME_LOWERCASE})
install(FILES ${GRIDDLY_HEADERS} DESTINATION include)
install(DIRECTORY ${GRIDDLY_RESOURCE_DIR} DESTINATION resources)
endif ()
if(WASM)
include(${CMAKE_CONFIG_FOLDER}/targets/wasm.cmake)
else()
# Compile shaders and copy them into resources directory in build output
if(NOT WASM)
message(STATUS "Compiling shaders...")

set(ENV{GLSLC_BIN} ${CONAN_BIN_DIRS_SHADERC}/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_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()

include(CMakePackageConfigHelpers)

# Want the python lib to be output in the same directory as the other dll/so
if(MSVC)
foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
set_target_properties(${PYTHON_MODULE} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${BIN_OUTPUT_DIR})
endforeach(OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES)
endif()

write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWERCASE}ConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
install(TARGETS project_options EXPORT ${PROJECT_NAME_LOWERCASE}Options)
install(TARGETS ${GRIDDLY_LIB_NAME}_interface ${GRIDDLY_LIB_NAME}_shared ${GRIDDLY_LIB_NAME}_static
EXPORT ${PROJECT_NAME_LOWERCASE}Targets
LIBRARY DESTINATION lib COMPONENT Runtime
ARCHIVE DESTINATION lib COMPONENT Development
RUNTIME DESTINATION bin COMPONENT Runtime
PUBLIC_HEADER DESTINATION include COMPONENT Development
BUNDLE DESTINATION bin COMPONENT Runtime
)

include(CMakePackageConfigHelpers)
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME_LOWERCASE}Config.cmake.in"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWERCASE}Config.cmake"
INSTALL_DESTINATION lib/cmake/${PROJECT_NAME_LOWERCASE}
)
install(EXPORT ${PROJECT_NAME_LOWERCASE}Options DESTINATION lib/cmake/${PROJECT_NAME_LOWERCASE})
install(EXPORT ${PROJECT_NAME_LOWERCASE}Targets DESTINATION lib/cmake/${PROJECT_NAME_LOWERCASE})
install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWERCASE}ConfigVersion.cmake"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWERCASE}Config.cmake"
DESTINATION lib/cmake/${PROJECT_NAME_LOWERCASE})
install(FILES ${GRIDDLY_HEADERS} DESTINATION include)
install(DIRECTORY ${GRIDDLY_RESOURCE_DIR} DESTINATION resources)
endif()
26 changes: 19 additions & 7 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,34 @@ jobs:
vmImage: "ubuntu-20.04"
strategy:
matrix:
ManyLinux_p37:
PythonVersion: 3.7
PyBin: cp37-cp37m
PLAT: manylinux_2_28_x86_64
ManyLinux_p38:
ManyLinux_2_28_p38:
PythonVersion: 3.8
PyBin: cp38-cp38
PLAT: manylinux_2_28_x86_64
ManyLinux_p39:
ManyLinux_2_28_p39:
PythonVersion: 3.9
PyBin: cp39-cp39
PLAT: manylinux_2_28_x86_64
ManyLinux_p310:
ManyLinux_2_28_p310:
PythonVersion: 3.10
PyBin: cp310-cp310
PLAT: manylinux_2_28_x86_64
ManyLinux_2_28_p311:
PythonVersion: 3.11
PyBin: cp311-cp311
PLAT: manylinux_2_28_x86_64
ManyLinux_2014_p38:
PythonVersion: 3.8
PyBin: cp38-cp38
PLAT: manylinux2014_x86_64
ManyLinux_2014_p39:
PythonVersion: 3.9
PyBin: cp39-cp39
PLAT: manylinux2014_x86_64
ManyLinux_2014_p310:
PythonVersion: 3.10
PyBin: cp310-cp310
PLAT: manylinux2014_x86_64
steps:
- task: InstallSSHKey@0
inputs:
Expand Down
2 changes: 1 addition & 1 deletion bindings/python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace griddly {

PYBIND11_MODULE(python_griddly, m) {
m.doc() = "Griddly python bindings";
m.attr("version") = "1.6.2";
m.attr("version") = "1.6.3";

#ifndef NDEBUG
spdlog::set_level(spdlog::level::debug);
Expand Down
11 changes: 6 additions & 5 deletions cmake/settings/Cache.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if(NOT ENABLE_CACHE)
return()
return()
endif()

set(CACHE_OPTION "ccache" CACHE STRING "Compiler cache to be used")
Expand All @@ -8,13 +8,14 @@ set_property(CACHE CACHE_OPTION PROPERTY STRINGS ${CACHE_OPTION_VALUES})
list(FIND CACHE_OPTION_VALUES ${CACHE_OPTION} CACHE_OPTION_INDEX)

if(${CACHE_OPTION_INDEX} EQUAL -1)
message(STATUS "Using custom compiler cache system: '${CACHE_OPTION}', explicitly supported entries are ${CACHE_OPTION_VALUES}")
message(STATUS "Using custom compiler cache system: '${CACHE_OPTION}', explicitly supported entries are ${CACHE_OPTION_VALUES}")
endif()

find_program(CACHE_BINARY ${CACHE_OPTION})

if(CACHE_BINARY)
message(STATUS "${CACHE_OPTION} found and enabled")
set(CMAKE_CXX_COMPILER_LAUNCHER ${CACHE_BINARY})
message(STATUS "${CACHE_OPTION} found and enabled")
set(CMAKE_CXX_COMPILER_LAUNCHER ${CACHE_BINARY})
else()
message(WARNING "${CACHE_OPTION} is enabled but was not found. Not using it")
message(WARNING "${CACHE_OPTION} is enabled but was not found. Not using it")
endif()
Loading

0 comments on commit 8a05644

Please sign in to comment.