Skip to content

Commit ee8b570

Browse files
committed
Fix CMakeLists
1 parent b7d0ede commit ee8b570

3 files changed

Lines changed: 20 additions & 13 deletions

File tree

.github/workflows/build-mxe.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
uses: actions/cache@v4
2626
with:
2727
path: mxe
28-
key: ${{ runner.os }}-mxe-v${{ inputs.MXE_VERSION }}-gcc${{ inputs.GCC_VERSION }}-jsoncpp-sdl_net-v6
28+
key: ${{ runner.os }}-mxe-v${{ inputs.MXE_VERSION }}-gcc${{ inputs.GCC_VERSION }}-jsoncpp-sdl_net-v7
2929

3030
- name: Install MXE dependencies (only if no cache)
3131
if: steps.cache-mxe.outputs.cache-hit != 'true'

.github/workflows/build-winxp.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,12 @@ jobs:
5858
uses: actions/cache@v4
5959
with:
6060
path: mxe
61-
key: ${{ runner.os }}-mxe-v7e39b555dee5e906b24a44940055dc28d4056d23-gcc11-jsoncpp-sdl_net-v6
61+
key: ${{ runner.os }}-mxe-v7e39b555dee5e906b24a44940055dc28d4056d23-gcc11-jsoncpp-sdl_net-v7
6262

6363
- name: Configure + build (WinXP)
6464
run: |
65+
set -euo pipefail
66+
6567
export PATH="$GITHUB_WORKSPACE/mxe/usr/bin:$PATH"
6668
6769
# MXE prefix for the i686 static target
@@ -71,24 +73,29 @@ jobs:
7173
export CMAKE_PREFIX_PATH="$MXE_PREFIX"
7274
export PKG_CONFIG_PATH="$MXE_PREFIX/lib/pkgconfig"
7375
74-
# IMPORTANT (Option 1):
75-
# Use MXE's jsoncpp headers (v1.9.1) instead of repo headers (v1.9.7),
76-
# to match the jsoncpp library we link against.
77-
export CPPFLAGS="-I$MXE_PREFIX/include/jsoncpp -I$MXE_PREFIX/include -I$MXE_PREFIX/include/SDL -I$GITHUB_WORKSPACE/deps/include/SDL_net -I$GITHUB_WORKSPACE/deps/include"
78-
export CFLAGS="$CPPFLAGS"
79-
export CXXFLAGS="$CPPFLAGS"
80-
81-
echo "=== DEBUG: jsoncpp version headers present ==="
82-
ls -la "$MXE_PREFIX/include/jsoncpp/json/version.h" || true
76+
echo "=== DEBUG: where is jsoncpp header in MXE? ==="
77+
ls -la "$MXE_PREFIX/include/json/json.h" || true
78+
ls -la "$MXE_PREFIX/include/jsoncpp/json/json.h" || true
79+
ls -la "$MXE_PREFIX/include/json/version.h" || true
8380
ls -la "$GITHUB_WORKSPACE/deps/include/json/version.h" || true
8481
8582
echo "=== DEBUG: key libs present in MXE_PREFIX/lib ==="
8683
ls -la "$MXE_PREFIX/lib" | grep -Ei "json|sdl|jpeg|png|webp|smpeg|modplug|vorbis|ogg|ws2|iphlp|winmm|dxguid" || true
8784
85+
# IMPORTANT:
86+
# Do NOT use -I$MXE_PREFIX/include/jsoncpp because it doesn't exist in your MXE layout.
87+
# Put MXE include FIRST so <json/json.h> resolves to MXE headers (matching libjsoncpp.a),
88+
# and keep deps/include later (for other headers).
89+
export CPPFLAGS="-I$MXE_PREFIX/include -I$MXE_PREFIX/include/SDL -I$GITHUB_WORKSPACE/deps/include/SDL_net -I$GITHUB_WORKSPACE/deps/include"
90+
export CFLAGS="$CPPFLAGS"
91+
export CXXFLAGS="$CPPFLAGS"
92+
8893
# NOTE (Option A):
8994
# Do NOT force -l... libs via LDFLAGS here.
9095
# The corrected src/CMakeLists.txt links required libs with correct ordering.
96+
unset LDFLAGS || true
9197
98+
rm -rf build
9299
mkdir -p build
93100
cd build
94101

src/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ if ( WIN32 )
643643
target_link_options(openxcom PRIVATE -mwindows -static)
644644

645645
# Required deps for static SDL_net / SDL_image / audio / etc.
646-
target_link_libraries(openxcom PRIVATE
646+
target_link_libraries ( openxcom PRIVATE PRIVATE
647647
ws2_32 iphlpapi # SDL_net (Winsock + GetAdaptersInfo)
648648
winmm # SDL_mixer MIDI on Windows
649649
dxguid # DirectDraw IID_* symbols
@@ -666,7 +666,7 @@ else()
666666
endif()
667667

668668
# Final link line (works on Linux/macOS because WIN32 vars stay empty there)
669-
target_link_libraries ( openxcom
669+
target_link_libraries ( openxcom PRIVATE
670670
${system_libs}
671671
${PKG_DEPS_LDFLAGS}
672672
${JSONCPP_LINK}

0 commit comments

Comments
 (0)