-
-
Notifications
You must be signed in to change notification settings - Fork 420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
emscripten-glfw: add package #5253
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package("emscripten-glfw") | ||
set_homepage("https://pongasoft.github.io/emscripten-glfw/test/demo/main.html") | ||
set_description("This project is an emscripten port of GLFW written in C++ for the web/webassembly platform #wasm") | ||
set_license("Apache-2.0") | ||
|
||
add_urls("https://github.com/pongasoft/emscripten-glfw.git") | ||
add_urls("https://github.com/pongasoft/emscripten-glfw/archive/refs/tags/$(version).tar.gz", { | ||
alias = "github", | ||
version = function (version) | ||
return "v3.4.0." .. tostring(version):gsub("%.", "") | ||
end | ||
}) | ||
add_urls("https://github.com/pongasoft/emscripten-glfw/releases/download/v$(version)/emscripten-glfw3-$(version).zip", { | ||
alias = "release", | ||
version = function (version) | ||
return "3.4.0." .. tostring(version):gsub("%.", "") | ||
end | ||
}) | ||
|
||
add_versions("github:2024.09.07", "ad4eea0c52ce61921da18e9fc8b6402a4a2e4515a8c783e2f1ae62671ab23fe3") | ||
|
||
add_versions("release:2024.09.07", "bddd7b7b3b34e5799024f7dd618435c391a420ca21c2fb0252b4ae68c8e07c89") | ||
|
||
add_configs("joystick", {description = "Enable joystick support", default = true, type = "boolean"}) | ||
add_configs("multi_window", {description = "Enable multi window support", default = true, type = "boolean"}) | ||
|
||
add_syslinks("GL") | ||
|
||
add_deps("cmake") | ||
|
||
on_load(function (package) | ||
if not package:is_debug() then | ||
package:add("defines", "EMSCRIPTEN_GLFW3_DISABLE_WARNING") | ||
end | ||
if not package:config("joystick") then | ||
package:add("defines", "EMSCRIPTEN_GLFW3_DISABLE_JOYSTICK") | ||
end | ||
if not package:config("multi_window") then | ||
package:add("defines", "EMSCRIPTEN_GLFW3_DISABLE_MULTI_WINDOW_SUPPORT") | ||
end | ||
end) | ||
|
||
on_install("wasm", function (package) | ||
io.replace("CMakeLists.txt", "if(CMAKE_CURRENT_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)", | ||
[[ include(GNUInstallDirs) | ||
install(TARGETS ${target} | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
) | ||
install(DIRECTORY external/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
install(FILES src/js/lib_emscripten_glfw3.js DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
if(0)]], {plain = true}) | ||
|
||
local configs = {} | ||
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")) | ||
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) | ||
table.insert(configs, "-DEMSCRIPTEN_GLFW3_DISABLE_JOYSTICK=" .. (package:config("joystick") and "OFF" or "ON")) | ||
table.insert(configs, "-DEMSCRIPTEN_GLFW3_DISABLE_MULTI_WINDOW_SUPPORT =" .. (package:config("multi_window") and "OFF" or "ON")) | ||
import("package.tools.cmake").install(package, configs) | ||
|
||
package:add("ldflags", | ||
"--js-library", | ||
package:installdir("bin/lib_emscripten_glfw3.js"), | ||
os.files(package:installdir("lib/*.a"))[1] | ||
) | ||
end) | ||
|
||
on_test(function (package) | ||
assert(package:has_cfuncs("glfwInit", {includes = "GLFW/glfw3.h"})) | ||
assert(package:has_cfuncs("emscripten_glfw_open_url", {includes = "GLFW/emscripten_glfw3.h"})) | ||
end) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同样都是 github 的源,搞两个没必要吧,反而维护起来麻烦,如果 github 不稳,那么都不稳。。
除非是不同的源,搞两个才有效果