Skip to content

Commit 8a0566f

Browse files
committed
Fix build for 2023.
1 parent 421f64d commit 8a0566f

17 files changed

Lines changed: 350 additions & 54 deletions

File tree

.github/workflows/build_test.yml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
matrix:
1212
configuration: [Debug, Release]
1313

14-
runs-on: ubuntu-20.04
14+
runs-on: ubuntu-22.04
1515

1616
steps:
1717
- uses: actions/checkout@v1
@@ -23,21 +23,18 @@ jobs:
2323
libxcb-randr0-dev
2424
libxcb-util0-dev
2525
pkg-config
26-
libgtkmm-3.0-dev
26+
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
2727
- name: Get Conan
28-
run: pip install conan &&
29-
conan profile new default --detect &&
30-
conan profile update settings.compiler.libcxx=libstdc++11 default &&
31-
conan profile update settings.compiler.version=8 default
32-
- name: Add remotes to Conan
33-
run: conan config install conan/config/common
28+
run: pip install conan
29+
- name: Setup Conan
30+
run: conan profile detect
3431
- name: Conan install
3532
env:
3633
CC: gcc-10
3734
CXX: g++-10
3835
run: mkdir build &&
3936
conan install .
40-
-if build
37+
-of build
4138
--build missing
4239
-s build_type=${{ matrix.configuration }}
4340
- name: Configure
@@ -67,14 +64,13 @@ jobs:
6764
- uses: actions/setup-python@v1
6865
- uses: ilammy/msvc-dev-cmd@v1.5.0
6966
- name: Get Conan
70-
run: pip install conan && conan profile new default --detect
71-
- name: Add remotes to Conan
72-
run: conan config install conan/config/common
67+
run: pip install conan
68+
- name: Setup Conan
69+
run: conan profile detect
7370
- name: Conan install
7471
run: mkdir build &&
75-
conan config set general.parallel_download=8 &&
7672
conan install .
77-
-if build
73+
-of build
7874
--build missing
7975
-s build_type=${{ matrix.configuration }}
8076
- name: Configure

CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,10 @@ find_package(Bullet REQUIRED)
3636
find_package(yaml-cpp REQUIRED)
3737
find_package(Catch2 REQUIRED)
3838
find_package(TBB REQUIRED)
39-
find_package(scope_guard REQUIRED)
4039
find_package(Eigen3 REQUIRED)
4140
find_package(fmt REQUIRED)
4241
find_package(Boost REQUIRED)
4342
find_package(Vulkan REQUIRED)
44-
find_package(embed-resource REQUIRED)
4543
find_package(Freetype REQUIRED)
4644
find_package(OpenMesh REQUIRED)
4745
find_package(yaml-cpp REQUIRED)
@@ -53,10 +51,6 @@ find_package(rapidfuzz REQUIRED)
5351

5452
add_executable(glslangValidator IMPORTED)
5553
set_target_properties(glslangValidator PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/bin/glslangValidator)
56-
add_executable(embed-resource IMPORTED)
57-
set_target_properties(embed-resource PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/bin/embed-resource)
58-
59-
include(${CMAKE_CURRENT_BINARY_DIR}/scripts/embed-resource.cmake)
6054

6155
add_subdirectory(lmlib)
6256
add_subdirectory(lmng)

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Example 3D game made with the engine.
5959

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

7577
## Setup
7678
On the command line, in the repository root directory, run:

conan/config/common/remotes.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

conan/config/linux/profiles/default

Lines changed: 0 additions & 12 deletions
This file was deleted.

conanfile.txt

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,27 @@ yaml-cpp/0.6.3
88
vulkan-loader/1.2.198.0
99
glslang/11.7.0
1010
eigen/3.3.9
11-
tbb/2020.1
11+
onetbb/2021.9.0
1212
range-v3/0.11.0
1313
spdlog/1.8.5
14-
scope_guard/0.2.3@lawrencem/stable
1514
fmt/7.1.3
1615
boost/1.73.0
17-
embed-resource/0.2@lawrencem/stable
1816
openmesh/8.1
1917
clara/1.1.5
20-
freetype/2.10.2
18+
freetype/2.13.0
2119
sdl/2.0.18
2220
rapidfuzz/cci.20210513
21+
zlib/1.2.13
2322

24-
[build_requires]
25-
catch2/2.13.0
23+
[test_requires]
24+
catch2/3.4.0
2625

