Skip to content

Commit 86d0ab9

Browse files
committed
Use conan for deps
1 parent 09aed65 commit 86d0ab9

37 files changed

+310
-970
lines changed

.github/workflows/cmake.yml

Lines changed: 91 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,44 @@ 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+
- name: Ubuntu GCC
16+
os: ubuntu-latest
17+
compiler: g++
18+
arch: "64"
19+
suffix: ""
20+
cmake-flags: ""
21+
- name: Ubuntu Clang
22+
os: ubuntu-latest
23+
compiler: clang++
24+
arch: "64"
25+
suffix: ""
26+
cmake-flags: ""
27+
- name: Windows
28+
os: windows-latest
29+
compiler: msvc
30+
arch: "64"
31+
suffix: ""
32+
cmake-flags: ""
33+
- name: MacOS
34+
os: macos-latest
35+
compiler: clang++
36+
arch: "64"
37+
suffix: ""
38+
cmake-flags: ""
39+
- name: WebAssembly
40+
os: ubuntu-latest
41+
compiler: em++
42+
arch: "32"
43+
suffix: "-emscripten"
44+
cmake-flags: "-DLXGUI_BUILD_GUI_SFML_IMPL=OFF -DLXGUI_BUILD_INPUT_SFML_IMPL=OFF -DLXGUI_TEST_IMPLEMENTATION=OPENGL_SDL"
2245

2346
name: ${{matrix.platform.name}}
2447
runs-on: ${{matrix.platform.os}}
@@ -31,80 +54,88 @@ jobs:
3154

3255
- name: Setup Clang
3356
if: matrix.platform.compiler == 'clang++' && matrix.platform.os == 'ubuntu-latest'
34-
run: sudo apt install clang
57+
run: |
58+
sudo apt install clang
59+
echo "CC=clang" >> $GITHUB_ENV
60+
echo "CXX=clang++" >> $GITHUB_ENV
3561
36-
- name: Setup Emscripten cache
37-
if: matrix.platform.compiler == 'em++'
38-
id: cache-system-libraries
62+
- name: Setup Conan cache
63+
id: cache-conan-packages
3964
uses: actions/cache@v4
4065
with:
41-
path: ${{env.EM_CACHE_FOLDER}}
42-
key: ${{env.EM_VERSION}}-${{matrix.platform.name}}-${{matrix.build-type}}
66+
path: ${{env.CONAN_USER_HOME}}
67+
key: ${{matrix.platform.name}}-${{matrix.compiler}}
4368

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}}
69+
- name: Get Conan dependencies
70+
shell: bash
71+
working-directory: ${{github.workspace}}
72+
run: |
73+
pip install conan
74+
conan profile detect --force
75+
conan create conan/observable_unique_ptr
76+
-pr default \
77+
-pr ./conan/profiles/${{matrix.platform.os}}-${{matrix.platform.arch}}-${{matrix.platform.compiler}}
78+
conan install . \
79+
--build=missing \
80+
-c tools.system.package_manager:mode=install \
81+
-c tools.system.package_manager:sudo=true \
82+
--output-folder dependencies \
83+
-pr:b default \
84+
-pr:h default \
85+
-pr:h ./conan/profiles/${{matrix.platform.os}}-${{matrix.platform.arch}}-${{matrix.platform.compiler}}
5086
5187
- name: Create Build Environment
5288
run: cmake -E make_directory ${{github.workspace}}/build
5389

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-
7990
- name: Configure CMake
8091
shell: bash
8192
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}}
93+
run: |
94+
source ../dependencies/conanbuild.sh
95+
cmake .. \
96+
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
97+
-DCMAKE_TOOLCHAIN_FILE=`pwd`/../dependencies/conan_toolchain.cmake \
98+
-DLXGUI_BUILD_EXAMPLES=OFF \
99+
-DLXGUI_DEV=ON \
100+
-DCMAKE_INSTALL_PREFIX=`pwd`/../install \
101+
${{matrix.platform.cmake-flags}}
83102
84103
- name: Build
85104
shell: bash
86105
working-directory: ${{github.workspace}}/build
87-
run: cmake --build . --config ${BUILD_TYPE} --parallel 2
106+
run: |
107+
source ../dependencies/conanbuild.sh
108+
cmake --build . --config ${BUILD_TYPE} --parallel 2
88109
89110
- name: Install
90111
shell: bash
91112
working-directory: ${{github.workspace}}/build
92-
run: cmake --install . --config ${BUILD_TYPE}
113+
run: |
114+
source ../dependencies/conanbuild.sh
115+
cmake --install . --config ${BUILD_TYPE}
93116
94117
- name: Build example SDL
95118
shell: bash
96119
working-directory: ${{github.workspace}}/build
97120
run: |
98121
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}}
122+
source ../dependencies/conanbuild.sh
123+
cmake ../examples/sdl${{matrix.platform.suffix}} \
124+
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
125+
-DCMAKE_TOOLCHAIN_FILE=`pwd`/../dependencies/conan_toolchain.cmake \
126+
-DCMAKE_PREFIX_PATH=`pwd`/../install
100127
cmake --build . --config ${BUILD_TYPE} --parallel 2
101128
102129
- name: Build example OpenGL-SDL
103130
shell: bash
104131
working-directory: ${{github.workspace}}/build
105132
run: |
106133
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}}
134+
source ../dependencies/conanbuild.sh
135+
cmake ../examples/opengl-sdl${{matrix.platform.suffix}} \
136+
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
137+
-DCMAKE_TOOLCHAIN_FILE=`pwd`/../dependencies/conan_toolchain.cmake \
138+
-DCMAKE_PREFIX_PATH=`pwd`/../install
108139
cmake --build . --config ${BUILD_TYPE} --parallel 2
109140
110141
- name: Build example SFML
@@ -113,7 +144,11 @@ jobs:
113144
working-directory: ${{github.workspace}}/build
114145
run: |
115146
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}}
147+
source ../dependencies/conanbuild.sh
148+
cmake ../examples/sfml${{matrix.platform.suffix}} \
149+
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
150+
-DCMAKE_TOOLCHAIN_FILE=`pwd`/../dependencies/conan_toolchain.cmake \
151+
-DCMAKE_PREFIX_PATH=`pwd`/../install
117152
cmake --build . --config ${BUILD_TYPE} --parallel 2
118153
119154
- name: Build example OpenGL-SFML
@@ -122,7 +157,11 @@ jobs:
122157
working-directory: ${{github.workspace}}/build
123158
run: |
124159
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}}
160+
source ../dependencies/conanbuild.sh
161+
cmake ../examples/opengl-sfml${{matrix.platform.suffix}} \
162+
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
163+
-DCMAKE_TOOLCHAIN_FILE=`pwd`/../dependencies/conan_toolchain.cmake \
164+
-DCMAKE_PREFIX_PATH=`pwd`/../install
126165
cmake --build . --config ${BUILD_TYPE} --parallel 2
127166
128167
- name: Prepare publish package

.github/workflows/codeql-analysis.yml

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

.github/workflows/custom.ruleset

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

.github/workflows/msvc-analysis.yml

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

.gitignore

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
build
2-
build_wasm
3-
build_clang
4-
build_examples
2+
build-*
3+
dependencies
4+
dependencies-*
5+
6+
.cache
7+
58
bin/lxgui-test*
69
bin/cout.txt
710
bin/gui.txt
11+
812
doc/html
913
doc/lua
1014
doc/*.log
15+
1116
*.sublime-workspace
1217
compile_commands.json
13-
dependencies/lib
14-
dependencies/include
15-
include/lxgui/lxgui.hpp
18+
CMakeUserPresets.json

0 commit comments

Comments
 (0)