|
@@ -955,10 +955,8 @@ endmacro ()
|
|
|
macro (define_resource_dirs)
|
|
macro (define_resource_dirs)
|
|
|
check_source_files ("Could not call define_resource_dirs() macro before define_source_files() macro.")
|
|
check_source_files ("Could not call define_resource_dirs() macro before define_source_files() macro.")
|
|
|
cmake_parse_arguments (ARG "" "HTML_SHELL" "GLOB_PATTERNS;EXCLUDE_PATTERNS;EXTRA_DIRS" ${ARGN})
|
|
cmake_parse_arguments (ARG "" "HTML_SHELL" "GLOB_PATTERNS;EXCLUDE_PATTERNS;EXTRA_DIRS" ${ARGN})
|
|
|
- if (WEB)
|
|
|
|
|
- if (ARG_HTML_SHELL)
|
|
|
|
|
- add_html_shell (${ARG_HTML_SHELL})
|
|
|
|
|
- endif ()
|
|
|
|
|
|
|
+ if (WEB AND ARG_HTML_SHELL)
|
|
|
|
|
+ add_html_shell (${ARG_HTML_SHELL})
|
|
|
endif ()
|
|
endif ()
|
|
|
# If not explicitly specified then use the Urho3D project structure convention
|
|
# If not explicitly specified then use the Urho3D project structure convention
|
|
|
if (NOT ARG_GLOB_PATTERNS)
|
|
if (NOT ARG_GLOB_PATTERNS)
|
|
@@ -1058,20 +1056,22 @@ endmacro()
|
|
|
# Macro fo adding a HTML shell-file when targeting Web platform
|
|
# Macro fo adding a HTML shell-file when targeting Web platform
|
|
|
macro (add_html_shell)
|
|
macro (add_html_shell)
|
|
|
check_source_files ("Could not call add_html_shell() macro before define_source_files() macro.")
|
|
check_source_files ("Could not call add_html_shell() macro before define_source_files() macro.")
|
|
|
- if (NOT ${ARGN} STREQUAL "")
|
|
|
|
|
- set (HTML_SHELL ${ARGN})
|
|
|
|
|
- else ()
|
|
|
|
|
- # Create Urho3D custom HTML shell that also embeds our own project logo
|
|
|
|
|
- if (NOT EXISTS ${CMAKE_BINARY_DIR}/Source/shell.html)
|
|
|
|
|
- file (READ ${EMSCRIPTEN_ROOT_PATH}/src/shell.html HTML_SHELL)
|
|
|
|
|
- string (REPLACE "<!doctype html>" "<!-- This is a generated file. DO NOT EDIT!-->\n\n<!doctype html>" HTML_SHELL "${HTML_SHELL}") # Stringify to preserve semicolons
|
|
|
|
|
- string (REPLACE "<body>" "<body>\n\n<a href=\"https://urho3d.github.io\" title=\"Urho3D Homepage\"><img src=\"https://urho3d.github.io/assets/images/logo.png\" alt=\"link to https://urho3d.github.io\" height=\"80\" width=\"160\" /></a>\n" HTML_SHELL "${HTML_SHELL}")
|
|
|
|
|
- file (WRITE ${CMAKE_BINARY_DIR}/Source/shell.html "${HTML_SHELL}")
|
|
|
|
|
|
|
+ if (EMSCRIPTEN)
|
|
|
|
|
+ if (NOT ${ARGN} STREQUAL "")
|
|
|
|
|
+ set (HTML_SHELL ${ARGN})
|
|
|
|
|
+ else ()
|
|
|
|
|
+ # Create Urho3D custom HTML shell that also embeds our own project logo
|
|
|
|
|
+ if (NOT EXISTS ${CMAKE_BINARY_DIR}/Source/shell.html)
|
|
|
|
|
+ file (READ ${EMSCRIPTEN_ROOT_PATH}/src/shell.html HTML_SHELL)
|
|
|
|
|
+ string (REPLACE "<!doctype html>" "<!-- This is a generated file. DO NOT EDIT!-->\n\n<!doctype html>" HTML_SHELL "${HTML_SHELL}") # Stringify to preserve semicolons
|
|
|
|
|
+ string (REPLACE "<body>" "<body>\n\n<a href=\"https://urho3d.github.io\" title=\"Urho3D Homepage\"><img src=\"https://urho3d.github.io/assets/images/logo.png\" alt=\"link to https://urho3d.github.io\" height=\"80\" width=\"160\" /></a>\n" HTML_SHELL "${HTML_SHELL}")
|
|
|
|
|
+ file (WRITE ${CMAKE_BINARY_DIR}/Source/shell.html "${HTML_SHELL}")
|
|
|
|
|
+ endif ()
|
|
|
|
|
+ set (HTML_SHELL ${CMAKE_BINARY_DIR}/Source/shell.html)
|
|
|
endif ()
|
|
endif ()
|
|
|
- set (HTML_SHELL ${CMAKE_BINARY_DIR}/Source/shell.html)
|
|
|
|
|
|
|
+ list (APPEND SOURCE_FILES ${HTML_SHELL})
|
|
|
|
|
+ set_source_files_properties (${HTML_SHELL} PROPERTIES EMCC_OPTION shell-file)
|
|
|
endif ()
|
|
endif ()
|
|
|
- list (APPEND SOURCE_FILES ${HTML_SHELL})
|
|
|
|
|
- set_source_files_properties (${HTML_SHELL} PROPERTIES EMCC_OPTION shell-file)
|
|
|
|
|
endmacro ()
|
|
endmacro ()
|
|
|
|
|
|
|
|
include (GenerateExportHeader)
|
|
include (GenerateExportHeader)
|
|
@@ -1646,7 +1646,8 @@ macro (setup_main_executable)
|
|
|
install (DIRECTORY ${DIR} DESTINATION ${DEST_SHARE_DIR}/Resources)
|
|
install (DIRECTORY ${DIR} DESTINATION ${DEST_SHARE_DIR}/Resources)
|
|
|
list (APPEND INSTALLED_RESOURCE_DIRS ${DIR})
|
|
list (APPEND INSTALLED_RESOURCE_DIRS ${DIR})
|
|
|
endif ()
|
|
endif ()
|
|
|
- set (INSTALLED_RESOURCE_DIRS ${INSTALLED_RESOURCE_DIRS} PARENT_SCOPE)
|
|
|
|
|
|
|
+ # This cache variable is used to keep track of whether a resource directory has been instructed to be installed by CMake or not
|
|
|
|
|
+ set (INSTALLED_RESOURCE_DIRS ${INSTALLED_RESOURCE_DIRS} CACHE INTERNAL "Installed resource dirs")
|
|
|
endforeach ()
|
|
endforeach ()
|
|
|
endif ()
|
|
endif ()
|
|
|
|
|
|
|
@@ -1658,6 +1659,9 @@ macro (setup_main_executable)
|
|
|
endif ()
|
|
endif ()
|
|
|
endmacro ()
|
|
endmacro ()
|
|
|
|
|
|
|
|
|
|
+# This cache variable is used to keep track of whether a resource directory has been instructed to be installed by CMake or not
|
|
|
|
|
+unset (INSTALLED_RESOURCE_DIRS CACHE)
|
|
|
|
|
+
|
|
|
# Macro for setting up dependency lib for compilation and linking of a target (to be used internally)
|
|
# Macro for setting up dependency lib for compilation and linking of a target (to be used internally)
|
|
|
macro (_setup_target)
|
|
macro (_setup_target)
|
|
|
# Include directories
|
|
# Include directories
|