Skip to content
Merged
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
13 changes: 8 additions & 5 deletions .github/workflows/pip_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ on:
types: [created]

jobs:
pypi-publish:
name: Publish release to PyPI
runs-on: ubuntu-latest
build-wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]

environment:
name: pypi
permissions:
Expand Down Expand Up @@ -42,7 +46,7 @@ jobs:
env:
CIBW_ARCHS_LINUX: 'x86_64'
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_BEFORE_ALL: |
CIBW_BEFORE_ALL_LINUX: |
yum install -y epel-release && \
yum install -y \
glfw-devel \
Expand All @@ -57,7 +61,6 @@ jobs:
SDL2-devel \
qt5-qtbase-devel \
gtk3-devel

run: |
cd python_bindings
cibuildwheel --output-dir dist
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/test_python_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build python wheels

on: [pull_request]

jobs:
build-wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Copy stuff
run: |
rm -rf python_bindings/vendored_deps
rm -rf python_bindings/slamd_src
rm -rf python_bindings/README.md

cp -r vendored_deps python_bindings/vendored_deps
cp -r slamd python_bindings/slamd_src
cp README.md python_bindings/README.md

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install build deps
run: |
python -m pip install --upgrade pip
pip install cibuildwheel

- name: Build wheels with cibuildwheel
env:
CIBW_ARCHS_LINUX: 'x86_64'
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_BEFORE_ALL_LINUX: |
yum install -y epel-release && \
yum install -y \
glfw-devel \
libX11-devel \
libXcursor-devel \
libXrandr-devel \
libXinerama-devel \
libXi-devel \
wayland-devel \
mesa-libEGL-devel \
mesa-libGLES-devel \
SDL2-devel \
qt5-qtbase-devel \
gtk3-devel
run: |
cd python_bindings
cibuildwheel --output-dir dist
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@
[submodule "vendored_deps/cxxopts"]
path = vendored_deps/cxxopts
url = git@github.com:jarro2783/cxxopts.git
[submodule "vendored_deps/fmt"]
path = vendored_deps/fmt
url = git@github.com:fmtlib/fmt.git
11 changes: 9 additions & 2 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@ set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

project(slam_dunk_examples)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# Check if our lord and savious ccache exists
# We use ccache to massively speed up recompile times
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)


if(APPLE)
message(STATUS "APPLE")
set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg_installed/arm64-osx")
Expand Down
1 change: 0 additions & 1 deletion examples/hello_canvas/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <stb_image.h>
#include <cstdint>
#include <filesystem>
#include <format>
#include <iostream>
#include <random>
#include <slamd/slamd.hpp>
Expand Down
4 changes: 0 additions & 4 deletions examples/poly_line_2d/main.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#include <cstdint>
#include <format>
#include <iostream>
#include <random>
#include <slamd/slamd.hpp>
#include <stdexcept>

std::random_device rd;
std::mt19937 gen(rd());
Expand Down
34 changes: 13 additions & 21 deletions python_bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(LIB_DIR vendored_deps)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(BUILD_SHARED_LIBS OFF)

find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)

if(APPLE)
set(INSTALL_PATH "@loader_path")
else()
set(INSTALL_PATH "$ORIGIN")
endif()


add_compile_definitions(SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_OFF)
Expand All @@ -26,8 +32,6 @@ endif()
if(NOT TARGET glbinding::glbinding-aux)
message(STATUS "Adding glbinding...")
add_subdirectory(${LIB_DIR}/glbinding)
install(TARGETS glbinding DESTINATION slamd OPTIONAL)
install(TARGETS glbinding-aux DESTINATION slamd OPTIONAL)
endif()

if(NOT TARGET glfw)
Expand All @@ -47,7 +51,8 @@ if(NOT TARGET slamd)
endif()


find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)

find_package(Python REQUIRED COMPONENTS Interpreter Development.Module REQUIRED)

# Try to find installed pybind11
find_package(pybind11 CONFIG QUIET)
Expand All @@ -63,9 +68,10 @@ if(NOT pybind11_FOUND)
FetchContent_MakeAvailable(pybind11)
endif()

# === pybind11 module ===
pybind11_add_module(bindings src/main.cpp)

set(BUILD_SHARED_LIBS ON)
set(PYBIND11_PYTHON_TARGET "Python::Module")
pybind11_add_module(bindings MODULE src/main.cpp)
set(BUILD_SHARED_LIBS OFF)

