File tree Expand file tree Collapse file tree 3 files changed +27
-1
lines changed
Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change 3737 "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$(pwd)/build/output/bin" `
3838 "-DCMAKE_PDB_OUTPUT_DIRECTORY=$(pwd)/build/output/pdb" `
3939 -DPROJECT_VERSION_TWEAK=${{github.run_number}} `
40- "-DBUILD_METADATA=gha.${{github.run_number}}"
40+ "-DBUILD_METADATA=gha.${{github.run_number}}" `
41+ "-DSOURCELINK=https://raw.githubusercontent.com/${{github.repository}}/${{github.sha}}"
4142 - name : Build
4243 run : cmake --build build --config ${{matrix.kind}} --parallel
4344 - name : Upload artifacts
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.25..4.2 FATAL_ERROR)
33list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR} /cmake" )
44include (hybrid-crt )
55include (smol-binaries )
6+ include (sourcelink )
67
78if (NOT PROJECT_VERSION_TWEAK )
89 set (PROJECT_VERSION_TWEAK 0)
Original file line number Diff line number Diff line change 1+ set (SOURCELINK "" CACHE STRING "URL to retrieve the source" )
2+ if (NOT SOURCELINK)
3+ return ()
4+ endif ()
5+
6+ if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" )
7+ message (WARNING "SOURCELINK was specified, but not using MSVC-compatible compiler ID" )
8+ return ()
9+ endif ()
10+
11+ message (STATUS "Using SOURCELINK: ${SOURCELINK} " )
12+ cmake_path (
13+ NATIVE_PATH
14+ CMAKE_SOURCE_DIR
15+ NORMALIZE
16+ NATIVE_SOURCE
17+ )
18+ string (REPLACE "\\ " "\\\\ " NATIVE_SOURCE "${NATIVE_SOURCE} " )
19+ file (
20+ WRITE
21+ "${CMAKE_CURRENT_BINARY_DIR} /sourcelink.json"
22+ "{ \" documents\" : { \" ${NATIVE_SOURCE} \\\\ *\" : \" ${SOURCELINK} /*\" } }"
23+ )
24+ add_link_options ("/SOURCELINK:${CMAKE_CURRENT_BINARY_DIR} /sourcelink.json" )
You can’t perform that action at this time.
0 commit comments