From 3d2586b927a1ba29d4d54c699355f316bcaf56de Mon Sep 17 00:00:00 2001 From: ian karlsson Date: Thu, 15 Sep 2022 10:37:35 +0200 Subject: [PATCH] Add CMake build system. Add libvgm submodule required for cmake builds --- .gitmodules | 3 +++ CMakeLists.txt | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ ctrmml | 2 +- libvgm | 1 + 4 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 CMakeLists.txt create mode 160000 libvgm diff --git a/.gitmodules b/.gitmodules index 4a444f5..f810c95 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule "ctrmml"] path = ctrmml url = https://github.com/superctr/ctrmml +[submodule "libvgm"] + path = libvgm + url = https://github.com/ValleyBell/libvgm diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..b04d9e8 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,60 @@ +cmake_minimum_required(VERSION 3.11) +project(mmlgui LANGUAGES C CXX) + +find_package(PkgConfig REQUIRED) +find_package(OpenGL REQUIRED) + +pkg_check_modules(GLFW3 REQUIRED glfw3) +pkg_check_modules(CPPUNIT cppunit) + +add_subdirectory(ctrmml) +add_subdirectory(libvgm) + +add_library(gui + imgui/imgui.cpp + imgui/imgui_demo.cpp + imgui/imgui_draw.cpp + imgui/imgui_widgets.cpp + imgui/examples/imgui_impl_glfw.cpp + imgui/examples/imgui_impl_opengl3.cpp + imgui/examples/libs/gl3w/GL/gl3w.c + imgui/addons/imguifilesystem/imguifilesystem.cpp + ImGuiColorTextEdit/TextEditor.cpp) + +target_include_directories(gui PUBLIC + imgui + imgui/examples + imgui/examples/libs/gl3w + ImGuiColorTextEdit + ${GLFW3_INCLUDE_DIRS}) + +target_link_libraries(gui PUBLIC OpenGL::GL ${GLFW3_LIBRARIES}) +target_compile_definitions(gui PUBLIC -DIMGUI_IMPL_OPENGL_LOADER_GL3W) + +add_executable(mmlgui + src/main.cpp + src/window.cpp + src/main_window.cpp + src/editor_window.cpp + src/song_manager.cpp + src/track_info.cpp + src/track_view_window.cpp + src/track_list_window.cpp + src/audio_manager.cpp + src/emu_player.cpp + src/config_window.cpp + src/dmf_importer.cpp + src/miniz.c) + +target_link_libraries(mmlgui PRIVATE ctrmml gui vgm-utils vgm-audio vgm-emu) + +if(CPPUNIT_FOUND) + add_executable(mmlgui_unittest + src/track_info.cpp + src/unittest/test_track_info.cpp + src/unittest/main.cpp) + target_link_libraries(mmlgui_unittest ctrmml) + target_link_libraries(mmlgui_unittest ${CPPUNIT_LIBRARIES}) + enable_testing() + add_test(NAME run_mmlgui_unittest COMMAND mmlgui_unittest WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) +endif() diff --git a/ctrmml b/ctrmml index 984984e..7e6d57f 160000 --- a/ctrmml +++ b/ctrmml @@ -1 +1 @@ -Subproject commit 984984e9969806059ca8a4138edf7324d1643f26 +Subproject commit 7e6d57f1edbcd8367f5f7c96856d0bf3c881c923 diff --git a/libvgm b/libvgm new file mode 160000 index 0000000..0e34925 --- /dev/null +++ b/libvgm @@ -0,0 +1 @@ +Subproject commit 0e349256338144205303a1495ddc788a854be1eb