Skip to content

Commit 23997bf

Browse files
committed
fixes and tests
* removing logging * error code from build.sh * designs, emb_gget/emb_gset * fixing all Werror messages * ScriptEnv variables * more status badges * tree fixes * Update FUNDING.yml * setting up doxygen * make check functions * fixing emb_create_leaf * CTest discovery and cmake copying files into build directory * not supporting java directly * admonition in README for Python version * testing tree code, fixing various tree bugs * docs -> doc * user required to build API docs * needle * better ScriptEnv * moving designs out * simplifying: removing extern, postscript support * better error reporting setup for attributes * test fixes
1 parent 77175f1 commit 23997bf

File tree

526 files changed

+16619
-137452
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

526 files changed

+16619
-137452
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# These are supported funding model platforms
22

3-
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
3+
github: [robin-swift]
44
patreon: # Replace with a single Patreon username
55
open_collective: embroidermodder
66
ko_fi: # Replace with a single Ko-fi username

.github/workflows/build.yml

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,50 @@
1-
name: Test build
1+
name: Build
2+
3+
# Note that we don't allow reuseable workflows as a security measure.
4+
# This mainly is a setup to call bin/build.sh.
25

36
on:
47
push:
5-
branches: ["main"]
8+
branches:
9+
- main
10+
paths-ignore:
11+
- '**.md'
12+
pull_request:
613
workflow_dispatch:
7-
schedule:
8-
- cron: "15 3 * * 2"
914

1015
jobs:
11-
os_matrix:
12-
strategy:
13-
matrix:
14-
os: [ubuntu-latest, macos-latest, windows-latest]
15-
runs-on: ${{ matrix.os }}
16+
build-linux:
17+
runs-on: ubuntu-latest
18+
env:
19+
HOST_SYSTEM: 'Ubuntu'
20+
CMAKE_GENERATOR: 'Ninja'
21+
steps:
22+
- name: Build
23+
run: |
24+
git clone https://github.com/embroidermodder/libembroidery
25+
cd libembroidery
26+
bash bin/build.sh "Ubuntu"
27+
28+
build-macos:
29+
runs-on: macos-latest
30+
env:
31+
HOST_SYSTEM: 'MacOS'
32+
CMAKE_GENERATOR: 'Ninja'
33+
steps:
34+
- name: Build
35+
run: |
36+
git clone https://github.com/embroidermodder/libembroidery
37+
cd libembroidery
38+
bash bin/build.sh "MacOS"
39+
40+
build-windows:
41+
runs-on: windows-latest
42+
env:
43+
HOST_SYSTEM: 'Windows'
44+
CMAKE_GENERATOR: 'Ninja'
1645
steps:
1746
- name: Build
1847
run: |
1948
git clone https://github.com/embroidermodder/libembroidery
2049
cd libembroidery
21-
bash build.sh --github
50+
bash bin/build.sh "Windows"

CMakeLists.txt

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ project(libembroidery VERSION 1.0.0 LANGUAGES C)
55
set(CMAKE_C_STANDARD 90)
66
set(CMAKE_C_STANDARD_REQUIRED True)
77

8-
option( EMBROIDERY_BUILD_SHARED_LIBS "Build shared library." ON )
9-
option( EMBROIDERY_BUILD_CLI "Build embroider command line tool." ON )
10-
option( EMBROIDERY_TESTING "Run tests." ON )
11-
128
if (WIN32)
139
#add_compile_options(
1410
# -O2
@@ -31,47 +27,73 @@ set(LIBRARY_SRC
3127
src/formats.c
3228
src/geometry.c
3329
src/script.c
34-
src/testing.c
3530
src/data.c
3631
src/embroidery.h
37-
38-
extern/mpc/mpc.c
39-
extern/mpc/mpc.h
4032
)
4133

4234
add_library(embroidery_static STATIC ${LIBRARY_SRC})
4335

44-
if(EMBROIDERY_BUILD_SHARED_LIBS)
4536
add_library(embroidery SHARED ${LIBRARY_SRC})
46-
4737
target_compile_definitions(embroidery PUBLIC LIBEMBROIDERY_SHARED)
48-
endif()
4938

50-
if(EMBROIDERY_BUILD_CLI)
51-
add_executable(embroider src/embroider.c)
39+
add_executable(emb_convert src/emb_convert.c)
40+
target_link_libraries(emb_convert PRIVATE embroidery_static)
5241

5342
if (WIN32)
5443
else (WIN32)
55-
target_link_libraries(embroider PRIVATE m)
44+
target_link_libraries(emb_convert PRIVATE m)
5645
endif (WIN32)
57-
endif()
5846

59-
if(EMBROIDERY_BUILD_SHARED_LIBS)
47+
function(new_test NAME)
48+
add_executable(test_${NAME} EXCLUDE_FROM_ALL test/${NAME}.c)
49+
50+
target_link_libraries(test_${NAME} PRIVATE embroidery_static)
51+
52+
if (WIN32)
53+
else (WIN32)
54+
target_link_libraries(test_${NAME} PRIVATE m)
55+
endif (WIN32)
56+
57+
add_test(test_${NAME} test_${NAME})
58+
add_dependencies(check test_${NAME})
59+
endfunction()
60+
61+
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
62+
63+
# Generate tests by removing the ".c" extension from the filenames in
64+
# "test/" then passing to "new_test".
65+
file(GLOB TEST_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/test "test/*")
66+
foreach(FILE ${TEST_FILES})
67+
string(REPLACE ".c" "" TEST_NAME ${FILE})
68+
message("-- Adding test ${TEST_NAME}.")
69+
new_test("${TEST_NAME}")
70+
endforeach()
71+
72+
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/CTestTestfile.cmake"
73+
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
74+
6075
if(WIN32)
6176

6277
# TODO: Test this.
6378
# https://cmake.org/cmake/help/book/mastering-cmake/chapter/Install.html
79+
#
80+
# Does the location get added to the Windows PATH?
6481

6582
install(
6683
FILES src/embroidery.h
6784
DESTINATION "<SystemDrive>/Program Files/<Project Name>"
6885
)
6986

87+
install(
88+
FILES bin/needle
89+
DESTINATION "<SystemDrive>/Program Files/<Project Name>"
90+
)
91+
7092
install(
7193
TARGETS
7294
embroidery
7395
embroidery_static
74-
embroider
96+
emb_convert
7597
EXPORT embroidery
7698
LIBRARY DESTINATION "<SystemDrive>/Program Files/<Project Name>"
7799
ARCHIVE DESTINATION "<SystemDrive>/Program Files/<Project Name>"
@@ -87,18 +109,23 @@ install(
87109
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
88110
)
89111

112+
install(
113+
FILES bin/needle
114+
DESTINATION ${CMAKE_INSTALL_BINDIR}
115+
)
116+
90117
install(
91118
TARGETS
92119
embroidery
93120
embroidery_static
94-
embroider
121+
emb_convert
95122
EXPORT embroidery
96123
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
97124
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
98125
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
99126
)
127+
100128
endif(WIN32)
101-
endif()
102129

103130
# https://cmake.org/cmake/help/book/mastering-cmake/chapter/Packaging%20With%20CPack.html
104131

CTestTestfile.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Generate tests by removing the ".c" extension from the filenames in
2+
# "test/" then passing to "new_test".
3+
file(GLOB TEST_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/test "test/*")
4+
foreach(FILE ${TEST_FILES})
5+
string(REPLACE ".c" "" TEST_NAME ${FILE})
6+
message("-- Adding test ${TEST_NAME}.")
7+
add_test(test_${TEST_NAME} test_${TEST_NAME})
8+
endforeach()

0 commit comments

Comments
 (0)