Skip to content

Commit

Permalink
Add support for linking mbedtls on latest hxcpp
Browse files Browse the repository at this point in the history
The latest hxcpp makes it easier to link against the internal mbedtls,
however we still need backwards compatibility.

HaxeFoundation/hxcpp#1133
  • Loading branch information
tobil4sk authored and mcagabe19 committed Feb 14, 2025
1 parent d239395 commit 966cf97
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 13 deletions.
18 changes: 13 additions & 5 deletions project/lib/curl-files.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<xml>
<include name="${HXCPP}/src/hx/libs/ssl/Build.xml" />
<include name="${HXCPP}/project/thirdparty/mbedtls_files.xml" noerror="true" if="static_link"/>
<set name="HAS_HXCPP_MBEDTLS_FLAGS" value="1" if="MBEDTLS_DIR" />
<include name="${HXCPP}/src/hx/libs/ssl/Build.xml" unless="MBEDTLS_DIR"/>

<files id="native-toolkit-curl-depends" >
<depend name="${NATIVE_TOOLKIT_PATH}/curl/include/curl/curl.h" />
Expand Down Expand Up @@ -28,10 +30,16 @@
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/mbedtls/include" if="NATIVE_TOOLKIT_HAVE_MBEDTLS" unless="static_link"/>
<section if="static_link">

<compilerflag value="-I${MBEDTLS_DIR}/include" />
<compilerflag value="-I${HXCPP}/src/hx/libs/ssl" />
<compilerflag value="-I${this_dir}/custom/mbedtls_hxcpp" />
<compilerflag value="-DMBEDTLS_USER_CONFIG_FILE=&lt;mbedtls_config.h&gt;" />
<include name="${HXCPP}/project/thirdparty/mbedtls_flags.xml" if="HAS_HXCPP_MBEDTLS_FLAGS" />

<section unless="HAS_HXCPP_MBEDTLS_FLAGS">

<compilerflag value="-I${MBEDTLS_DIR}/include" />
<compilerflag value="-I${HXCPP}/src/hx/libs/ssl" />
<compilerflag value="-I${this_dir}/custom/mbedtls_hxcpp" />
<compilerflag value="-DMBEDTLS_USER_CONFIG_FILE=&lt;mbedtls_config.h&gt;" />

</section>

</section>

Expand Down
7 changes: 5 additions & 2 deletions templates/cpp/static/BuildMain.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

<include name="${HXCPP}/build-tool/BuildCommon.xml" />

<include name="${HXCPP}/src/hx/libs/ssl/Build.xml" />
<include name="${HXCPP}/project/thirdparty/mbedtls-files.xml" noerror="true" />
<set name="HAS_HXCPP_MBEDTLS_FILES" value="1" if="MBEDTLS_DIR" />
<include name="${HXCPP}/src/hx/libs/ssl/Build.xml" unless="HAS_HXCPP_MBEDTLS_FILES" />

<files id="main">

Expand All @@ -13,7 +15,8 @@
<target id="main" output="Main${DBG}" tool="linker" toolid="exe">

<files id="main" />
<files id="hxcpp_ssl" />
<files id="mbedtls" if="HAS_HXCPP_MBEDTLS_FILES" />
<files id="hxcpp_ssl" unless="HAS_HXCPP_MBEDTLS_FILES" />
::foreach ndlls::
<lib name="::path::" />::end::

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<xml>

<include name="${HXCPP}/build-tool/BuildCommon.xml" />
<include name="${HXCPP}/src/hx/libs/ssl/Build.xml" />
<include name="${HXCPP}/project/thirdparty/mbedtls-files.xml" noerror="true" />
<set name="HAS_HXCPP_MBEDTLS_FILES" value="1" if="MBEDTLS_DIR" />
<include name="${HXCPP}/build-tool/BuildCommon.xml" unless="HAS_HXCPP_MBEDTLS_FILES" />
<include name="${HXCPP}/src/hx/libs/ssl/Build.xml" unless="HAS_HXCPP_MBEDTLS_FILES" />

<target id="default" output="libmbedtls_hxcpp${DBG}" tool="linker" toolid="static_link">

<files id="hxcpp_ssl" />
<files id="mbedtls" if="HAS_HXCPP_MBEDTLS_FILES" />
<files id="hxcpp_ssl" unless="HAS_HXCPP_MBEDTLS_FILES" />

</target>

Expand Down
9 changes: 6 additions & 3 deletions templates/tvos/PROJ/haxe/BuildHxcppMbedtls.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<xml>

<include name="${HXCPP}/build-tool/BuildCommon.xml" />
<include name="${HXCPP}/src/hx/libs/ssl/Build.xml" />
<include name="${HXCPP}/project/thirdparty/mbedtls-files.xml" noerror="true" />
<set name="HAS_HXCPP_MBEDTLS_FILES" value="1" if="MBEDTLS_DIR" />
<include name="${HXCPP}/build-tool/BuildCommon.xml" unless="HAS_HXCPP_MBEDTLS_FILES" />
<include name="${HXCPP}/src/hx/libs/ssl/Build.xml" unless="HAS_HXCPP_MBEDTLS_FILES" />

<target id="default" output="libmbedtls_hxcpp${DBG}" tool="linker" toolid="static_link">

<files id="hxcpp_ssl" />
<files id="mbedtls" if="HAS_HXCPP_MBEDTLS_FILES" />
<files id="hxcpp_ssl" unless="HAS_HXCPP_MBEDTLS_FILES" />

</target>

Expand Down

0 comments on commit 966cf97

Please sign in to comment.