Skip to content
Closed
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
34 changes: 34 additions & 0 deletions .github/workflows/ubuntu-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Ubuntu tests

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DSTL_READER_BUILD_TESTS=ON

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build

- name: Test
working-directory: ${{github.workspace}}/build/tests
run: pwd && ls && ./stl_reader_tests
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.cache
compile_commands.json
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cmake_minimum_required (VERSION 3.15)

project (stl_reader)

add_library (stl_reader INTERFACE)
target_include_directories (stl_reader INTERFACE include)

option (STL_READER_BUILD_TESTS "Build the stl_reader tests." OFF)
if (STL_READER_BUILD_TESTS)
add_subdirectory (tests)
endif ()
19 changes: 19 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,25 @@ The function operates on template container types. Those containers should have

A convenience class `StlMesh` is also provided, which makes accessing triangle corners and corresponding corner coordinates much more easy. It still provides raw access to the underlying data arrays.

## CMake integration
`CMake` is entirely optional and not required to use **stl_reader**. However, starting from **v2.0**, **stl_reader** provides an interface library of the same name, which adds the required include path when being linked against some target. This is especially useful when using `CMake's` `FetchContent` mechanism in your `CMakeLists.txt`, e.g., like this:
```
include (FetchContent)
FetchContent_Declare (
stl_reader
GIT_REPOSITORY https://github.com/sreiter/stl_reader.git
GIT_TAG v2.0
)
FetchContent_MakeAvailable (stl_reader)
#...
target_link_libraries (YOUR_TARGET stl_reader)
```

You may then include **stl_reader.h** in your project like this:
```
#include <stl_reader/stl_reader.h>
```

## Documentation
Please have a look at the [**stl_reader.h file documentation**](http://sreiter.github.io/stl_reader/stl__reader_8h.html) for a detailed documentation of the provided functions.

Expand Down
2 changes: 1 addition & 1 deletion docs/doxygen_config/stl_reader.dconf
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.

INPUT = stl_reader.h \
INPUT = include/stl_reader/stl_reader.h \
Readme.md

# This tag can be used to specify the character encoding of the source files
Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ FetchContent_Declare (
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable (googletest)

target_link_libraries (stl_reader_tests gtest_main)
target_link_libraries (stl_reader_tests gtest_main stl_reader)

add_custom_target (copyResources ALL COMMAND cmake -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/data data)
add_dependencies (stl_reader_tests copyResources)
2 changes: 1 addition & 1 deletion tests/read_stl.t.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../stl_reader.h"
#include <stl_reader/stl_reader.h>
#include <gtest/gtest.h>

TEST (readSTL, asciiSphere)
Expand Down
2 changes: 1 addition & 1 deletion tests/utils.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "../stl_reader.h"
#include <stl_reader/stl_reader.h>

#include <array>
#include <iostream>
Expand Down
Loading