Skip to content
Snippets Groups Projects
Commit a990260c authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Adrien Béraud
Browse files

contrib(msc): fix Windows natpmp build

The natpmp CMake build has no installation specified, so currently
we use the root source directory which contains the header files as
an include path in the daemon build. This may cause issues as case
insensative header includes for the standard library <version> will
incorrectly load natpmp's 'VERSION' file.

This patch copies the project's headers to an include directory
post-build, and adjusts the daemon's include path.

Change-Id: I4b318fb0309c72b94f4ea4e757035780ee2a8a63
parent 0cc48cfd
No related branches found
No related tags found
No related merge requests found
......@@ -149,7 +149,7 @@ if(MSVC)
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/restinio/dev;"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/fmt/include;"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/http_parser;"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/natpmp"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/natpmp/include"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/msgpack-c/include;"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/opendht/include;"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/libarchive/libarchive;"
......@@ -257,7 +257,7 @@ if(MSVC)
${CMAKE_CURRENT_SOURCE_DIR}/contrib/msvc/lib/x64/secp256k1.lib
${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/yaml-cpp/msvc/Release/libyaml-cppmd.lib
${CMAKE_CURRENT_SOURCE_DIR}/contrib/msvc/lib/x64/libupnp.lib
${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/natpmp/msvc/Release/natpmp.lib
${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/natpmp/build/Release/natpmp.lib
${CMAKE_CURRENT_SOURCE_DIR}/contrib/msvc/lib/x64/archive_static.lib
${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/pjproject/pjsip/lib/pjsip-core-x86_64-x64-vc15-Release.lib
${CMAKE_CURRENT_SOURCE_DIR}/contrib/build/pjproject/pjsip/lib/pjsip-simple-x86_64-x64-vc15-Release.lib
......
......@@ -76,6 +76,7 @@ vs_where_path = os.path.join(
host_is_64bit = (False, True)[platform.machine().endswith('64')]
python_is_64bit = (False, True)[8 * struct.calcsize("P") == 64]
def getMd5ForDirectory(path):
hasher = hashlib.md5()
for root, _, files in os.walk(path, topdown=True):
......@@ -86,6 +87,7 @@ def getMd5ForDirectory(path):
hasher.update(buf)
return hasher.hexdigest()
def shellquote(s, windows=False):
if not windows:
return "'" + s.replace("'", "'\''") + "'"
......@@ -493,20 +495,20 @@ def build(pkg_name, pkg_dir, project_paths, custom_scripts, with_env, sdk,
# pre_build custom step (CMake...)
pre_build_scripts = custom_scripts.get("pre_build", [])
if pre_build_scripts:
log.debug('Pre_build phase')
for script in pre_build_scripts:
result = getSHrunner().exec_batch(script)
success &= not result[0]
build_operations += 1
log.debug('Pre-build phase')
for script in pre_build_scripts:
result = getSHrunner().exec_batch(script)
success &= not result[0]
build_operations += 1
# build custom step (nmake...)
build_scripts = custom_scripts.get("build", [])
if build_scripts:
log.debug('Custom Build phase')
for script in build_scripts:
result = getSHrunner().exec_batch(script)
success &= not result[0]
build_operations += 1
for script in build_scripts:
result = getSHrunner().exec_batch(script)
success &= not result[0]
build_operations += 1
# vcxproj files
if project_paths:
......@@ -528,10 +530,19 @@ def build(pkg_name, pkg_dir, project_paths, custom_scripts, with_env, sdk,
log.error("Error building with CMake")
exit(1)
post_build_scripts = custom_scripts.get("post_build", [])
if post_build_scripts:
log.debug('Post-Build phase')
for script in post_build_scripts:
result = getSHrunner().exec_batch(script)
success &= not result[0]
build_operations += 1
os.chdir(tmp_dir)
# should cover header only, no cmake, etc
ops = len(build_scripts) + len(project_paths) + len(pre_build_scripts)
ops = len(build_scripts) + len(project_paths) + \
len(pre_build_scripts) + len(post_build_scripts)
return success and build_operations == ops
......
......@@ -4,14 +4,20 @@
"url": "http://github.com/miniupnp/libnatpmp/archive/__VERSION__.tar.gz",
"deps": [],
"patches": [],
"win_patches": ["natpmp-win32-ssize_t.patch"],
"project_paths": ["msvc/natpmp.vcxproj"],
"with_env" : "",
"win_patches": [
"natpmp-win32-ssize_t.patch"
],
"project_paths": [],
"with_env": "",
"use_cmake": true,
"defines": [
"CMAKE_INSTALL_PREFIX=./install"
],
"custom_scripts": {
"pre_build": [
"rmdir /s /q msvc & mkdir msvc & cd msvc & cmake .. -G %CMAKE_GENERATOR%"
],
"pre_build": [],
"build": [],
"post_build": []
"post_build": [
"xcopy /f /y natpmp*.h include/"
]
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment