ois: add package (#5523)
* ois: add package * ois: rename X11 * ois: use libx11 * ois: small fixes * ois: fix android * ois: add DCMAKE_POLICY_DEFAULT_CMP0057 for android * ois: add limits and fix include * ois: add define CMAKE_INSTALL_INCLUDEDIR * ois: fix `#include` * ois: add linux-headers for bsd and remove limits * ois: readd limits * ois: disable bsdpull/5543/head
parent
e5ac12fa85
commit
9ac397fc04
1 changed files with 55 additions and 0 deletions
@ -0,0 +1,55 @@ |
||||
package("ois") |
||||
set_homepage("https://wgois.github.io/OIS/") |
||||
set_description("Official OIS repository. Object oriented Input System") |
||||
set_license("zlib") |
||||
|
||||
add_urls("https://github.com/wgois/OIS/archive/refs/tags/$(version).tar.gz", |
||||
"https://github.com/wgois/OIS.git") |
||||
|
||||
add_versions("v1.5.1", "614f6ef6d69cf6d84f1b50efff46a6c1acce426933e5f0dcf29862ea8332af73") |
||||
|
||||
add_deps("cmake") |
||||
|
||||
if is_plat("linux", "bsd") then |
||||
add_deps("libx11") |
||||
elseif is_plat("macosx") then |
||||
add_frameworks("Cocoa", "Foundation", "Carbon", "IOKit") |
||||
elseif is_plat("windows", "mingw") then |
||||
add_syslinks("dinput8", "dxguid", "ole32", "oleaut32", "user32", "uuid", "xinput", "winmm") |
||||
end |
||||
|
||||
on_install("windows", "linux", "macosx", function (package) |
||||
local configs = { |
||||
"-DOIS_BUILD_DEMOS=OFF", |
||||
"-DCMAKE_POLICY_DEFAULT_CMP0057=NEW", |
||||
} |
||||
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")) |
||||
table.insert(configs, "-DOIS_BUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) |
||||
import("package.tools.cmake").install(package, configs) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:check_cxxsnippets({test = [[ |
||||
#include <ois/OIS.h> |
||||
|
||||
class InputListener : public OIS::KeyListener { |
||||
public: |
||||
bool keyPressed(const OIS::KeyEvent& arg) override { return true; } |
||||
bool keyReleased(const OIS::KeyEvent& arg) override { return true; } |
||||
}; |
||||
|
||||
void test() { |
||||
OIS::InputManager* inputManager = OIS::InputManager::createInputSystem(0); |
||||
OIS::Keyboard* keyboard = static_cast<OIS::Keyboard*>(inputManager->createInputObject(OIS::OISKeyboard, true)); |
||||
|
||||
InputListener inputListener; |
||||
keyboard->setEventCallback(&inputListener); |
||||
|
||||
keyboard->capture(); |
||||
|
||||
inputManager->destroyInputObject(keyboard); |
||||
OIS::InputManager::destroyInputSystem(inputManager); |
||||
} |
||||
|
||||
]]}, {configs = {languages = "cxx11"}})) |
||||
end) |
Loading…
Reference in new issue