-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[macOS] fixes a bug broken application bundle will be built (#274)
* [cmake] prevents expansion of `CMAKE_INSTALL_PREFIX` variable CPack uses `CMAKE_INSTALL_PREFIX` and installs to its variable at running package process. Before the commit, `CMAKE_INSTALL_PREFIX` variable is expanded and CPack cannot install properly. Therefore, the macOS application bundle without `fixup_bundle` will be installed and packaged. The commit prevents expansion of `CMAKE_INSTALL_PREFIX` to resolve above problem. * [cmake] should not install GLES3 plugin on macOS platform Before the commit, installed macOS application bundle cannot execute and crash with `Code Signature Invalid` error due to GLES3 plugin linked with system OpenGL libraries. The commit prevents creating and installing unintended GLES3 plugin on macOS platform. * [cmake] explicit install name directory to TBB shared library on macOS * [misc] ensure `CMakeLists.txt` with LF
- Loading branch information
Showing
5 changed files
with
153 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,5 @@ | |
*.json eol=lf | ||
*.cmake eol=lf | ||
*.proto eol=lf | ||
|
||
CMakeLists.txt eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
function(nanoem_emapp_build_embundle suffix) | ||
set(_embundle_name "embundle${suffix}") | ||
add_library(${_embundle_name} STATIC ${PROJECT_SOURCE_DIR}/emapp/bundle/bundle_c.c | ||
${PROJECT_SOURCE_DIR}/emapp/bundle/bundle.cc) | ||
nanoem_cmake_enable_lto(${_embundle_name}) | ||
if(WIN32) | ||
target_link_libraries(${_embundle_name} psapi imm32) | ||
endif() | ||
set_property(TARGET ${_embundle_name} PROPERTY FOLDER nanoem) | ||
target_compile_definitions(${_embundle_name} PRIVATE | ||
$<$<BOOL:${WIN32}>:_CRT_SECURE_NO_WARNINGS=1> | ||
$<$<BOOL:${WIN32}>:NOMINMAX> | ||
__STDC_LIMIT_MACROS | ||
__STDC_CONSTANT_MACROS | ||
__STDC_FORMAT_MACROS) | ||
target_include_directories(${_embundle_name} PRIVATE | ||
${BX_COMPAT_INCLUDE_PATH} | ||
${BX_INCLUDE_DIR} | ||
${BX_THIRDPARTY_INCLUDE_DIR} | ||
${BIMG_INCLUDE_DIR} | ||
${GLM_INCLUDE_DIR} | ||
${PROJECT_SOURCE_DIR}/emapp/include | ||
${PROJECT_SOURCE_DIR}/dependencies | ||
${PROJECT_SOURCE_DIR}/dependencies/imgui) | ||
if(NANOEM_ENABLE_DEBUG_ALLOCATOR) | ||
target_compile_definitions(${_embundle_name} PRIVATE NANODXM_ENABLE_DEBUG_ALLOCATOR UNDO_ENABLE_DEBUG_ALLOCATOR) | ||
endif() | ||
message(STATUS "[emapp/bundle] setup emapp bundle") | ||
endfunction() | ||
|
||
add_subdirectory(sokol) | ||
function(nanoem_emapp_build_embundle suffix) | ||
set(_embundle_name "embundle${suffix}") | ||
add_library(${_embundle_name} STATIC ${PROJECT_SOURCE_DIR}/emapp/bundle/bundle_c.c | ||
${PROJECT_SOURCE_DIR}/emapp/bundle/bundle.cc) | ||
nanoem_cmake_enable_lto(${_embundle_name}) | ||
if(WIN32) | ||
target_link_libraries(${_embundle_name} psapi imm32) | ||
endif() | ||
set_property(TARGET ${_embundle_name} PROPERTY FOLDER nanoem) | ||
target_compile_definitions(${_embundle_name} PRIVATE | ||
$<$<BOOL:${WIN32}>:_CRT_SECURE_NO_WARNINGS=1> | ||
$<$<BOOL:${WIN32}>:NOMINMAX> | ||
__STDC_LIMIT_MACROS | ||
__STDC_CONSTANT_MACROS | ||
__STDC_FORMAT_MACROS) | ||
target_include_directories(${_embundle_name} PRIVATE | ||
${BX_COMPAT_INCLUDE_PATH} | ||
${BX_INCLUDE_DIR} | ||
${BX_THIRDPARTY_INCLUDE_DIR} | ||
${BIMG_INCLUDE_DIR} | ||
${GLM_INCLUDE_DIR} | ||
${PROJECT_SOURCE_DIR}/emapp/include | ||
${PROJECT_SOURCE_DIR}/dependencies | ||
${PROJECT_SOURCE_DIR}/dependencies/imgui) | ||
if(NANOEM_ENABLE_DEBUG_ALLOCATOR) | ||
target_compile_definitions(${_embundle_name} PRIVATE NANODXM_ENABLE_DEBUG_ALLOCATOR UNDO_ENABLE_DEBUG_ALLOCATOR) | ||
endif() | ||
message(STATUS "[emapp/bundle] setup emapp bundle") | ||
endfunction() | ||
|
||
add_subdirectory(sokol) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,116 +1,116 @@ | ||
option(NANOEM_ENABLE_SOKOL_GLES3_COMPAT "Enable building sokol_gles3 with compatibility profile" OFF) | ||
option(NANOEM_ENABLE_SOKOL_WGPU "Enable building sokol_wgpu" OFF) | ||
|
||
function(nanoem_emapp_build_sokol_noop) | ||
if(NOT NANOEM_ENABLE_STATIC_BUNDLE_PLUGIN) | ||
add_library(sokol_noop ${_library_type} | ||
${CMAKE_CURRENT_SOURCE_DIR}/sokol_noop.c | ||
$<$<BOOL:${WIN32}>:${CMAKE_CURRENT_SOURCE_DIR}/sokol_noop.def>) | ||
set_property(TARGET sokol_noop PROPERTY FOLDER nanoem/sokol) | ||
target_include_directories(sokol_noop PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/dependencies) | ||
set_target_properties(sokol_noop PROPERTIES OUTPUT_NAME sokol_noop PREFIX "" DEFINE_SYMBOL "") | ||
nanoem_emapp_plugin_install(sokol_noop) | ||
message(STATUS "[emapp/bundle] setup sokol noop backend renderer plugin") | ||
endif() | ||
endfunction() | ||
|
||
function(nanoem_emapp_build_sokol_glcore33) | ||
if(NOT (NANOEM_ENABLE_STATIC_BUNDLE_PLUGIN OR (MSVC AND "${NANOEM_TARGET_ARCHITECTURE}" STREQUAL "arm64"))) | ||
add_library(sokol_glcore33 ${_library_type} | ||
${CMAKE_CURRENT_SOURCE_DIR}/sokol_glcore33.c | ||
$<$<BOOL:${WIN32}>:${CMAKE_CURRENT_SOURCE_DIR}/sokol_glcore33.def>) | ||
set_property(TARGET sokol_glcore33 PROPERTY FOLDER nanoem/sokol) | ||
target_compile_definitions(sokol_glcore33 PRIVATE SOKOL_DEBUG=$<BOOL:${SOKOL_ENABLE_DEBUG}> SOKOL_EXTERNAL_GL_LOADER) | ||
target_include_directories(sokol_glcore33 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/dependencies) | ||
set_target_properties(sokol_glcore33 PROPERTIES OUTPUT_NAME sokol_glcore33 PREFIX "" DEFINE_SYMBOL "") | ||
nanoem_emapp_plugin_install(sokol_glcore33) | ||
message(STATUS "[emapp/bundle] setup sokol OpenGL 3.3 Core Profile backend renderer plugin") | ||
endif() | ||
endfunction() | ||
|
||
function(nanoem_emapp_build_sokol_gles3) | ||
find_library(GLES3_LIBRARY_PATH NAMES GLESv3 GLESv2) | ||
find_path(GLES3_INCLUDE_DIR NAMES GLES3/gl3.h) | ||
mark_as_advanced(GLES3_LIBRARY_PATH GLES3_INCLUDE_DIR) | ||
if((NANOEM_ENABLE_SOKOL_GLES3_COMPAT OR EMSCRIPTEN) OR (GLES3_LIBRARY_PATH AND GLES3_INCLUDE_DIR)) | ||
add_library(sokol_gles3 ${_library_type} | ||
${CMAKE_CURRENT_SOURCE_DIR}/sokol_gles3.c | ||
$<$<BOOL:${WIN32}>:${CMAKE_CURRENT_SOURCE_DIR}/sokol_gles3.def>) | ||
set_property(TARGET sokol_gles3 PROPERTY FOLDER nanoem/sokol) | ||
target_compile_definitions(sokol_gles3 PRIVATE SOKOL_DEBUG=$<BOOL:${SOKOL_ENABLE_DEBUG}> $<$<BOOL:${NANOEM_ENABLE_SOKOL_GLES3_COMPAT}>:NANOEM_ENABLE_SOKOL_GLES3_COMPAT> SOKOL_EXTERNAL_GL_LOADER) | ||
target_include_directories(sokol_gles3 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/dependencies) | ||
set_target_properties(sokol_gles3 PROPERTIES OUTPUT_NAME sokol_gles3 PREFIX "" DEFINE_SYMBOL "") | ||
if(GLES3_INCLUDE_DIR) | ||
target_include_directories(sokol_gles3 PRIVATE ${GLES3_INCLUDE_DIR}) | ||
endif() | ||
if(GLES3_LIBRARY_PATH) | ||
target_link_libraries(sokol_gles3 ${GLES3_LIBRARY_PATH}) | ||
endif() | ||
nanoem_emapp_plugin_install(sokol_gles3) | ||
message(STATUS "[emapp/bundle] setup sokol OpenGL ES 3.0 backend renderer plugin") | ||
endif() | ||
endfunction() | ||
|
||
function(nanoem_emapp_build_sokol_d3d11) | ||
add_library(sokol_d3d11 ${_library_type} | ||
${CMAKE_CURRENT_SOURCE_DIR}/sokol_d3d11.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/sokol_d3d11.def) | ||
set_property(TARGET sokol_d3d11 PROPERTY FOLDER nanoem/sokol) | ||
target_compile_definitions(sokol_d3d11 PRIVATE SOKOL_DEBUG=$<BOOL:${SOKOL_ENABLE_DEBUG}> SOKOL_STATIC=$<BOOL:${NANOEM_ENABLE_STATIC_BUNDLE_PLUGIN}> SOKOL_EXTERNAL_GL_LOADER) | ||
target_include_directories(sokol_d3d11 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/dependencies) | ||
set_target_properties(sokol_d3d11 PROPERTIES OUTPUT_NAME sokol_d3d11 PREFIX "" DEFINE_SYMBOL "") | ||
target_link_libraries(sokol_d3d11 d3d11 dxgi dxguid) | ||
nanoem_emapp_plugin_install(sokol_d3d11) | ||
message(STATUS "[emapp/bundle] setup sokol D3D11 backend renderer plugin") | ||
endfunction() | ||
|
||
function(nanoem_emapp_build_sokol_metal) | ||
add_library(sokol_metal_macos ${_library_type} ${CMAKE_CURRENT_SOURCE_DIR}/sokol_metal_$<IF:$<BOOL:${IOS}>,ios,macos>.m) | ||
set_property(TARGET sokol_metal_macos PROPERTY FOLDER nanoem/sokol) | ||
target_compile_definitions(sokol_metal_macos PRIVATE SOKOL_DEBUG=$<BOOL:${SOKOL_ENABLE_DEBUG}>) | ||
target_include_directories(sokol_metal_macos PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/dependencies) | ||
set_target_properties(sokol_metal_macos PROPERTIES OUTPUT_NAME sokol_metal_macos PREFIX "" DEFINE_SYMBOL "") | ||
target_link_libraries(sokol_metal_macos "-framework Metal") | ||
nanoem_emapp_plugin_install(sokol_metal_macos) | ||
message(STATUS "[emapp/bundle] setup sokol Metal backend renderer plugin") | ||
endfunction() | ||
|
||
|
||
function(nanoem_emapp_build_sokol_wgpu) | ||
if(NANOEM_ENABLE_SOKOL_WGPU) | ||
set(DAWN_BASE_PATH ${PROJECT_SOURCE_DIR}/dependencies/dawn) | ||
find_library(WEBGPU_DAWN_NATIVE_LIBRARY_PATH NAMES dawn_native dawn_native.dll PATH_SUFFIXES out/Release/ PATHS ${DAWN_BASE_PATH}) | ||
find_library(WEBGPU_DAWN_PROC_LIBRARY_PATH NAMES dawn_proc dawn_proc.dll PATH_SUFFIXES out/Release PATHS ${DAWN_BASE_PATH}) | ||
find_library(WEBGPU_DAWN_WIRE_LIBRARY_PATH NAMES dawn_wire dawn_wire.dll PATH_SUFFIXES out/Release PATHS ${DAWN_BASE_PATH}) | ||
find_path(WEBGPU_INCLUDE_DIR NAMES dawn/webgpu.h PATH_SUFFIXES out/Release/gen/src/include PATHS ${DAWN_BASE_PATH}) | ||
add_library(sokol_wgpu ${_library_type} ${CMAKE_CURRENT_SOURCE_DIR}/sokol_wgpu.c) | ||
set_property(TARGET sokol_wgpu PROPERTY FOLDER nanoem/sokol) | ||
target_compile_definitions(sokol_wgpu PRIVATE SOKOL_DEBUG=$<BOOL:${SOKOL_ENABLE_DEBUG}> SOKOL_EXTERNAL_GL_LOADER) | ||
target_include_directories(sokol_wgpu PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/dependencies ${WEBGPU_INCLUDE_DIR}) | ||
set_target_properties(sokol_wgpu PROPERTIES OUTPUT_NAME sokol_wgpu PREFIX "" DEFINE_SYMBOL "") | ||
target_link_libraries(sokol_wgpu ${WEBGPU_DAWN_NATIVE_LIBRARY_PATH} ${WEBGPU_DAWN_PROC_LIBRARY_PATH} ${WEBGPU_DAWN_WIRE_LIBRARY_PATH}) | ||
nanoem_emapp_plugin_install(sokol_wgpu) | ||
message(STATUS "[emapp/bundle] setup sokol WGPU backend renderer plugin") | ||
endif() | ||
endfunction() | ||
|
||
function(nanoem_emapp_build_sokol) | ||
nanoem_emapp_plugin_set_library_type() | ||
nanoem_emapp_build_sokol_noop() | ||
nanoem_emapp_build_sokol_glcore33() | ||
nanoem_emapp_build_sokol_gles3() | ||
nanoem_emapp_build_sokol_wgpu() | ||
if(WIN32) | ||
nanoem_emapp_build_sokol_d3d11() | ||
if(TARGET sokol_glcore33) | ||
target_link_libraries(sokol_glcore33 opengl32) | ||
endif() | ||
if(TARGET sokol_gles3) | ||
target_link_libraries(sokol_gles3 opengl32) | ||
endif() | ||
elseif(APPLE) | ||
nanoem_emapp_build_sokol_metal() | ||
endif() | ||
endfunction() | ||
|
||
nanoem_emapp_build_sokol() | ||
option(NANOEM_ENABLE_SOKOL_GLES3_COMPAT "Enable building sokol_gles3 with compatibility profile" OFF) | ||
option(NANOEM_ENABLE_SOKOL_WGPU "Enable building sokol_wgpu" OFF) | ||
|
||
function(nanoem_emapp_build_sokol_noop) | ||
if(NOT NANOEM_ENABLE_STATIC_BUNDLE_PLUGIN) | ||
add_library(sokol_noop ${_library_type} | ||
${CMAKE_CURRENT_SOURCE_DIR}/sokol_noop.c | ||
$<$<BOOL:${WIN32}>:${CMAKE_CURRENT_SOURCE_DIR}/sokol_noop.def>) | ||
set_property(TARGET sokol_noop PROPERTY FOLDER nanoem/sokol) | ||
target_include_directories(sokol_noop PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/dependencies) | ||
set_target_properties(sokol_noop PROPERTIES OUTPUT_NAME sokol_noop PREFIX "" DEFINE_SYMBOL "") | ||
nanoem_emapp_plugin_install(sokol_noop) | ||
message(STATUS "[emapp/bundle] setup sokol noop backend renderer plugin") | ||
endif() | ||
endfunction() | ||
|
||
function(nanoem_emapp_build_sokol_glcore33) | ||
if(NOT (NANOEM_ENABLE_STATIC_BUNDLE_PLUGIN OR (MSVC AND "${NANOEM_TARGET_ARCHITECTURE}" STREQUAL "arm64"))) | ||
add_library(sokol_glcore33 ${_library_type} | ||
${CMAKE_CURRENT_SOURCE_DIR}/sokol_glcore33.c | ||
$<$<BOOL:${WIN32}>:${CMAKE_CURRENT_SOURCE_DIR}/sokol_glcore33.def>) | ||
set_property(TARGET sokol_glcore33 PROPERTY FOLDER nanoem/sokol) | ||
target_compile_definitions(sokol_glcore33 PRIVATE SOKOL_DEBUG=$<BOOL:${SOKOL_ENABLE_DEBUG}> SOKOL_EXTERNAL_GL_LOADER) | ||
target_include_directories(sokol_glcore33 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/dependencies) | ||
set_target_properties(sokol_glcore33 PROPERTIES OUTPUT_NAME sokol_glcore33 PREFIX "" DEFINE_SYMBOL "") | ||
nanoem_emapp_plugin_install(sokol_glcore33) | ||
message(STATUS "[emapp/bundle] setup sokol OpenGL 3.3 Core Profile backend renderer plugin") | ||
endif() | ||
endfunction() | ||
|
||
function(nanoem_emapp_build_sokol_gles3) | ||
find_library(GLES3_LIBRARY_PATH NAMES GLESv3) | ||
find_path(GLES3_INCLUDE_DIR NAMES GLES3/gl3.h) | ||
mark_as_advanced(GLES3_LIBRARY_PATH GLES3_INCLUDE_DIR) | ||
if((NANOEM_ENABLE_SOKOL_GLES3_COMPAT OR EMSCRIPTEN) OR (GLES3_LIBRARY_PATH AND GLES3_INCLUDE_DIR) AND NOT APPLE) | ||
add_library(sokol_gles3 ${_library_type} | ||
${CMAKE_CURRENT_SOURCE_DIR}/sokol_gles3.c | ||
$<$<BOOL:${WIN32}>:${CMAKE_CURRENT_SOURCE_DIR}/sokol_gles3.def>) | ||
set_property(TARGET sokol_gles3 PROPERTY FOLDER nanoem/sokol) | ||
target_compile_definitions(sokol_gles3 PRIVATE SOKOL_DEBUG=$<BOOL:${SOKOL_ENABLE_DEBUG}> $<$<BOOL:${NANOEM_ENABLE_SOKOL_GLES3_COMPAT}>:NANOEM_ENABLE_SOKOL_GLES3_COMPAT> SOKOL_EXTERNAL_GL_LOADER) | ||
target_include_directories(sokol_gles3 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/dependencies) | ||
set_target_properties(sokol_gles3 PROPERTIES OUTPUT_NAME sokol_gles3 PREFIX "" DEFINE_SYMBOL "") | ||
if(GLES3_INCLUDE_DIR) | ||
target_include_directories(sokol_gles3 PRIVATE ${GLES3_INCLUDE_DIR}) | ||
endif() | ||
if(GLES3_LIBRARY_PATH) | ||
target_link_libraries(sokol_gles3 ${GLES3_LIBRARY_PATH}) | ||
endif() | ||
nanoem_emapp_plugin_install(sokol_gles3) | ||
message(STATUS "[emapp/bundle] setup sokol OpenGL ES 3.0 backend renderer plugin") | ||
endif() | ||
endfunction() | ||
|
||
function(nanoem_emapp_build_sokol_d3d11) | ||
add_library(sokol_d3d11 ${_library_type} | ||
${CMAKE_CURRENT_SOURCE_DIR}/sokol_d3d11.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/sokol_d3d11.def) | ||
set_property(TARGET sokol_d3d11 PROPERTY FOLDER nanoem/sokol) | ||
target_compile_definitions(sokol_d3d11 PRIVATE SOKOL_DEBUG=$<BOOL:${SOKOL_ENABLE_DEBUG}> SOKOL_STATIC=$<BOOL:${NANOEM_ENABLE_STATIC_BUNDLE_PLUGIN}> SOKOL_EXTERNAL_GL_LOADER) | ||
target_include_directories(sokol_d3d11 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/dependencies) | ||
set_target_properties(sokol_d3d11 PROPERTIES OUTPUT_NAME sokol_d3d11 PREFIX "" DEFINE_SYMBOL "") | ||
target_link_libraries(sokol_d3d11 d3d11 dxgi dxguid) | ||
nanoem_emapp_plugin_install(sokol_d3d11) | ||
message(STATUS "[emapp/bundle] setup sokol D3D11 backend renderer plugin") | ||
endfunction() | ||
|
||
function(nanoem_emapp_build_sokol_metal) | ||
add_library(sokol_metal_macos ${_library_type} ${CMAKE_CURRENT_SOURCE_DIR}/sokol_metal_$<IF:$<BOOL:${IOS}>,ios,macos>.m) | ||
set_property(TARGET sokol_metal_macos PROPERTY FOLDER nanoem/sokol) | ||
target_compile_definitions(sokol_metal_macos PRIVATE SOKOL_DEBUG=$<BOOL:${SOKOL_ENABLE_DEBUG}>) | ||
target_include_directories(sokol_metal_macos PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/dependencies) | ||
set_target_properties(sokol_metal_macos PROPERTIES OUTPUT_NAME sokol_metal_macos PREFIX "" DEFINE_SYMBOL "") | ||
target_link_libraries(sokol_metal_macos "-framework Metal") | ||
nanoem_emapp_plugin_install(sokol_metal_macos) | ||
message(STATUS "[emapp/bundle] setup sokol Metal backend renderer plugin") | ||
endfunction() | ||
|
||
|
||
function(nanoem_emapp_build_sokol_wgpu) | ||
if(NANOEM_ENABLE_SOKOL_WGPU) | ||
set(DAWN_BASE_PATH ${PROJECT_SOURCE_DIR}/dependencies/dawn) | ||
find_library(WEBGPU_DAWN_NATIVE_LIBRARY_PATH NAMES dawn_native dawn_native.dll PATH_SUFFIXES out/Release/ PATHS ${DAWN_BASE_PATH}) | ||
find_library(WEBGPU_DAWN_PROC_LIBRARY_PATH NAMES dawn_proc dawn_proc.dll PATH_SUFFIXES out/Release PATHS ${DAWN_BASE_PATH}) | ||
find_library(WEBGPU_DAWN_WIRE_LIBRARY_PATH NAMES dawn_wire dawn_wire.dll PATH_SUFFIXES out/Release PATHS ${DAWN_BASE_PATH}) | ||
find_path(WEBGPU_INCLUDE_DIR NAMES dawn/webgpu.h PATH_SUFFIXES out/Release/gen/src/include PATHS ${DAWN_BASE_PATH}) | ||
add_library(sokol_wgpu ${_library_type} ${CMAKE_CURRENT_SOURCE_DIR}/sokol_wgpu.c) | ||
set_property(TARGET sokol_wgpu PROPERTY FOLDER nanoem/sokol) | ||
target_compile_definitions(sokol_wgpu PRIVATE SOKOL_DEBUG=$<BOOL:${SOKOL_ENABLE_DEBUG}> SOKOL_EXTERNAL_GL_LOADER) | ||
target_include_directories(sokol_wgpu PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/dependencies ${WEBGPU_INCLUDE_DIR}) | ||
set_target_properties(sokol_wgpu PROPERTIES OUTPUT_NAME sokol_wgpu PREFIX "" DEFINE_SYMBOL "") | ||
target_link_libraries(sokol_wgpu ${WEBGPU_DAWN_NATIVE_LIBRARY_PATH} ${WEBGPU_DAWN_PROC_LIBRARY_PATH} ${WEBGPU_DAWN_WIRE_LIBRARY_PATH}) | ||
nanoem_emapp_plugin_install(sokol_wgpu) | ||
message(STATUS "[emapp/bundle] setup sokol WGPU backend renderer plugin") | ||
endif() | ||
endfunction() | ||
|
||
function(nanoem_emapp_build_sokol) | ||
nanoem_emapp_plugin_set_library_type() | ||
nanoem_emapp_build_sokol_noop() | ||
nanoem_emapp_build_sokol_glcore33() | ||
nanoem_emapp_build_sokol_gles3() | ||
nanoem_emapp_build_sokol_wgpu() | ||
if(WIN32) | ||
nanoem_emapp_build_sokol_d3d11() | ||
if(TARGET sokol_glcore33) | ||
target_link_libraries(sokol_glcore33 opengl32) | ||
endif() | ||
if(TARGET sokol_gles3) | ||
target_link_libraries(sokol_gles3 opengl32) | ||
endif() | ||
elseif(APPLE) | ||
nanoem_emapp_build_sokol_metal() | ||
endif() | ||
endfunction() | ||
|
||
nanoem_emapp_build_sokol() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters