Skip to content

Commit fc2aa2d

Browse files
committed
build: external include directories are relocatable
1 parent 26cec9d commit fc2aa2d

File tree

4 files changed

+139
-82
lines changed

4 files changed

+139
-82
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,19 @@ jobs:
209209
fi
210210
echo -E "llvm-root=$llvm_root" >> $GITHUB_OUTPUT
211211
212+
- name: Resolve Third-Party Directory
213+
id: resolve-third-party-dir
214+
run: |
215+
set -x
216+
cd ..
217+
third_party_dir=$(pwd)/third-party
218+
if [[ ${{ runner.os }} == 'Windows' ]]; then
219+
third_party_dir=$(echo "$third_party_dir" | sed 's/\\/\//g')
220+
third_party_dir=$(echo $third_party_dir | sed 's|^/d/|D:/|')
221+
echo "$third_party_dir"
222+
fi
223+
echo -E "third-party-dir=$third_party_dir" >> $GITHUB_OUTPUT
224+
212225
- name: Cached LLVM Binaries
213226
id: llvm-cache
214227
uses: actions/cache@v4
@@ -365,10 +378,10 @@ jobs:
365378
install-prefix: .local
366379
extra-args: |
367380
-D MRDOCS_BUILD_DOCS=OFF
368-
-D LLVM_ROOT=../third-party/llvm-project/install
369-
-D Clang_ROOT=../third-party/llvm-project/install
370-
-D duktape_ROOT=../third-party/duktape/install
371-
-D Duktape_ROOT=../third-party/duktape/install
381+
-D LLVM_ROOT=${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/llvm-project/install
382+
-D Clang_ROOT=${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/llvm-project/install
383+
-D duktape_ROOT=${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/duktape/install
384+
-D Duktape_ROOT=${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/duktape/install
372385
${{ runner.os == 'Windows' && '-D libxml2_ROOT=../third-party/libxml2/install' || '' }}
373386
${{ runner.os == 'Windows' && '-D LibXml2_ROOT=../third-party/libxml2/install' || '' }}
374387
export-compile-commands: true

CMakeLists.txt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,17 @@ target_compile_definitions(
224224
)
225225

226226
# Dependencies
227-
target_include_directories(mrdocs-core SYSTEM PUBLIC ${LLVM_INCLUDE_DIRS})
228-
target_include_directories(mrdocs-core SYSTEM PUBLIC ${CLANG_INCLUDE_DIRS})
229-
target_include_directories(mrdocs-core SYSTEM PRIVATE ${DUKTAPE_INCLUDE_DIRS})
227+
target_include_directories(mrdocs-core
228+
SYSTEM PUBLIC
229+
$<BUILD_INTERFACE:${LLVM_INCLUDE_DIRS}>
230+
$<BUILD_INTERFACE:${CLANG_INCLUDE_DIRS}>
231+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
232+
)
233+
target_include_directories(mrdocs-core
234+
SYSTEM PRIVATE
235+
$<BUILD_INTERFACE:${DUKTAPE_INCLUDE_DIRS}>
236+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
237+
)
230238
target_link_libraries(mrdocs-core PRIVATE ${DUKTAPE_LIBRARY})
231239

232240
# Clang

0 commit comments

Comments
 (0)