Skip to content

Commit b98e4e8

Browse files
committed
Use conan for deps
1 parent 35f4b2f commit b98e4e8

34 files changed

+308
-794
lines changed

.github/workflows/cmake.yml

Lines changed: 100 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,54 @@ on: push
44

55
env:
66
BUILD_TYPE: Release
7-
EM_VERSION: 3.1.35
8-
EM_CACHE_FOLDER: 'emsdk-cache'
7+
CONAN_USER_HOME: 'conan-cache'
98

109
jobs:
1110
build:
1211
strategy:
1312
fail-fast: false
1413
matrix:
1514
platform:
16-
- { name: Ubuntu GCC, os: ubuntu-latest, compiler: g++, arch: "64", cmakepp: "", suffix: "", flags: "-DCMAKE_CXX_COMPILER=g++"}
17-
- { name: Ubuntu Clang, os: ubuntu-latest, compiler: clang++, arch: "64", cmakepp: "", suffix: "", flags: "-DCMAKE_CXX_COMPILER=clang++"}
18-
- { name: Windows 32, os: windows-latest, compiler: vs2019, arch: "32", cmakepp: "", suffix: "", flags: "-DCMAKE_PREFIX_PATH=`pwd`/../dependencies -A Win32"}
19-
- { name: Windows 64, os: windows-latest, compiler: vs2019, arch: "64", cmakepp: "", suffix: "", flags: "-DCMAKE_PREFIX_PATH=`pwd`/../dependencies -A x64"}
20-
- { name: MacOS, os: macos-latest, compiler: clang++, arch: "64", cmakepp: "", suffix: "", flags: "-DCMAKE_PREFIX_PATH=/opt/homebrew/opt/sfml@2"}
21-
- { name: WebAssembly, os: ubuntu-latest, compiler: em++, arch: "32", cmakepp: "emcmake", suffix: "-emscripten", flags: "-DCMAKE_PREFIX_PATH=`pwd`/../dependencies -DCMAKE_FIND_ROOT_PATH=/ -DLXGUI_TEST_IMPLEMENTATION=OPENGL_SDL"}
15+
- {
16+
name: Ubuntu GCC,
17+
os: ubuntu-latest,
18+
compiler: g++,
19+
arch: "64",
20+
suffix: "",
21+
cmake-flags: ""
22+
}
23+
- {
24+
name: Ubuntu Clang,
25+
os: ubuntu-latest,
26+
compiler: clang++,
27+
arch: "64",
28+
suffix: "",
29+
cmake-flags: ""
30+
}
31+
- {
32+
name: Windows,
33+
os: windows-latest,
34+
compiler: msvc,
35+
arch: "64",
36+
suffix: "",
37+
cmake-flags: ""
38+
}
39+
- {
40+
name: MacOS,
41+
os: macos-latest,
42+
compiler: clang++,
43+
arch: "64",
44+
suffix: "",
45+
cmake-flags: ""
46+
}
47+
- {
48+
name: WebAssembly,
49+
os: ubuntu-latest,
50+
compiler: em++,
51+
arch: "32",
52+
suffix: "-emscripten",
53+
cmake-flags: "-DLXGUI_BUILD_GUI_SFML_IMPL=OFF -DLXGUI_BUILD_INPUT_SFML_IMPL=OFF -DLXGUI_TEST_IMPLEMENTATION=OPENGL_SDL"
54+
}
2255

2356
name: ${{matrix.platform.name}}
2457
runs-on: ${{matrix.platform.os}}
@@ -31,80 +64,87 @@ jobs:
3164

