reorganise and cleanup build system
it's still not good, but better than before
This commit is contained in:
parent
dbd75f8ae4
commit
9a6cbc98c3
|
@ -101,13 +101,6 @@ endif()
|
|||
|
||||
option(BUILD_QT_SDL "Build Qt/SDL frontend" ON)
|
||||
|
||||
find_package(ECM REQUIRED NO_MODULE)
|
||||
list(APPEND CMAKE_MODULE_PATH "${ECM_MODULE_PATH}")
|
||||
|
||||
find_package(X11 REQUIRED)
|
||||
find_package(EGL REQUIRED)
|
||||
find_package(Wayland REQUIRED Client)
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
if (BUILD_QT_SDL)
|
||||
|
|
|
@ -114,39 +114,6 @@ if (MATH_LIBRARY)
|
|||
target_link_libraries(core PRIVATE ${MATH_LIBRARY})
|
||||
endif()
|
||||
|
||||
if (ENABLE_OGLRENDERER)
|
||||
target_sources(core PRIVATE
|
||||
glad/glad.c
|
||||
|
||||
duckstation/gl/context.cpp)
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(core PUBLIC opengl32)
|
||||
|
||||
target_sources(core PRIVATE
|
||||
# the context stuff would probably be better in the frontend?
|
||||
duckstation/gl/context_wgl.cpp
|
||||
|
||||
glad/glad_wgl.c)
|
||||
else()
|
||||
target_sources(core PRIVATE
|
||||
duckstation/gl/context_egl.cpp
|
||||
duckstation/gl/context_egl_x11.cpp
|
||||
duckstation/gl/context_glx.cpp
|
||||
duckstation/gl/context_egl_wayland.cpp
|
||||
duckstation/gl/x11_window.cpp
|
||||
|
||||
glad/glad_egl.c
|
||||
glad/glad_glx.c)
|
||||
message("${X11_FOUND}")
|
||||
message("${X11_LIBRARIES}")
|
||||
target_link_libraries(core PRIVATE "${X11_LIBRARIES}" "${EGL_LIBRARIES}")
|
||||
target_include_directories(core PRIVATE "${X11_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
target_compile_definitions(core PUBLIC OGLRENDERER_ENABLED)
|
||||
endif()
|
||||
|
||||
if (ENABLE_JIT)
|
||||
target_compile_definitions(core PUBLIC JIT_ENABLED)
|
||||
|
||||
|
@ -156,6 +123,10 @@ if (ENABLE_JIT)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if (ENABLE_OPENGLRENDERER)
|
||||
target_compile_definitions(core PUBLIC OGLRENDERER_ENABLED)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(core PRIVATE ole32 comctl32 ws2_32)
|
||||
elseif(NOT APPLE)
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "NDS.h"
|
||||
#include "GPU.h"
|
||||
#include "GPU3D_OpenGL.h"
|
||||
#include "OpenGLSupport.h"
|
||||
#include "GPU_OpenGL_shaders.h"
|
||||
|
||||
|
|
|
@ -22,9 +22,8 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "glad/glad.h"
|
||||
|
||||
#include "Platform.h"
|
||||
#include "PlatformOGL.h"
|
||||
|
||||
|
||||
namespace OpenGL
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef PLATFORMOGL_H
|
||||
#define PLATFORMOGL_H
|
||||
|
||||
// if you don't wanna use glad for your platform
|
||||
// add your header here!
|
||||
|
||||
#include "frontend/glad/glad.h"
|
||||
|
||||
#endif
|
|
@ -41,8 +41,11 @@ set(SOURCES_QT_SDL
|
|||
../FrontendUtil.h
|
||||
../mic_blow.h
|
||||
|
||||
../glad/glad.c
|
||||
../duckstation/gl/context.cpp
|
||||
|
||||
${CMAKE_SOURCE_DIR}/res/melon.qrc
|
||||
)
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
option(USE_QT6 "Build using Qt 6 instead of 5" ON)
|
||||
|
@ -83,6 +86,38 @@ add_compile_definitions(ARCHIVE_SUPPORT_ENABLED)
|
|||
|
||||
add_executable(melonDS ${SOURCES_QT_SDL})
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(melonDS PUBLIC opengl32)
|
||||
|
||||
target_sources(melonDS PRIVATE
|
||||
# the context stuff would probably be better in the frontend?
|
||||
../duckstation/gl/context_wgl.cpp
|
||||
|
||||
../glad/glad_wgl.c)
|
||||
else()
|
||||
# we only need ECM for Wayland
|
||||
# so we only require it from here
|
||||
find_package(ECM REQUIRED NO_MODULE)
|
||||
list(APPEND CMAKE_MODULE_PATH "${ECM_MODULE_PATH}")
|
||||
|
||||
find_package(X11 REQUIRED)
|
||||
find_package(EGL REQUIRED)
|
||||
find_package(Wayland REQUIRED Client)
|
||||
|
||||
target_sources(melonDS PRIVATE
|
||||
../duckstation/gl/context_egl.cpp
|
||||
../duckstation/gl/context_egl_x11.cpp
|
||||
../duckstation/gl/context_glx.cpp
|
||||
../duckstation/gl/context_egl_wayland.cpp
|
||||
../duckstation/gl/x11_window.cpp
|
||||
|
||||
../glad/glad_egl.c
|
||||
../glad/glad_glx.c)
|
||||
target_link_libraries(melonDS PRIVATE "${X11_LIBRARIES}" "${EGL_LIBRARIES}")
|
||||
target_include_directories(melonDS PRIVATE "${X11_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
|
||||
if (BUILD_STATIC)
|
||||
qt_import_plugins(melonDS INCLUDE Qt::QSvgPlugin)
|
||||
target_link_options(melonDS PRIVATE -static)
|
||||
|
|
Loading…
Reference in New Issue