mirror of https://github.com/mode777/rayjs.git
fix magnum build
This commit is contained in:
parent
485cfd0a8d
commit
c3c858b3d0
|
@ -11,7 +11,9 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/corrade EXCLUDE_FROM_ALL
|
|||
message("=== Configure Magnum ===")
|
||||
# Add Magnum as a subproject, enable Sdl2Application
|
||||
set(MAGNUM_BUILD_STATIC ON CACHE BOOL "" FORCE)
|
||||
set(MAGNUM_WITH_WGLCONTEXT ON CACHE BOOL "" FORCE)
|
||||
set(MAGNUM_WITH_SDL2APPLICATION ON CACHE BOOL "" FORCE)
|
||||
# hack to force magnum to link against static sdl
|
||||
add_library(SDL2::SDL2 ALIAS SDL2-static)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/magnum EXCLUDE_FROM_ALL)
|
||||
|
||||
message("=== Configure QuickJS ===")
|
||||
|
@ -41,8 +43,8 @@ target_include_directories(quickjs
|
|||
)
|
||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
file(GLOB files src/*.cpp)
|
||||
file(GLOB files src/main.cpp)
|
||||
add_executable(${CMAKE_PROJECT_NAME} ${files})
|
||||
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE include)
|
||||
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE src)
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME} SDL2::SDL2-static Magnum::Magnum Magnum::GL Magnum::WglContext quickjs)
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME} Magnum::Magnum Magnum::GL Magnum::Sdl2Application quickjs)
|
BIN
my-game.exe
BIN
my-game.exe
Binary file not shown.
41
src/main.cpp
41
src/main.cpp
|
@ -1,27 +1,28 @@
|
|||
#include <Magnum/GL/DefaultFramebuffer.h>
|
||||
#include <Magnum/GL/Context.h>
|
||||
#include <Magnum/Platform/GLContext.h>
|
||||
#include "common.h"
|
||||
//#include "shaders.h"
|
||||
#include <Magnum/Platform/Sdl2Application.h>
|
||||
|
||||
using namespace Magnum;
|
||||
|
||||
App_Config app_config = { 640, 480 };
|
||||
App_State app_state = { NULL, 0 };
|
||||
class MyApplication: public Platform::Application {
|
||||
public:
|
||||
explicit MyApplication(const Arguments& arguments);
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
app_init_quickjs(argc, argv);
|
||||
app_init_sdl();
|
||||
Platform::GLContext context;
|
||||
private:
|
||||
void drawEvent() override;
|
||||
};
|
||||
|
||||
// Main loop
|
||||
while (!app_state.quit) {
|
||||
app_update_sdl();
|
||||
app_update_quickjs();
|
||||
}
|
||||
MyApplication::MyApplication(const Arguments& arguments):
|
||||
Platform::Application{arguments}
|
||||
{
|
||||
// TODO: Add your initialization code here
|
||||
}
|
||||
|
||||
app_dispose_sdl();
|
||||
app_dispose_quickjs();
|
||||
return 0;
|
||||
}
|
||||
void MyApplication::drawEvent() {
|
||||
GL::defaultFramebuffer.clear(GL::FramebufferClear::Color);
|
||||
|
||||
// TODO: Add your drawing code here
|
||||
|
||||
swapBuffers();
|
||||
}
|
||||
|
||||
MAGNUM_APPLICATION_MAIN(MyApplication)
|
Loading…
Reference in New Issue