File tree Expand file tree Collapse file tree 2 files changed +55
-3
lines changed
Expand file tree Collapse file tree 2 files changed +55
-3
lines changed Original file line number Diff line number Diff line change 7575 run : cmake --build build --config ${{ matrix.build_type }}
7676 - name : Test
7777 run : ctest --test-dir build -C ${{ matrix.build_type }} --output-on-failure
78+ - name : Package (Windows)
79+ if : runner.os == 'Windows'
80+ working-directory : build
81+ run : cpack -G ZIP -C ${{ matrix.build_type }}
82+ - name : Package (Linux/macOS)
83+ if : runner.os != 'Windows'
84+ working-directory : build
85+ run : cpack -G TGZ -C ${{ matrix.build_type }}
86+ - name : Upload package (Windows)
87+ if : runner.os == 'Windows'
88+ uses : actions/upload-artifact@v4
89+ with :
90+ name : grid-sim-${{ runner.os }}-${{ matrix.build_type }}
91+ path : build/*.zip
92+ - name : Upload package (Linux/macOS)
93+ if : runner.os != 'Windows'
94+ uses : actions/upload-artifact@v4
95+ with :
96+ name : grid-sim-${{ runner.os }}-${{ matrix.build_type }}
97+ path : build/*.tar.gz
98+
99+ package-source :
100+ runs-on : ubuntu-latest
101+ steps :
102+ - name : Checkout
103+ uses : actions/checkout@v4
104+ with :
105+ submodules : recursive
106+ - name : Configure
107+ run : >
108+ cmake -S . -B build
109+ -DCMAKE_BUILD_TYPE=Release
110+ -DBUILD_VISUALIZATION=OFF
111+ -DBUILD_EXAMPLES=OFF
112+ - name : Package source
113+ run : cpack -G TGZ --config build/CPackSourceConfig.cmake
114+ - name : Upload source package
115+ uses : actions/upload-artifact@v4
116+ with :
117+ name : grid-sim-source
118+ path : build/*Source*.tar.gz
Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ if(BUILD_EXAMPLES)
125125 install (TARGETS example_visualization DESTINATION bin)
126126 endif ()
127127endif ()
128- install (DIRECTORY include/grid_sim/ DESTINATION include)
128+ install (DIRECTORY include/ DESTINATION include)
129129
130130# 可选:定义不同平台的条件编译设置
131131if (WIN32 )
@@ -134,5 +134,16 @@ elseif(UNIX)
134134 message (STATUS "Compiling on Unix-like system" )
135135endif ()
136136
137-
138-
137+ # CPack config (binary + source packages)
138+ set (CPACK_PACKAGE_NAME "${PROJECT_NAME} " )
139+ set (CPACK_PACKAGE_VERSION "${PROJECT_VERSION} " )
140+ set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Grid simulation system" )
141+ set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR} /LICENSE.txt" )
142+ set (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR} /README.md" )
143+ set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME} -${CPACK_PACKAGE_VERSION} -${CMAKE_SYSTEM_NAME} -${CMAKE_SYSTEM_PROCESSOR} " )
144+ set (CPACK_SOURCE_GENERATOR "TGZ;ZIP" )
145+ set (CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME} -${CPACK_PACKAGE_VERSION} -Source" )
146+ set (CPACK_SOURCE_IGNORE_FILES
147+ "/build/;/out/;/bin/;/lib/;/cmake-build-.*/;/.git/;/.vs/;/.vscode/;/.github/;~$;${CPACK_SOURCE_IGNORE_FILES} "
148+ )
149+ include (CPack )
You can’t perform that action at this time.
0 commit comments