diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f46916a3b9377e70f209ab9bbabe3b45ac787e0..3c4a4040b04183fdd28765e0cfa236f7bfda7aaa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/compat/msvc/winmake.py b/compat/msvc/winmake.py index 06b166b21c93e147cfdab1f32a3fcaa0bc811102..48b9839dae899382ea9475ea057808c4a2cebb07 100644 --- a/compat/msvc/winmake.py +++ b/compat/msvc/winmake.py @@ -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 diff --git a/contrib/src/natpmp/package.json b/contrib/src/natpmp/package.json index 1d5b8f255e96dd1b8eb2ff3f5ecdc3ac0b624506..bae10708546b8b91ad15b9bf1969252d07c251e1 100644 --- a/contrib/src/natpmp/package.json +++ b/contrib/src/natpmp/package.json @@ -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