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
27 changes: 21 additions & 6 deletions .github/workflows/libzedmd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ jobs:
fail-fast: false
matrix:
include:
- { os: windows-2025, platform: win, arch: x64, type: Release }
- { os: windows-2025, platform: win, arch: x64, type: Debug }
- { os: windows-2025, platform: win, arch: x86, type: Release }
- { os: windows-2025-vs2026, platform: win, arch: x64, type: Release }
- { os: windows-2025-vs2026, platform: win, arch: x64, type: Debug }
- { os: windows-2025-vs2026, platform: win, arch: x86, type: Release }
- { os: windows-2025, platform: win-mingw, arch: x64, type: Release }
- { os: macos-15, platform: macos, arch: arm64, type: Release }
- { os: macos-15, platform: macos, arch: x64, type: Release }
Expand All @@ -64,7 +64,22 @@ jobs:
# install dependencies
#
- if: (matrix.platform == 'win')
uses: microsoft/setup-msbuild@v2
uses: microsoft/setup-msbuild@v3
- if: (matrix.platform == 'win')
run: |
if [[ "${{ matrix.arch }}" == "x64" ]]; then
/c/msys64/usr/bin/bash.exe -l -c "pacman -S --noconfirm \
make diffutils autoconf automake libtool \
mingw-w64-ucrt-x86_64-gcc \
mingw-w64-ucrt-x86_64-libwinpthread \
mingw-w64-ucrt-x86_64-cmake"
else
/c/msys64/usr/bin/bash.exe -l -c "pacman -S --noconfirm \
make diffutils autoconf automake libtool \
mingw-w64-i686-gcc \
mingw-w64-i686-libwinpthread \
mingw-w64-i686-cmake"
fi
- if: (matrix.platform == 'win-mingw')
run: |
/c/msys64/usr/bin/bash.exe -l -c "pacman -S --noconfirm \
Expand All @@ -87,13 +102,13 @@ jobs:
./platforms/${{ matrix.platform }}/${{ matrix.arch }}/external.sh
if [[ "${{ matrix.arch }}" == "x64" ]]; then
cmake \
-G "Visual Studio 17 2022" \
-G "Visual Studio 18 2026" \
-DPLATFORM=${{ matrix.platform }} \
-DARCH=${{ matrix.arch }} \
-B build
else
cmake \
-G "Visual Studio 17 2022" \
-G "Visual Studio 18 2026" \
-A Win32 \
-DPLATFORM=${{ matrix.platform }} \
-DARCH=${{ matrix.arch }} \
Expand Down
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -339,18 +339,24 @@ if(POST_BUILD_COPY_EXT_LIBS AND (PLATFORM STREQUAL "win" OR PLATFORM STREQUAL "w
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_SOURCE_DIR}/third-party/build-libs/${PLATFORM}/${ARCH}/cargs64.lib" "${CMAKE_BINARY_DIR}"
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_SOURCE_DIR}/third-party/runtime-libs/${PLATFORM}/${ARCH}/cargs64.dll" "${CMAKE_BINARY_DIR}"
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_SOURCE_DIR}/third-party/build-libs/${PLATFORM}/${ARCH}/libserialport64.lib" "${CMAKE_BINARY_DIR}"
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_SOURCE_DIR}/third-party/runtime-libs/${PLATFORM}/${ARCH}/libserialport64.dll" "${CMAKE_BINARY_DIR}"
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_SOURCE_DIR}/third-party/runtime-libs/${PLATFORM}/${ARCH}/libserialport64-0.dll" "${CMAKE_BINARY_DIR}"
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_SOURCE_DIR}/third-party/build-libs/${PLATFORM}/${ARCH}/sockpp64.lib" "${CMAKE_BINARY_DIR}"
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_SOURCE_DIR}/third-party/runtime-libs/${PLATFORM}/${ARCH}/sockpp64.dll" "${CMAKE_BINARY_DIR}"
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_SOURCE_DIR}/third-party/runtime-libs/${PLATFORM}/${ARCH}/libgcc_s_seh-1.dll" "${CMAKE_BINARY_DIR}"
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_SOURCE_DIR}/third-party/runtime-libs/${PLATFORM}/${ARCH}/libstdc++-6.dll" "${CMAKE_BINARY_DIR}"
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_SOURCE_DIR}/third-party/runtime-libs/${PLATFORM}/${ARCH}/libwinpthread-1.dll" "${CMAKE_BINARY_DIR}"
)
else()
add_custom_command(TARGET copy_ext_libs POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_SOURCE_DIR}/third-party/build-libs/${PLATFORM}/${ARCH}/cargs.lib" "${CMAKE_BINARY_DIR}"
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_SOURCE_DIR}/third-party/runtime-libs/${PLATFORM}/${ARCH}/cargs.dll" "${CMAKE_BINARY_DIR}"
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_SOURCE_DIR}/third-party/build-libs/${PLATFORM}/${ARCH}/libserialport.lib" "${CMAKE_BINARY_DIR}"
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_SOURCE_DIR}/third-party/runtime-libs/${PLATFORM}/${ARCH}/libserialport.dll" "${CMAKE_BINARY_DIR}"
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_SOURCE_DIR}/third-party/runtime-libs/${PLATFORM}/${ARCH}/libserialport-0.dll" "${CMAKE_BINARY_DIR}"
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_SOURCE_DIR}/third-party/build-libs/${PLATFORM}/${ARCH}/sockpp.lib" "${CMAKE_BINARY_DIR}"
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_SOURCE_DIR}/third-party/runtime-libs/${PLATFORM}/${ARCH}/sockpp.dll" "${CMAKE_BINARY_DIR}"
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_SOURCE_DIR}/third-party/runtime-libs/${PLATFORM}/${ARCH}/libgcc_s_dw2-1.dll" "${CMAKE_BINARY_DIR}"
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_SOURCE_DIR}/third-party/runtime-libs/${PLATFORM}/${ARCH}/libstdc++-6.dll" "${CMAKE_BINARY_DIR}"
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_SOURCE_DIR}/third-party/runtime-libs/${PLATFORM}/${ARCH}/libwinpthread-1.dll" "${CMAKE_BINARY_DIR}"
)
endif()
elseif(PLATFORM STREQUAL "win-mingw")
Expand Down
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,35 @@ https://ppuc.github.io/libzedmd/docs/html/class_ze_d_m_d.html

