Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
matrix:
configuration: [Debug, Release]

runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v1
Expand All @@ -23,21 +23,18 @@ jobs:
libxcb-randr0-dev
libxcb-util0-dev
pkg-config
libgtkmm-3.0-dev
libgtkmm-3.0-dev libfontenc-dev libxaw7-dev libxmu-dev libxmuu-dev libxpm-dev libxres-dev libxss-dev libxv-dev libxvmc-dev libxxf86vm-dev libxcb-render-util0-dev libxcb-xkb-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-xinerama0-dev libxcb-dri3-dev libxcb-cursor-dev
- name: Get Conan
run: pip install conan &&
conan profile new default --detect &&
conan profile update settings.compiler.libcxx=libstdc++11 default &&
conan profile update settings.compiler.version=8 default
- name: Add remotes to Conan
run: conan config install conan/config/common
run: pip install conan
- name: Setup Conan
run: conan profile detect
- name: Conan install
env:
CC: gcc-10
CXX: g++-10
run: mkdir build &&
conan install .
-if build
-of build
--build missing
-s build_type=${{ matrix.configuration }}
- name: Configure
Expand Down Expand Up @@ -67,14 +64,13 @@ jobs:
- uses: actions/setup-python@v1
- uses: ilammy/msvc-dev-cmd@v1.5.0
- name: Get Conan
run: pip install conan && conan profile new default --detect
- name: Add remotes to Conan
run: conan config install conan/config/common
run: pip install conan
- name: Setup Conan
run: conan profile detect
- name: Conan install
run: mkdir build &&
conan config set general.parallel_download=8 &&
conan install .
-if build
-of build
--build missing
-s build_type=${{ matrix.configuration }}
- name: Configure
Expand Down
6 changes: 0 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,10 @@ find_package(Bullet REQUIRED)
find_package(yaml-cpp REQUIRED)
find_package(Catch2 REQUIRED)
find_package(TBB REQUIRED)
find_package(scope_guard REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(fmt REQUIRED)
find_package(Boost REQUIRED)
find_package(Vulkan REQUIRED)
find_package(embed-resource REQUIRED)
find_package(Freetype REQUIRED)
find_package(OpenMesh REQUIRED)
find_package(yaml-cpp REQUIRED)
Expand All @@ -53,10 +51,6 @@ find_package(rapidfuzz REQUIRED)

add_executable(glslangValidator IMPORTED)
set_target_properties(glslangValidator PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/bin/glslangValidator)
add_executable(embed-resource IMPORTED)
set_target_properties(embed-resource PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/bin/embed-resource)

include(${CMAKE_CURRENT_BINARY_DIR}/scripts/embed-resource.cmake)

add_subdirectory(lmlib)
add_subdirectory(lmng)
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Example 3D game made with the engine.

## Requirements
* Python 3
* The [Conan](https://conan.io/) package manager
* The [Conan](https://conan.io/) package manager (version 1- `pip install conan<2.0`)
* [CMake](https://cmake.org/)
* Vulkan graphics drivers
* Linux
Expand All @@ -71,6 +71,8 @@ Example 3D game made with the engine.
* pkg-config
* libgtkmm-3.0-dev
* vulkan-validation-layers
* Windows
* LunarG Vulkan SDK

## Setup
On the command line, in the repository root directory, run:
Expand Down
2 changes: 0 additions & 2 deletions conan/config/common/remotes.txt

This file was deleted.

12 changes: 0 additions & 12 deletions conan/config/linux/profiles/default

This file was deleted.

20 changes: 8 additions & 12 deletions conanfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,27 @@ yaml-cpp/0.6.3
vulkan-loader/1.2.198.0
glslang/11.7.0
eigen/3.3.9
tbb/2020.1
onetbb/2021.9.0
range-v3/0.11.0
spdlog/1.8.5
scope_guard/0.2.3@lawrencem/stable
fmt/7.1.3
boost/1.73.0
embed-resource/0.2@lawrencem/stable
openmesh/8.1
clara/1.1.5
freetype/2.10.2
freetype/2.13.0
sdl/2.0.18
rapidfuzz/cci.20210513
zlib/1.2.13

[build_requires]
catch2/2.13.0
[test_requires]
catch2/3.4.0

[options]
yaml-cpp:shared=True
OpenMesh:shared=True
sdl:shared=True
yaml-cpp/*:shared=True
OpenMesh/*:shared=True
sdl/*:shared=True

[imports]
bin, embed-resource -> ./bin
bin, embed-resource.exe -> ./bin
bin, glslangValidator* -> ./bin
bin, *.dll -> ./bin
lib, *.so* -> ./bin
cmake, embed-resource.cmake -> ./scripts
2 changes: 1 addition & 1 deletion lmhuv/src/rendering/shapes.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "shapes.h"
#include "../trimesh/util.h"

#include <Resource.h>
#include <lmlib/Resource.h>

#include <lmgl/lmgl.h>
#include <lmhuv/box.h>
Expand Down
3 changes: 3 additions & 0 deletions lmlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ set(
CACHE INTERNAL "lmlib top-level directory")

include(cmake/cpp_standard.cmake)
include(embed-resource.cmake)

add_executable(embed-resource src/embedresource-cpp-11.cpp include/lmlib/Resource.h)

if (MSVC)
set(
Expand Down
40 changes: 40 additions & 0 deletions lmlib/embed-resource.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Call this with the output of custom commands that buld resources
# you want to embed. The paths should be absolute.
function(embed_built_resources out_var)
set(result)
foreach (in_f ${ARGN})
file(RELATIVE_PATH src_f ${CMAKE_CURRENT_BINARY_DIR} "${in_f}")
set(out_f ${in_f}.cpp)
get_filename_component(out_f_dir "${out_f}" DIRECTORY)
add_custom_command(
OUTPUT ${out_f}
COMMAND ${CMAKE_COMMAND} -E make_directory "${out_f_dir}"
COMMAND embed-resource "${out_f}" "${src_f}"
DEPENDS "${in_f}"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Building binary file for embedding ${out_f}"
VERBATIM)
list(APPEND result "${out_f}")
endforeach()
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()

# Call this with relative paths to sources you want to embed as resources.
function(embed_resources out_var)
set(result)
foreach (in_f ${ARGN})
file(RELATIVE_PATH src_f embed-resource "${CMAKE_CURRENT_SOURCE_DIR}/${in_f}")
set(out_f "${PROJECT_BINARY_DIR}/${in_f}.cpp")
get_filename_component(out_f_dir "${out_f}" DIRECTORY)
add_custom_command(
OUTPUT ${out_f}
COMMAND ${CMAKE_COMMAND} -E make_directory "${out_f_dir}"
COMMAND embed-resource "${out_f}" "${src_f}"
DEPENDS "${in_f}"
WORKING_DIRECTORY embed-resource
COMMENT "Building binary file for embedding ${out_f}"
VERBATIM)
list(APPEND result "${out_f}")
endforeach()
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
24 changes: 24 additions & 0 deletions lmlib/include/lmlib/Resource.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#pragma once
#include <cstddef>
#include <string>

class Resource {
public:
Resource(const unsigned char* start, const size_t len) : resource_data(start), data_len(len) {}

const char * const data() const { return (char*)resource_data; }
const size_t size() const { return data_len; }

const char *begin() const { return (char*)resource_data; }
const char *end() const { return (char*)resource_data + data_len; }

std::string toString() { return std::string((char*)data(), size()); }

private:
const unsigned char* resource_data;
const size_t data_len;

};
#define LOAD_RESOURCE(varname, RESOURCE) \
extern const unsigned char _resource_##RESOURCE[]; extern const size_t _resource_##RESOURCE##_len; \
static auto varname = Resource(_resource_##RESOURCE, _resource_##RESOURCE##_len);
Loading