mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:57:45 +00:00
ChessEngine: Port to LibMain :^)
This commit is contained in:
parent
6e2f7a15fb
commit
e399835466
2 changed files with 8 additions and 16 deletions
|
@ -10,4 +10,4 @@ set(SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
serenity_bin(ChessEngine)
|
serenity_bin(ChessEngine)
|
||||||
target_link_libraries(ChessEngine LibChess LibCore)
|
target_link_libraries(ChessEngine LibChess LibCore LibMain)
|
||||||
|
|
|
@ -7,24 +7,16 @@
|
||||||
#include "ChessEngine.h"
|
#include "ChessEngine.h"
|
||||||
#include <LibCore/EventLoop.h>
|
#include <LibCore/EventLoop.h>
|
||||||
#include <LibCore/File.h>
|
#include <LibCore/File.h>
|
||||||
#include <unistd.h>
|
#include <LibCore/System.h>
|
||||||
|
#include <LibMain/Main.h>
|
||||||
|
|
||||||
int main()
|
ErrorOr<int> serenity_main(Main::Arguments)
|
||||||
{
|
{
|
||||||
if (pledge("stdio recvfd sendfd unix rpath", nullptr) < 0) {
|
TRY(Core::System::pledge("stdio recvfd sendfd unix rpath"));
|
||||||
perror("pledge");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
Core::EventLoop loop;
|
Core::EventLoop loop;
|
||||||
if (pledge("stdio recvfd sendfd unix", nullptr) < 0) {
|
TRY(Core::System::pledge("stdio recvfd sendfd unix"));
|
||||||
perror("pledge");
|
TRY(Core::System::unveil(nullptr, nullptr));
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (unveil(nullptr, nullptr) < 0) {
|
|
||||||
perror("unveil");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto engine = ChessEngine::construct(Core::File::standard_input(), Core::File::standard_output());
|
auto engine = TRY(ChessEngine::try_create(Core::File::standard_input(), Core::File::standard_output()));
|
||||||
return loop.exec();
|
return loop.exec();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue