summaryrefslogtreecommitdiffstats
path: root/unityplugin
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2017-12-14 02:37:46 +0000
committerEgor Yusov <egor.yusov@gmail.com>2017-12-14 02:37:46 +0000
commit6ddf2a066039252770f534ac89cb2b5cd4834775 (patch)
treeed509585835c6d71f3ff5eceaba557704d9905cf /unityplugin
parentMerge branch 'master' of https://github.com/DiligentGraphics/DiligentEngine (diff)
downloadDiligentEngine-6ddf2a066039252770f534ac89cb2b5cd4834775.tar.gz
DiligentEngine-6ddf2a066039252770f534ac89cb2b5cd4834775.zip
Adding UWP to CMake (in progress)
Diffstat (limited to 'unityplugin')
-rw-r--r--unityplugin/GhostCubePlugin/PluginSource/CMakeLists.txt7
-rw-r--r--unityplugin/GhostCubeScene/CMakeLists.txt14
-rw-r--r--unityplugin/UnityEmulator/CMakeLists.txt70
3 files changed, 68 insertions, 23 deletions
diff --git a/unityplugin/GhostCubePlugin/PluginSource/CMakeLists.txt b/unityplugin/GhostCubePlugin/PluginSource/CMakeLists.txt
index 8fa2d1e..b1eda3b 100644
--- a/unityplugin/GhostCubePlugin/PluginSource/CMakeLists.txt
+++ b/unityplugin/GhostCubePlugin/PluginSource/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3)
+cmake_minimum_required (VERSION 3.8)
project(GhostCubePlugin CXX)
@@ -39,7 +39,7 @@ add_library(GhostCubePlugin-shared SHARED
${SOURCE} ${INCLUDE} ${UNITY_INTERFACES}
)
-if(PLATFORM_WIN32 OR PLATFORM_UNVIRSAL_WINDOWS)
+if(PLATFORM_WIN32 OR PLATFORM_UNIVERSAL_WINDOWS)
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(ARCH 64)
else("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
@@ -88,6 +88,9 @@ if(MSVC)
# Disable MSVC-specific warnings
# - w4201: nonstandard extension used: nameless struct/unio
target_compile_options(GhostCubePlugin-shared PRIVATE /wd4201)
+ if(PLATFORM_UNIVERSAL_WINDOWS)
+ target_compile_definitions(GhostCubePlugin-shared PRIVATE WINDOWS_UWP UNITY_METRO)
+ endif()
# Enable link-time code generation for release builds (I was not able to
# find any way to set these settings through interface library BuildSettings)
set_target_properties(GhostCubePlugin-shared PROPERTIES
diff --git a/unityplugin/GhostCubeScene/CMakeLists.txt b/unityplugin/GhostCubeScene/CMakeLists.txt
index 4f4aaf9..aa7860c 100644
--- a/unityplugin/GhostCubeScene/CMakeLists.txt
+++ b/unityplugin/GhostCubeScene/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3)
+cmake_minimum_required (VERSION 3.8)
project(GhostCubeScene CXX)
@@ -28,6 +28,9 @@ if(PLATFORM_WIN32)
"\"$<TARGET_FILE:GhostCubePlugin-shared>\""
"\"$<TARGET_FILE_DIR:GhostCubeScene>\"")
+elseif(PLATFORM_UNIVERSAL_WINDOWS)
+ add_executable(GhostCubeScene WIN32 ${SOURCE} ${INCLUDE})
+
#elseif(APPLE)
#add_executable(GhostCubeScene MACOSX_BUNDLE Main.cpp)
#elseif(UNIX)
@@ -36,6 +39,15 @@ else()
message(FATAL_ERROR "Unknown platform")
endif()
+if(PLATFORM_UNIVERSAL_WINDOWS)
+ get_emulator_uwp_source(UWP_SOURCE UWP_INCLUDE UWP_INCLUDE_DIR)
+ source_group("UWP\\src" FILES ${UWP_SOURCE})
+ source_group("UWP\\include" FILES ${UWP_INCLUDE})
+ target_include_directories(GhostCubeScene PRIVATE ${UWP_INCLUDE_DIR})
+ target_sources(GhostCubeScene PRIVATE ${UWP_SOURCE} ${UWP_INCLUDE})
+endif()
+
+
target_include_directories(GhostCubeScene
PRIVATE
../GhostCubePlugin/PluginSource/src/Unity
diff --git a/unityplugin/UnityEmulator/CMakeLists.txt b/unityplugin/UnityEmulator/CMakeLists.txt
index 59d3b55..da260a4 100644
--- a/unityplugin/UnityEmulator/CMakeLists.txt
+++ b/unityplugin/UnityEmulator/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3)
+cmake_minimum_required (VERSION 3.8)
project(UnityEmulator CXX)
@@ -50,17 +50,38 @@ endif()
if(PLATFORM_WIN32)
list(APPEND SOURCE src/Windows/WinMain.cpp)
+
elseif(PLATFORM_UNIVERSAL_WINDOWS)
- list(APPEND SOURCE src/UWP/App.cpp)
- list(APPEND INCLUDE src/UWP/DeviceResources.cpp)
- list(APPEND INCLUDE src/UWP/UnityEmulatorAppMain.cpp)
-
- list(APPEND INCLUDE src/UWP/App.h)
- list(APPEND INCLUDE src/UWP/DeviceResources.h)
- list(APPEND INCLUDE src/UWP/DirectXHelper.h)
- list(APPEND INCLUDE src/UWP/pch2.h)
- list(APPEND INCLUDE src/UWP/StepTimer.h)
- list(APPEND INCLUDE src/UWP/UnityEmulatorAppMain.h)
+
+ # Windows Runtime types cannot be included into static libraries
+ # https://social.msdn.microsoft.com/Forums/en-US/269db513-64ef-4817-a025-43954f614eb3/lnk4264-why-are-static-libraries-not-recommended-when-authoring-windows-runtime-types?forum=winappswithnativecode
+ # So as a workaround, we will include all source files into the target app project
+ function(get_emulator_uwp_source UWP_SOURCE UWP_INCLUDE UWP_INCLUDE_DIR)
+ get_target_property(EMULATOR_SOURCE_DIR UnityEmulator SOURCE_DIR)
+
+ set(${UWP_SOURCE}
+ ${EMULATOR_SOURCE_DIR}/src/UWP/App.cpp
+ ${EMULATOR_SOURCE_DIR}/src/UWP/DeviceResources.cpp
+ ${EMULATOR_SOURCE_DIR}/src/UWP/UnityEmulatorAppMain.cpp
+ PARENT_SCOPE
+ )
+
+ set(${UWP_INCLUDE}
+ ${EMULATOR_SOURCE_DIR}/src/UWP/App.h
+ ${EMULATOR_SOURCE_DIR}/src/UWP/DeviceResources.h
+ ${EMULATOR_SOURCE_DIR}/src/UWP/DirectXHelper.h
+ ${EMULATOR_SOURCE_DIR}/src/UWP/pch2.h
+ ${EMULATOR_SOURCE_DIR}/src/UWP/StepTimer.h
+ ${EMULATOR_SOURCE_DIR}/src/UWP/UnityEmulatorAppMain.h
+ PARENT_SCOPE
+ )
+
+ set(${UWP_INCLUDE_DIR}
+ ${EMULATOR_SOURCE_DIR}/Src/UWP
+ PARENT_SCOPE
+ )
+ endfunction(get_emulator_uwp_source)
+
elseif(PLATFORM_ANDROID)
list(APPEND SOURCE src/Android/AndroidMainImpl.cpp)
else()
@@ -92,22 +113,31 @@ endif()
target_link_libraries(UnityEmulator
PRIVATE
BuildSettings
- glew-static
PUBLIC
Common
GraphicsEngine
- GraphicsEngineOpenGL-static
GraphicsTools
TargetPlatform
)
-if(PLATFORM_WIN32 OR PLATFORM_UNIVERSAL_WINDOWS)
- target_link_libraries(UnityEmulator
- PUBLIC
- GraphicsEngineD3DBase
- GraphicsEngineD3D11-static
- GraphicsEngineD3D12-static
-)
+if(GL_SUPPORTED)
+ target_link_libraries(UnityEmulator PRIVATE glew-static)
+endif()
+
+if(GL_SUPPORTED OR GLES_SUPPORTED)
+ target_link_libraries(UnityEmulator PUBLIC GraphicsEngineOpenGL-static)
+endif()
+
+if(D3D11_SUPPORTED)
+ target_link_libraries(UnityEmulator PUBLIC GraphicsEngineD3DBase GraphicsEngineD3D11-static)
+endif()
+
+if(D3D12_SUPPORTED)
+ target_link_libraries(UnityEmulator PUBLIC GraphicsEngineD3DBase GraphicsEngineD3D12-static)
+endif()
+
+if(PLATFORM_UNIVERSAL_WINDOWS)
+ target_link_libraries(UnityEmulator PRIVATE dxguid.lib)
endif()
source_group("src" FILES ${SOURCE})