target_include_directories(
bindings
Expand All @@ -87,21 +93,7 @@ target_link_libraries(bindings
glfw
glbinding::glbinding
glbinding::glbinding-aux
fmt::fmt
)

set_target_properties(bindings PROPERTIES
INSTALL_RPATH "$ORIGIN"
)

set_target_properties(slamd_window PROPERTIES
INSTALL_RPATH "$ORIGIN"
)

# === Install the pybind11 module ===
install(TARGETS bindings DESTINATION slamd)

install(TARGETS slamd_window DESTINATION slamd)

# === Install your shared libraries ===

# Example: install slamd if it's a shared lib
2 changes: 1 addition & 1 deletion python_bindings/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ slamd-window = "slamd:_window_cli"
minimum-version = "build-system.requires"

[tool.cibuildwheel]
skip = ["*musllinux*", "*win*", "*macos*", "pp*"]
skip = ["*musllinux*", "*win*", "pp*"]
16 changes: 5 additions & 11 deletions slamd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.22)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

Expand All @@ -11,14 +11,6 @@ project(slam_dunk VERSION 0.1.0)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# Check if our lord and savious ccache exists
# We use ccache to massively speed up recompile times
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)

set(LIB_DIR vendored_deps)

function(find_required_package
Expand Down Expand Up @@ -75,6 +67,7 @@ find_required_package(
${LIB_DIR}/imgui_wrapper
)

add_subdirectory(${LIB_DIR}/fmt)
add_subdirectory(${LIB_DIR}/glm)
add_subdirectory(${LIB_DIR}/cxxopts)

Expand All @@ -87,6 +80,8 @@ target_sources(
slamd_common

PRIVATE
src/common/assert.cpp

src/common/data/image.cpp
src/common/data/mesh.cpp

Expand Down Expand Up @@ -118,6 +113,7 @@ target_link_libraries(
spdlog::spdlog
slamd_flatbuff
cxxopts
fmt::fmt

PRIVATE
spdlog::spdlog
Expand All @@ -141,7 +137,6 @@ target_sources(
src/window/shaders.cpp
src/window/arcball.cpp
src/window/frame_timer.cpp
src/window/assert.cpp
src/window/window.cpp
src/window/state_manager.cpp
src/window/connection.cpp
Expand Down Expand Up @@ -217,7 +212,6 @@ target_sources(
slamd

PRIVATE
src/slamd/assert.cpp
src/slamd/visualizer.cpp
src/slamd/view.cpp
src/slamd/spawn_window.cpp
Expand Down
6 changes: 3 additions & 3 deletions slamd/include/slamd/net/connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <cstdint>
#include <memory>
#include <slamd_common/utils/thread_safe_queue.hpp>
#include <stop_token>
#include <thread>

namespace slamd {
Expand All @@ -18,8 +17,9 @@ class Connection : public std::enable_shared_from_this<Connection> {
bool is_alive();

private:
std::jthread worker;
void job(std::stop_token& stop_token);
std::thread worker;
std::atomic<bool> stop_requested = false;
void job();

bool alive;
asio::ip::tcp::socket socket;
Expand Down
6 changes: 3 additions & 3 deletions slamd/include/slamd/visualizer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <slamd/tree/tree.hpp>
#include <slamd/view.hpp>
#include <slamd_common/id.hpp>
#include <stop_token>
#include <thread>

namespace slamd {
Expand Down Expand Up @@ -35,7 +34,7 @@ class Visualizer : public std::enable_shared_from_this<Visualizer> {
void broadcast(std::shared_ptr<std::vector<uint8_t>> message_buffer);

private:
void server_job(std::stop_token& stop_token);
void server_job();
std::vector<uint8_t> get_state();
flatbuffers::Offset<
flatbuffers::Vector<flatbuffers::Offset<flatb::Geometry>>>
Expand All @@ -49,7 +48,8 @@ class Visualizer : public std::enable_shared_from_this<Visualizer> {
private:
const uint16_t port;
const std::string name;
std::jthread server_thread;
std::thread server_thread;
std::atomic<bool> stop_requested = false;

std::mutex view_map_mutex;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include <optional>
#include <stdexcept>
#include <thread>

namespace slamd {
Expand Down
7 changes: 7 additions & 0 deletions slamd/include/slamd_common/numbers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

namespace slamd {
namespace _num {
constexpr float pi = 3.14159265358979323846f;
}
} // namespace slamd
18 changes: 0 additions & 18 deletions slamd/include/slamd_window/assert.hpp

This file was deleted.

5 changes: 3 additions & 2 deletions slamd/include/slamd_window/connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ class Connection {
_utils::ThreadSafeQueue<std::unique_ptr<Message>> messages;

private:
void job(std::stop_token& stop_token);
void job();

std::jthread job_thread;
std::thread job_thread;
std::atomic<bool> stop_requested = false;
};

} // namespace slamd
Loading
Loading