Skip to content
Open
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
28 changes: 24 additions & 4 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,38 @@ on:

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
include:
- os: ubuntu-latest
install_deps: sudo apt-get update && sudo apt-get install -y autoconf automake libtool libiconv-hook-dev || true
- os: macos-latest
install_deps: brew install autoconf automake libtool libiconv || true

runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install dependencies
run: ${{ matrix.install_deps }}

- name: autoreconf
run: autoreconf -vfi

- name: configure
run: ./configure

- name: make
run: make

- name: make check
run: make check
# - name: make distcheck
# run: make distcheck

- name: Run integration tests
run: |
if [ -f tests/run_tests.sh ]; then
chmod +x tests/run_tests.sh
./tests/run_tests.sh
fi
22 changes: 17 additions & 5 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,22 @@ jobs:
# 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
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
include:
- os: ubuntu-latest
install_deps: sudo apt-get update && sudo apt-get install -y libiconv-hook-dev || true
- os: macos-latest
install_deps: brew install libiconv || true

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install dependencies
run: ${{ matrix.install_deps }}

- 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.
Expand All @@ -32,7 +44,7 @@ jobs:

- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ debug
compile
.cproject
.project
.serena
CMakeCache.txt
cmake_install.cmake
src/intern/.dirstamp

# Docker build outputs
*.tar.gz
dxfrw-*.tar.gz
92 changes: 87 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project(libdxfrw)
project(libdxfrw VERSION 0.6.3)

# Enable testing
enable_testing()

file(GLOB libdxfrw_sources src/*.cpp)
file(GLOB libdxfrw_headers include/*.h)
file(GLOB libdxfrw_intern_sources src/intern/*.cpp)

# Find iconv library
if(WIN32)

include_directories(vs2013/packages/libiconv.1.14.0.11/build/native/include)
link_directories(vs2013/packages/libiconv.1.14.0.11/build/native/lib)
include_directories(vs2013/packages/libiconv.1.14.0.11/build/native/include)
link_directories(vs2013/packages/libiconv.1.14.0.11/build/native/lib)
set(ICONV_LIBRARY iconv)
else()
# On Unix-like systems (Linux, macOS)
find_package(Iconv REQUIRED)
if(Iconv_FOUND)
include_directories(${Iconv_INCLUDE_DIRS})
set(ICONV_LIBRARY ${Iconv_LIBRARIES})
else()
# Fallback: try to link against iconv directly
set(ICONV_LIBRARY iconv)
endif()
endif()

include_directories(include)

add_library(dxfrw STATIC ${libdxfrw_sources} ${libdxfrw_intern_sources})
target_link_libraries(dxfrw ${ICONV_LIBRARY})

install(FILES ${libdxfrw_headers} DESTINATION include)

Expand All @@ -29,4 +45,70 @@ else()
install(TARGETS dxfrw
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif()
endif()

# Tests
add_executable(test_basic tests/test_basic.cpp)
target_include_directories(test_basic PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests)
target_link_libraries(test_basic dxfrw ${ICONV_LIBRARY})
add_test(NAME BasicTests COMMAND test_basic)

add_executable(test_entities tests/test_entities.cpp)
target_include_directories(test_entities PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests)
target_link_libraries(test_entities dxfrw ${ICONV_LIBRARY})
add_test(NAME EntityTests COMMAND test_entities)

add_executable(test_polylines tests/test_polylines.cpp)
target_include_directories(test_polylines PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests)
target_link_libraries(test_polylines dxfrw ${ICONV_LIBRARY})
add_test(NAME PolylineTests COMMAND test_polylines)

add_executable(test_text tests/test_text.cpp)
target_include_directories(test_text PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests)
target_link_libraries(test_text dxfrw ${ICONV_LIBRARY})
add_test(NAME TextTests COMMAND test_text)

add_executable(test_tables tests/test_tables.cpp)
target_include_directories(test_tables PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests)
target_link_libraries(test_tables dxfrw ${ICONV_LIBRARY})
add_test(NAME TableTests COMMAND test_tables)

add_executable(test_blocks tests/test_blocks.cpp)
target_include_directories(test_blocks PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests)
target_link_libraries(test_blocks dxfrw ${ICONV_LIBRARY})
add_test(NAME BlockTests COMMAND test_blocks)

add_executable(test_versions tests/test_versions.cpp)
target_include_directories(test_versions PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests)
target_link_libraries(test_versions dxfrw ${ICONV_LIBRARY})
add_test(NAME VersionTests COMMAND test_versions)

add_executable(test_errors tests/test_errors.cpp)
target_include_directories(test_errors PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests)
target_link_libraries(test_errors dxfrw ${ICONV_LIBRARY})
add_test(NAME ErrorTests COMMAND test_errors)

add_executable(test_dimensions tests/test_dimensions.cpp)
target_include_directories(test_dimensions PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests)
target_link_libraries(test_dimensions dxfrw ${ICONV_LIBRARY})
add_test(NAME DimensionTests COMMAND test_dimensions)

add_executable(test_annotations tests/test_annotations.cpp)
target_include_directories(test_annotations PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests)
target_link_libraries(test_annotations dxfrw ${ICONV_LIBRARY})
add_test(NAME AnnotationTests COMMAND test_annotations)

add_executable(test_attributes tests/test_attributes.cpp)
target_include_directories(test_attributes PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests)
target_link_libraries(test_attributes dxfrw ${ICONV_LIBRARY})
add_test(NAME AttributeTests COMMAND test_attributes)

add_executable(test_class_underflow tests/test_class_underflow.cpp)
target_include_directories(test_class_underflow PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests)
target_link_libraries(test_class_underflow dxfrw ${ICONV_LIBRARY})
add_test(NAME ClassUnderflowTests COMMAND test_class_underflow)

add_executable(test_dwg_classes tests/test_dwg_classes.cpp)
target_include_directories(test_dwg_classes PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests)
target_link_libraries(test_dwg_classes dxfrw ${ICONV_LIBRARY})
add_test(NAME DWGClassParsingTests COMMAND test_dwg_classes)
12 changes: 0 additions & 12 deletions Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ACLOCAL_AMFLAGS = -I m4

SUBDIRS = src dwg2dxf dwg2text
SUBDIRS = src dwg2dxf dwg2text tests
Loading