From fe8531e7cba9dd62d2a97469b8a1b3551116639f Mon Sep 17 00:00:00 2001 From: Stephen Smith Date: Mon, 21 Jul 2025 15:48:14 +0100 Subject: [PATCH 1/5] use docker build --- .github/workflows/main.yml | 12 ++++++----- DockerFile | 20 +++++++++++++++++++ pythonfmu3/pythonfmu-export/CMakeLists.txt | 4 ++-- .../pythonfmu-export/src/CMakeLists.txt | 4 ++-- 4 files changed, 31 insertions(+), 9 deletions(-) create mode 100644 DockerFile diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dda10f1..0294bae 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,11 +37,13 @@ jobs: - name: Compile wrapper on Linux / macOS if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') run: | - mkdir tmp-build - cd tmp-build - cmake $GITHUB_WORKSPACE/pythonfmu3/pythonfmu-export -DCMAKE_BUILD_TYPE=Release - cmake --build . --config Release - cd .. + docker build -f DockerFile -t pythonfmu3-wrapper --target build . + + - name: Create container and copy out artifact + run: | + docker create --name extract pythonfmu3-wrapper + docker cp extract:/io/pythonfmu3/resources . + docker rm extract - name: Archive wrapper library uses: actions/upload-artifact@v4 diff --git a/DockerFile b/DockerFile new file mode 100644 index 0000000..c8e959b --- /dev/null +++ b/DockerFile @@ -0,0 +1,20 @@ +FROM quay.io/pypa/manylinux_2_28_x86_64 AS build + +RUN yum install -y \ + cmake \ + gcc \ + gcc-c++ \ + make \ + git \ + python3 \ + python3-pip \ + python3-devel + +WORKDIR /io + +COPY . . + +WORKDIR /io/tmp-build + +RUN cmake /io/pythonfmu3/pythonfmu-export -DCMAKE_BUILD_TYPE=Release \ + && cmake --build . --config Release \ No newline at end of file diff --git a/pythonfmu3/pythonfmu-export/CMakeLists.txt b/pythonfmu3/pythonfmu-export/CMakeLists.txt index 25222d4..d7e130f 100644 --- a/pythonfmu3/pythonfmu-export/CMakeLists.txt +++ b/pythonfmu3/pythonfmu-export/CMakeLists.txt @@ -35,9 +35,9 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) # Force to use stable Python ABI https://docs.python.org/3/c-api/stable.html add_compile_definitions(Py_LIMITED_API) -find_package(Python3 REQUIRED COMPONENTS Interpreter Development) +find_package(Python REQUIRED COMPONENTS Interpreter Development.Module) if (WIN32) - set(Python3_LIBRARIES ${Python3_LIBRARY_DIRS}/python3.lib) + set(Python3_LIBRARIES ${Python_LIBRARY_DIRS}/python3.lib) endif () if (WIN32) diff --git a/pythonfmu3/pythonfmu-export/src/CMakeLists.txt b/pythonfmu3/pythonfmu-export/src/CMakeLists.txt index b755cd4..d185aea 100644 --- a/pythonfmu3/pythonfmu-export/src/CMakeLists.txt +++ b/pythonfmu3/pythonfmu-export/src/CMakeLists.txt @@ -22,12 +22,12 @@ target_compile_features(pythonfmu-export PUBLIC "cxx_std_17") target_include_directories(pythonfmu-export PRIVATE - "${Python3_INCLUDE_DIRS}" + "${Python_INCLUDE_DIRS}" "${CMAKE_CURRENT_SOURCE_DIR}" ) if (WIN32) - target_link_libraries(pythonfmu-export PRIVATE ${Python3_LIBRARIES}) + target_link_libraries(pythonfmu-export PRIVATE ${Python_LIBRARIES}) elseif (APPLE) set_target_properties(pythonfmu-export PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") endif () From 2ae65fdc75b0525896dceedccb8b863f03fddda4 Mon Sep 17 00:00:00 2001 From: Stephen Smith Date: Mon, 21 Jul 2025 15:53:12 +0100 Subject: [PATCH 2/5] go back to find(python3) --- pythonfmu3/pythonfmu-export/CMakeLists.txt | 4 ++-- pythonfmu3/pythonfmu-export/src/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pythonfmu3/pythonfmu-export/CMakeLists.txt b/pythonfmu3/pythonfmu-export/CMakeLists.txt index d7e130f..8b48b84 100644 --- a/pythonfmu3/pythonfmu-export/CMakeLists.txt +++ b/pythonfmu3/pythonfmu-export/CMakeLists.txt @@ -35,9 +35,9 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) # Force to use stable Python ABI https://docs.python.org/3/c-api/stable.html add_compile_definitions(Py_LIMITED_API) -find_package(Python REQUIRED COMPONENTS Interpreter Development.Module) +find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module) if (WIN32) - set(Python3_LIBRARIES ${Python_LIBRARY_DIRS}/python3.lib) + set(Python3_LIBRARIES ${Python3_LIBRARY_DIRS}/python3.lib) endif () if (WIN32) diff --git a/pythonfmu3/pythonfmu-export/src/CMakeLists.txt b/pythonfmu3/pythonfmu-export/src/CMakeLists.txt index d185aea..dbb0d73 100644 --- a/pythonfmu3/pythonfmu-export/src/CMakeLists.txt +++ b/pythonfmu3/pythonfmu-export/src/CMakeLists.txt @@ -22,7 +22,7 @@ target_compile_features(pythonfmu-export PUBLIC "cxx_std_17") target_include_directories(pythonfmu-export PRIVATE - "${Python_INCLUDE_DIRS}" + "${Python3_INCLUDE_DIRS}" "${CMAKE_CURRENT_SOURCE_DIR}" ) From 42ba03d0162b1beb3cf609777eae88a5896593d3 Mon Sep 17 00:00:00 2001 From: Stephen Smith Date: Mon, 21 Jul 2025 15:55:23 +0100 Subject: [PATCH 3/5] fix cmake --- pythonfmu3/pythonfmu-export/src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonfmu3/pythonfmu-export/src/CMakeLists.txt b/pythonfmu3/pythonfmu-export/src/CMakeLists.txt index dbb0d73..b755cd4 100644 --- a/pythonfmu3/pythonfmu-export/src/CMakeLists.txt +++ b/pythonfmu3/pythonfmu-export/src/CMakeLists.txt @@ -27,7 +27,7 @@ target_include_directories(pythonfmu-export ) if (WIN32) - target_link_libraries(pythonfmu-export PRIVATE ${Python_LIBRARIES}) + target_link_libraries(pythonfmu-export PRIVATE ${Python3_LIBRARIES}) elseif (APPLE) set_target_properties(pythonfmu-export PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") endif () From e730fe2c8f37ce3bfc6756fa2e5c96740b8ab9c0 Mon Sep 17 00:00:00 2001 From: Stephen Smith Date: Mon, 21 Jul 2025 15:58:19 +0100 Subject: [PATCH 4/5] stop docker cp on windows --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0294bae..0a400f9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,6 +40,7 @@ jobs: docker build -f DockerFile -t pythonfmu3-wrapper --target build . - name: Create container and copy out artifact + if : startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') run: | docker create --name extract pythonfmu3-wrapper docker cp extract:/io/pythonfmu3/resources . From b540ce21a6fbe21b87a2853f14144e1533cee662 Mon Sep 17 00:00:00 2001 From: Stephen Smith Date: Mon, 21 Jul 2025 16:08:53 +0100 Subject: [PATCH 5/5] updatge path --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0a400f9..c84166b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,7 +43,7 @@ jobs: if : startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') run: | docker create --name extract pythonfmu3-wrapper - docker cp extract:/io/pythonfmu3/resources . + docker cp extract:/io/pythonfmu3/resources $GITHUB_WORKSPACE/pythonfmu3 docker rm extract - name: Archive wrapper library