2726
[options]
28-
yaml-cpp:shared=True
29-
OpenMesh:shared=True
30-
sdl:shared=True
27+
yaml-cpp/*:shared=True
28+
OpenMesh/*:shared=True
29+
sdl/*:shared=True
3130

3231
[imports]
33-
bin, embed-resource -> ./bin
34-
bin, embed-resource.exe -> ./bin
3532
bin, glslangValidator* -> ./bin
3633
bin, *.dll -> ./bin
3734
lib, *.so* -> ./bin
38-
cmake, embed-resource.cmake -> ./scripts

lmhuv/src/rendering/shapes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "shapes.h"
22
#include "../trimesh/util.h"
33

4-
#include <Resource.h>
4+
#include <lmlib/Resource.h>
55

66
#include <lmgl/lmgl.h>
77
#include <lmhuv/box.h>

lmlib/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ set(
88
CACHE INTERNAL "lmlib top-level directory")
99

1010
include(cmake/cpp_standard.cmake)
11+
include(embed-resource.cmake)
12+
13+
add_executable(embed-resource src/embedresource-cpp-11.cpp include/lmlib/Resource.h)
1114

1215
if (MSVC)
1316
set(

lmlib/embed-resource.cmake

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Call this with the output of custom commands that buld resources
2+
# you want to embed. The paths should be absolute.
3+
function(embed_built_resources out_var)
4+
set(result)
5+
foreach (in_f ${ARGN})
6+
file(RELATIVE_PATH src_f ${CMAKE_CURRENT_BINARY_DIR} "${in_f}")
7+
set(out_f ${in_f}.cpp)
8+
get_filename_component(out_f_dir "${out_f}" DIRECTORY)
9+
add_custom_command(
10+
OUTPUT ${out_f}
11+
COMMAND ${CMAKE_COMMAND} -E make_directory "${out_f_dir}"
12+
COMMAND embed-resource "${out_f}" "${src_f}"
13+
DEPENDS "${in_f}"
14+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
15+
COMMENT "Building binary file for embedding ${out_f}"
16+
VERBATIM)
17+
list(APPEND result "${out_f}")
18+
endforeach()
19+
set(${out_var} "${result}" PARENT_SCOPE)
20+
endfunction()
21+
22+
# Call this with relative paths to sources you want to embed as resources.
23+
function(embed_resources out_var)
24+
set(result)
25+
foreach (in_f ${ARGN})
26+
file(RELATIVE_PATH src_f embed-resource "${CMAKE_CURRENT_SOURCE_DIR}/${in_f}")
27+
set(out_f "${PROJECT_BINARY_DIR}/${in_f}.cpp")
28+
get_filename_component(out_f_dir "${out_f}" DIRECTORY)
29+
add_custom_command(
30+
OUTPUT ${out_f}
31+
COMMAND ${CMAKE_COMMAND} -E make_directory "${out_f_dir}"
32+
COMMAND embed-resource "${out_f}" "${src_f}"
33+
DEPENDS "${in_f}"
34+
WORKING_DIRECTORY embed-resource
35+
COMMENT "Building binary file for embedding ${out_f}"
36+
VERBATIM)
37+
list(APPEND result "${out_f}")
38+
endforeach()
39+
set(${out_var} "${result}" PARENT_SCOPE)
40+
endfunction()

lmlib/include/lmlib/Resource.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#pragma once
2+
#include <cstddef>
3+
#include <string>
4+
5+
class Resource {
6+
public:
7+
Resource(const unsigned char* start, const size_t len) : resource_data(start), data_len(len) {}
8+
9+
const char * const data() const { return (char*)resource_data; }
10+
const size_t size() const { return data_len; }
11+
12+
const char *begin() const { return (char*)resource_data; }
13+
const char *end() const { return (char*)resource_data + data_len; }
14+
15+
std::string toString() { return std::string((char*)data(), size()); }
16+
17+
private:
18+
const unsigned char* resource_data;
19+
const size_t data_len;
20+
21+
};
22+
#define LOAD_RESOURCE(varname, RESOURCE) \
23+
extern const unsigned char _resource_##RESOURCE[]; extern const size_t _resource_##RESOURCE##_len; \
24+
static auto varname = Resource(_resource_##RESOURCE, _resource_##RESOURCE##_len);

0 commit comments

Comments
 (0)