3265
- name: Setup Clang
3366
if: matrix.platform.compiler == 'clang++' && matrix.platform.os == 'ubuntu-latest'
34-
run: sudo apt install clang
67+
run: |
68+
sudo apt install clang
69+
echo "CC=clang" >> $GITHUB_ENV
70+
echo "CXX=clang++" >> $GITHUB_ENV
3571
36-
- name: Setup Emscripten cache
37-
if: matrix.platform.compiler == 'em++'
38-
id: cache-system-libraries
72+
- name: Setup Conan cache
73+
id: cache-conan-packages
3974
uses: actions/cache@v4
4075
with:
41-
path: ${{env.EM_CACHE_FOLDER}}
42-
key: ${{env.EM_VERSION}}-${{matrix.platform.name}}-${{matrix.build-type}}
76+
path: ${{env.CONAN_USER_HOME}}
77+
key: ${{matrix.platform.name}}-${{matrix.compiler}}
4378

44-
- name: Setup Emscripten
45-
if: matrix.platform.compiler == 'em++'
46-
uses: mymindstorm/setup-emsdk@v14
47-
with:
48-
version: ${{env.EM_VERSION}}
49-
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
79+
- name: Get Conan dependencies
80+
shell: bash
81+
working-directory: ${{github.workspace}}
82+
run: |
83+
pip install conan
84+
conan profile detect --force
85+
conan create conan/observable_unique_ptr
86+
-pr default \
87+
-pr ./conan/profiles/${{matrix-os}}-${{matrix-arch}}-${{matrix-compiler}}
88+
conan install . \
89+
--build=missing \
90+
-c tools.system.package_manager:mode=install \
91+
-c tools.system.package_manager:sudo=true \
92+
--output-folder dependencies \
93+
-pr:b default \
94+
-pr:h default \
95+
-pr:h ./conan/profiles/${{matrix-os}}-${{matrix-arch}}-${{matrix-compiler}}
5096
5197
- name: Create Build Environment
5298
run: cmake -E make_directory ${{github.workspace}}/build
5399

54-
- name: Get Linux dependencies
55-
if: runner.os == 'Linux' && matrix.platform.compiler != 'em++'
56-
run: |
57-
sudo apt-get update
58-
sudo apt-get install libz-dev libpng-dev libfreetype6-dev libglew-dev libglu1-mesa-dev libsfml-dev liblua5.2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-dev
59-
60-
- name: Get Emscripten dependencies
61-
if: matrix.platform.compiler == 'em++'
62-
shell: bash
63-
working-directory: ${{github.workspace}}/dependencies
64-
run: unzip wasm.zip
65-
66-
- name: Get Windows dependencies
67-
if: runner.os == 'Windows'
68-
# Ideally (but too slow):
69-
#run: vcpkg install sfml lua zlib libpng freetype glew sdl2 sdl2-ttf sdl2-image
70-
# Pre-compiled dependencies:
71-
shell: bash
72-
working-directory: ${{github.workspace}}/dependencies
73-
run: unzip windows-dependencies-${{matrix.platform.compiler}}-${{matrix.platform.arch}}.zip
74-
75-
- name: Get MacOS dependencies
76-
if: runner.os == 'macOS'
77-
run: brew install sfml@2 lua libpng freetype glew sdl2 sdl2_ttf sdl2_image
78-
79100
- name: Configure CMake
80101
shell: bash
81102
working-directory: ${{github.workspace}}/build
82-
run: ${{matrix.platform.cmakepp}} cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DLXGUI_BUILD_EXAMPLES=0 -DCMAKE_INSTALL_PREFIX=`pwd`/../dependencies ${{matrix.platform.flags}}
103+
run: |
104+
source ../dependencies/conanbuild.sh
105+
cmake .. \
106+
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
107+
-DCMAKE_TOOLCHAIN_FILE=`pwd`/../dependencies/conan_toolchain.cmake \
108+
-DLXGUI_BUILD_EXAMPLES=0 \
109+
-DCMAKE_INSTALL_PREFIX=`pwd`/../install \
110+
${{matrix.platform.cmake-flags}}
83111
84112
- name: Build
85113
shell: bash
86114
working-directory: ${{github.workspace}}/build
87-
run: cmake --build . --config ${BUILD_TYPE} --parallel 2
115+
run: |
116+
source ../dependencies/conanbuild.sh
117+
cmake --build . --config ${BUILD_TYPE} --parallel 2
88118
89119
- name: Install
90120
shell: bash
91121
working-directory: ${{github.workspace}}/build
92-
run: cmake --install . --config ${BUILD_TYPE}
122+
run: |
123+
source ../dependencies/conanbuild.sh
124+
cmake --install . --config ${BUILD_TYPE}
93125
94126
- name: Build example SDL
95127
shell: bash
96128
working-directory: ${{github.workspace}}/build
97129
run: |
98130
rm -rf *
99-
${{matrix.platform.cmakepp}} cmake ../examples/sdl${{matrix.platform.suffix}} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_PREFIX_PATH=`pwd`/../dependencies ${{matrix.platform.flags}}
131+
source ../dependencies/conanbuild.sh
132+
cmake ../examples/sdl${{matrix.platform.suffix}} \
133+
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
134+
-DCMAKE_TOOLCHAIN_FILE=`pwd`/../dependencies/conan_toolchain.cmake \
135+
-DCMAKE_PREFIX_PATH=`pwd`/../install
100136
cmake --build . --config ${BUILD_TYPE} --parallel 2
101137
102138
- name: Build example OpenGL-SDL
103139
shell: bash
104140
working-directory: ${{github.workspace}}/build
105141
run: |
106142
rm -rf *
107-
${{matrix.platform.cmakepp}} cmake ../examples/opengl-sdl${{matrix.platform.suffix}} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_PREFIX_PATH=`pwd`/../dependencies ${{matrix.platform.flags}}
143+
source ../dependencies/conanbuild.sh
144+
cmake ../examples/opengl-sdl${{matrix.platform.suffix}} \
145+
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
146+
-DCMAKE_TOOLCHAIN_FILE=`pwd`/../dependencies/conan_toolchain.cmake \
147+
-DCMAKE_PREFIX_PATH=`pwd`/../install
108148
cmake --build . --config ${BUILD_TYPE} --parallel 2
109149
110150
- name: Build example SFML
@@ -113,7 +153,11 @@ jobs:
113153
working-directory: ${{github.workspace}}/build
114154
run: |
115155
rm -rf *
116-
${{matrix.platform.cmakepp}} cmake ../examples/sfml${{matrix.platform.suffix}} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_PREFIX_PATH=`pwd`/../dependencies ${{matrix.platform.flags}}
156+
source ../dependencies/conanbuild.sh
157+
cmake ../examples/sfml${{matrix.platform.suffix}} \
158+
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
159+
-DCMAKE_TOOLCHAIN_FILE=`pwd`/../dependencies/conan_toolchain.cmake \
160+
-DCMAKE_PREFIX_PATH=`pwd`/../install
117161
cmake --build . --config ${BUILD_TYPE} --parallel 2
118162
119163
- name: Build example OpenGL-SFML
@@ -122,7 +166,11 @@ jobs:
122166
working-directory: ${{github.workspace}}/build
123167
run: |
124168
rm -rf *
125-
${{matrix.platform.cmakepp}} cmake ../examples/opengl-sfml${{matrix.platform.suffix}} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_PREFIX_PATH=`pwd`/../dependencies ${{matrix.platform.flags}}
169+
source ../dependencies/conanbuild.sh
170+
cmake ../examples/opengl-sfml${{matrix.platform.suffix}} \
171+
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
172+
-DCMAKE_TOOLCHAIN_FILE=`pwd`/../dependencies/conan_toolchain.cmake \
173+
-DCMAKE_PREFIX_PATH=`pwd`/../install
126174
cmake --build . --config ${BUILD_TYPE} --parallel 2
127175
128176
- name: Prepare publish package

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,8 @@ doc/*.log
1212
compile_commands.json
1313
dependencies/lib
1414
dependencies/include
15+
dependencies/*.cmake
16+
dependencies/CMake*
17+
dependencies/*conan*
1518
include/lxgui/lxgui.hpp
19+
.cache

.gitmodules

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

0 commit comments

Comments
 (0)