Skip to content

Commit

Permalink
[urho3d] Add new port (microsoft#14538)
Browse files Browse the repository at this point in the history
* [urho3d] Add new port

* [urho3d] Build master branch

* [urho3d] Fix osx build

* [urho3d] Fix windows build

* [urho3d] Update to newest version

* [urho3d] Add versions info

* [urho3d] arm and uwp are not supported

* [urho3d] Update versions info

* [urho3d] Convert CONTROL to vcpkg.json

* [urho3d] Update portfile.cmake to use newer cmake functions

* [urho3d] Fix ExternalProject_Add error

* [urho3d] Update versions info
  • Loading branch information
koprok authored Apr 29, 2021
1 parent 0b14f85 commit 655e1b4
Show file tree
Hide file tree
Showing 9 changed files with 512 additions and 0 deletions.
36 changes: 36 additions & 0 deletions ports/urho3d/asm_files.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
diff --git a/Source/ThirdParty/AngelScript/CMakeLists.txt b/Source/ThirdParty/AngelScript/CMakeLists.txt
index 6709cf5fc..4842f20b1 100644
--- a/Source/ThirdParty/AngelScript/CMakeLists.txt
+++ b/Source/ThirdParty/AngelScript/CMakeLists.txt
@@ -44,10 +44,10 @@ if (ARM)
elseif (MSVC AND URHO3D_64BIT)
enable_language (ASM_MASM)
# Commented out due to cmake bug - todo: Recheck if this workaround is still necessary when increasing CMake minimum version
- #set (ASM_FILES source/as_callfunc_x64_msvc_asm.asm)
+ set (ASM_FILES source/as_callfunc_x64_msvc_asm.asm)
# As a temporary workaround
- add_custom_command (OUTPUT as_callfunc_x64_msvc_asm.obj COMMAND ${CMAKE_ASM_MASM_COMPILER} -Fo ${CMAKE_CURRENT_BINARY_DIR}/as_callfunc_x64_msvc_asm.obj -c ${CMAKE_CURRENT_SOURCE_DIR}/source/as_callfunc_x64_msvc_asm.asm DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/as_callfunc_x64_msvc_asm.asm COMMENT "Temporary workaround for MASM")
- set (ASM_FILES ${CMAKE_CURRENT_BINARY_DIR}/as_callfunc_x64_msvc_asm.obj ${CMAKE_CURRENT_SOURCE_DIR}/source/as_callfunc_x64_msvc_asm.asm)
+ #add_custom_command (OUTPUT as_callfunc_x64_msvc_asm.obj COMMAND ${CMAKE_ASM_MASM_COMPILER} -Fo ${CMAKE_CURRENT_BINARY_DIR}/as_callfunc_x64_msvc_asm.obj -c ${CMAKE_CURRENT_SOURCE_DIR}/source/as_callfunc_x64_msvc_asm.asm DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/as_callfunc_x64_msvc_asm.asm COMMENT "Temporary workaround for MASM")
+ #set (ASM_FILES ${CMAKE_CURRENT_BINARY_DIR}/as_callfunc_x64_msvc_asm.obj ${CMAKE_CURRENT_SOURCE_DIR}/source/as_callfunc_x64_msvc_asm.asm)
endif ()
list (APPEND SOURCE_FILES ${ASM_FILES})

diff --git a/Source/ThirdParty/LibCpuId/CMakeLists.txt b/Source/ThirdParty/LibCpuId/CMakeLists.txt
index 0aecafb06..677fd4b84 100644
--- a/Source/ThirdParty/LibCpuId/CMakeLists.txt
+++ b/Source/ThirdParty/LibCpuId/CMakeLists.txt
@@ -33,10 +33,10 @@ endif ()
if (MSVC AND URHO3D_64BIT)
enable_language (ASM_MASM)
# Commented out due to cmake bug
- #set (ASM_FILES src/masm-x64.asm)
+ set (ASM_FILES src/masm-x64.asm)
# As a temporary workaround
- add_custom_command (OUTPUT masm-x64.obj COMMAND ${CMAKE_ASM_MASM_COMPILER} -Fo ${CMAKE_CURRENT_BINARY_DIR}/masm-x64.obj -c ${CMAKE_CURRENT_SOURCE_DIR}/src/masm-x64.asm DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/masm-x64.asm COMMENT "Temporary workaround for MASM")
- set (ASM_FILES ${CMAKE_CURRENT_BINARY_DIR}/masm-x64.obj ${CMAKE_CURRENT_SOURCE_DIR}/src/masm-x64.asm)
+ #add_custom_command (OUTPUT masm-x64.obj COMMAND ${CMAKE_ASM_MASM_COMPILER} -Fo ${CMAKE_CURRENT_BINARY_DIR}/masm-x64.obj -c ${CMAKE_CURRENT_SOURCE_DIR}/src/masm-x64.asm DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/masm-x64.asm COMMENT "Temporary workaround for MASM")
+ #set (ASM_FILES ${CMAKE_CURRENT_BINARY_DIR}/masm-x64.obj ${CMAKE_CURRENT_SOURCE_DIR}/src/masm-x64.asm)
endif ()

# Define source files
12 changes: 12 additions & 0 deletions ports/urho3d/externalproject.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/Source/Urho3D/CMakeLists.txt b/Source/Urho3D/CMakeLists.txt
index ae341cb3e..743302069 100644
--- a/Source/Urho3D/CMakeLists.txt
+++ b/Source/Urho3D/CMakeLists.txt
@@ -316,6 +316,7 @@ if (URHO3D_LUA)
else ()
set (ALTERNATE_COMMAND CMAKE_COMMAND ${CMAKE_COMMAND} -E env CC=${SAVED_CC} CXX=${SAVED_CXX} CI=$ENV{CI} ${CMAKE_COMMAND})
endif ()
+ set(CMAKE_DISABLE_SOURCE_CHANGES OFF)
ExternalProject_Add (tolua++
SOURCE_DIR ${CMAKE_SOURCE_DIR}/Source/ThirdParty/toluapp/src/bin
CMAKE_ARGS -D URHO3D_DEPLOYMENT_TARGET=generic -D DEST_RUNTIME_DIR=${CMAKE_BINARY_DIR}/bin/tool -D BAKED_CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR} -D URHO3D_UPDATE_SOURCE_TREE=${URHO3D_UPDATE_SOURCE_TREE} -D CMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
27 changes: 27 additions & 0 deletions ports/urho3d/macosx.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/Source/ThirdParty/Assimp/contrib/zlib/gzguts.h b/Source/ThirdParty/Assimp/contrib/zlib/gzguts.h
index 6378d468a..c8563db52 100644
--- a/Source/ThirdParty/Assimp/contrib/zlib/gzguts.h
+++ b/Source/ThirdParty/Assimp/contrib/zlib/gzguts.h
@@ -38,6 +38,9 @@
#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32)
# include <io.h>
#endif
+#ifdef __APPLE__
+# include <unistd.h>
+#endif

#if defined(_WIN32)
# define WIDECHAR
diff --git a/Source/ThirdParty/Civetweb/src/civetweb.c b/Source/ThirdParty/Civetweb/src/civetweb.c
index 4d26e0a83..2bd577e81 100644
--- a/Source/ThirdParty/Civetweb/src/civetweb.c
+++ b/Source/ThirdParty/Civetweb/src/civetweb.c
@@ -167,6 +167,8 @@ mg_static_assert(sizeof(void *) >= sizeof(int), "data type size check");

#endif

+#include <stdlib.h>
+
#if !defined(DEBUG_TRACE)
#if defined(DEBUG)

62 changes: 62 additions & 0 deletions ports/urho3d/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO urho3d/Urho3D
REF fff115a0c0cd50b8a34dfa20b4c5f33eb4f765c8
SHA512 4bddcd1d4165b74134a499616710c382d0463db24382aaa3111b8b38e82818053144d4ecb0ba7156589da1e18d85c0f20e0d847237291685ea80957f0bf7f8be
HEAD_REF master
PATCHES
asm_files.patch
macosx.patch
shared_libs.patch
externalproject.patch
)

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(URHO3D_LIB_TYPE "STATIC")
else()
set(URHO3D_LIB_TYPE "SHARED")
endif()

vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DURHO3D_LIB_TYPE=${URHO3D_LIB_TYPE}
-DURHO3D_C++11=ON
-DURHO3D_PCH=OFF
)

vcpkg_cmake_install()
if(EXISTS ${CURRENT_PACKAGES_DIR}/share/Urho3D/CMake/Modules)
vcpkg_cmake_config_fixup(CONFIG_PATH share/Urho3D/CMake/Modules)
endif()
if(EXISTS ${CURRENT_PACKAGES_DIR}/share/CMake/Modules)
vcpkg_cmake_config_fixup(CONFIG_PATH share/CMake/Modules)
endif()
vcpkg_copy_pdbs()

file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)

file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools)
file(RENAME ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/tools/${PORT})

if(EXISTS ${CURRENT_PACKAGES_DIR}/share/Urho3D/Resources)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/Urho3D/Resources/Autoload ${CURRENT_PACKAGES_DIR}/tools/${PORT}/Autoload)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/Urho3D/Resources/CoreData ${CURRENT_PACKAGES_DIR}/tools/${PORT}/CoreData)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/Urho3D/Resources/Data ${CURRENT_PACKAGES_DIR}/tools/${PORT}/Data)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/Urho3D/Resources)
endif()
if(EXISTS ${CURRENT_PACKAGES_DIR}/share/Resources)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/Resources/Autoload ${CURRENT_PACKAGES_DIR}/tools/${PORT}/Autoload)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/Resources/CoreData ${CURRENT_PACKAGES_DIR}/tools/${PORT}/CoreData)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/Resources/Data ${CURRENT_PACKAGES_DIR}/tools/${PORT}/Data)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/Resources)
endif()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/Urho3D/LuaScript/pkgs)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/Urho3D/ThirdParty/LuaJIT/jit)

file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
Loading

0 comments on commit 655e1b4

Please sign in to comment.