## Compiling

#### Windows x64 (MSVC)
#### Windows (x64)

Requires MSYS2 for building external dependencies:

```shell
pacman -S --noconfirm make diffutils \
mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-libwinpthread \
mingw-w64-ucrt-x86_64-cmake
```

```shell
platforms/win/x64/external.sh
cmake -G "Visual Studio 17 2022" -DPLATFORM=win -DARCH=x64 -B build
cmake -G "Visual Studio 18 2026" -DPLATFORM=win -DARCH=x64 -B build
cmake --build build --config Release
```

#### Windows x86 (MSVC)
#### Windows (x86)

Requires MSYS2 for building external dependencies:

```shell
pacman -S --noconfirm make diffutils \
mingw-w64-i686-gcc mingw-w64-i686-libwinpthread \
mingw-w64-i686-cmake
```

```shell
platforms/win/x86/external.sh
cmake -G "Visual Studio 17 2022" -A Win32 -DPLATFORM=win -DARCH=x86 -B build
cmake -G "Visual Studio 18 2026" -A Win32 -DPLATFORM=win -DARCH=x86 -B build
cmake --build build --config Release
```

Expand Down
38 changes: 29 additions & 9 deletions platforms/win/x64/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

set -e

if [ -z "${MSYS2_PATH}" ]; then
MSYS2_PATH="/c/msys64"
fi

echo "MSYS2_PATH: ${MSYS2_PATH}"
echo ""

source ./platforms/config.sh

echo "Building libraries..."
Expand All @@ -25,7 +32,7 @@ mv cargs-${CARGS_SHA} cargs
cd cargs
sed -i.bak 's/set_target_properties(cargs PROPERTIES DEFINE_SYMBOL CAG_EXPORTS)/set_target_properties(cargs PROPERTIES DEFINE_SYMBOL CAG_EXPORTS)\nset_target_properties(cargs PROPERTIES OUTPUT_NAME cargs64)/' CMakeLists.txt
cmake \
-G "Visual Studio 17 2022" \
-G "Visual Studio 18 2026" \
-DBUILD_SHARED_LIBS=ON \
-B build
cmake --build build --config ${BUILD_TYPE}
Expand All @@ -43,13 +50,16 @@ tar xzf libserialport-${LIBSERIALPORT_SHA}.tar.gz
mv libserialport-${LIBSERIALPORT_SHA} libserialport
cd libserialport
cp libserialport.h ../../third-party/include
msbuild.exe libserialport.sln \
-p:PlatformToolset=v143 \
-p:TargetName=libserialport64 \
-p:Platform=x64 \
-p:Configuration=Release
cp x64/Release/libserialport64.lib ../../third-party/build-libs/win/x64
cp x64/Release/libserialport64.dll ../../third-party/runtime-libs/win/x64
sed -i.bak 's/libserialport\.la/libserialport64.la/g; s/libserialport_la/libserialport64_la/g' Makefile.am
CURRENT_DIR="$(pwd)"
MSYSTEM=UCRT64 "${MSYS2_PATH}/usr/bin/bash.exe" -l -c "
cd \"${CURRENT_DIR}\" &&
./autogen.sh &&
./configure &&
make -j\$(nproc)
"
cp .libs/libserialport64.dll.a ../../third-party/build-libs/win/x64/libserialport64.lib
cp .libs/libserialport64-0.dll ../../third-party/runtime-libs/win/x64/
cd ..

#
Expand All @@ -73,10 +83,20 @@ mv sockpp-${SOCKPP_SHA} sockpp
cd sockpp
sed -i.bak 's/set(SOCKPP_SHARED_LIBRARY sockpp)/set(SOCKPP_SHARED_LIBRARY sockpp64)/' CMakeLists.txt
cmake \
-G "Visual Studio 17 2022" \
-G "Visual Studio 18 2026" \
-B build
cmake --build build --config ${BUILD_TYPE}
cp -r include/sockpp ../../third-party/include/
cp build/${BUILD_TYPE}/sockpp64.lib ../../third-party/build-libs/win/x64/
cp build/${BUILD_TYPE}/sockpp64.dll ../../third-party/runtime-libs/win/x64/
cd ..

#
# copy UCRT64 runtime DLLs (needed by MinGW-built DLLs)
#

UCRT64_BIN="${MSYS2_PATH}/ucrt64/bin"

cp "${UCRT64_BIN}/libgcc_s_seh-1.dll" ../third-party/runtime-libs/win/x64/
cp "${UCRT64_BIN}/libstdc++-6.dll" ../third-party/runtime-libs/win/x64/
cp "${UCRT64_BIN}/libwinpthread-1.dll" ../third-party/runtime-libs/win/x64/
36 changes: 28 additions & 8 deletions platforms/win/x86/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

set -e

if [ -z "${MSYS2_PATH}" ]; then
MSYS2_PATH="/c/msys64"
fi

echo "MSYS2_PATH: ${MSYS2_PATH}"
echo ""

source ./platforms/config.sh

echo "Building libraries..."
Expand All @@ -24,7 +31,7 @@ tar xzf cargs-${CARGS_SHA}.tar.gz
mv cargs-${CARGS_SHA} cargs
cd cargs
cmake \
-G "Visual Studio 17 2022" \
-G "Visual Studio 18 2026" \
-DBUILD_SHARED_LIBS=ON \
-A Win32 \
-B build
Expand All @@ -43,12 +50,15 @@ tar xzf libserialport-${LIBSERIALPORT_SHA}.tar.gz
mv libserialport-${LIBSERIALPORT_SHA} libserialport
cd libserialport
cp libserialport.h ../../third-party/include
msbuild.exe libserialport.sln \
-p:Platform=x86 \
-p:PlatformToolset=v143 \
-p:Configuration=Release
cp Release/libserialport.lib ../../third-party/build-libs/win/x86
cp Release/libserialport.dll ../../third-party/runtime-libs/win/x86
CURRENT_DIR="$(pwd)"
MSYSTEM=MINGW32 "${MSYS2_PATH}/usr/bin/bash.exe" -l -c "
cd \"${CURRENT_DIR}\" &&
./autogen.sh &&
./configure &&
make -j\$(nproc)
"
cp .libs/libserialport.dll.a ../../third-party/build-libs/win/x86/libserialport.lib
cp .libs/libserialport-0.dll ../../third-party/runtime-libs/win/x86/
cd ..

#
Expand All @@ -71,11 +81,21 @@ tar xzf sockpp-${SOCKPP_SHA}.tar.gz
mv sockpp-${SOCKPP_SHA} sockpp
cd sockpp
cmake \
-G "Visual Studio 17 2022" \
-G "Visual Studio 18 2026" \
-A Win32 \
-B build
cmake --build build --config ${BUILD_TYPE}
cp -r include/sockpp ../../third-party/include/
cp build/${BUILD_TYPE}/sockpp.lib ../../third-party/build-libs/win/x86/
cp build/${BUILD_TYPE}/sockpp.dll ../../third-party/runtime-libs/win/x86/
cd ..

#
# copy MINGW32 runtime DLLs (needed by MinGW-built DLLs)
#

MINGW32_BIN="${MSYS2_PATH}/mingw32/bin"

cp "${MINGW32_BIN}/libgcc_s_dw2-1.dll" ../third-party/runtime-libs/win/x86/
cp "${MINGW32_BIN}/libstdc++-6.dll" ../third-party/runtime-libs/win/x86/
cp "${MINGW32_BIN}/libwinpthread-1.dll" ../third-party/runtime-libs/win/x86/
Loading