From 25d563668e17d9769fc1b1dfd8fce8bfe2be5baf Mon Sep 17 00:00:00 2001 From: Marco Auer Date: Sat, 2 Mar 2024 22:32:28 +0100 Subject: [PATCH] Merged new folder structure --- CMakeLists.txt | 3 - src/CMakeLists.txt | 78 ++----------------- {lib => src}/common/CMakeLists.txt | 0 {lib => src}/common/device_settings.h | 0 {lib => src}/common/hid.cpp | 0 {lib => src}/common/hid.h | 0 {lib => src}/common/hid_event.h | 0 {lib => src}/common/hid_logger.cpp | 0 {lib => src}/common/hid_logger.h | 0 {lib => src}/common/map.cpp | 0 {lib => src}/common/map.h | 0 {lib => src}/common/map_param.cpp | 0 {lib => src}/common/map_param.h | 0 {lib => src}/common/map_param_in.cpp | 0 {lib => src}/common/map_param_in.h | 0 {lib => src}/common/map_param_out.cpp | 0 {lib => src}/common/map_param_out.h | 0 {lib => src}/common/map_result.h | 0 {lib => src}/common/midi_logger.cpp | 0 {lib => src}/common/midi_logger.h | 0 {lib => src}/common/midi_message.cpp | 0 {lib => src}/common/midi_message.h | 0 {lib => src}/common/outbound_task.h | 0 {lib => src}/common/text_log_msg.h | 0 {lib => src}/common/text_logger.cpp | 0 {lib => src}/common/text_logger.h | 0 {lib => src}/common/toml_utils.cpp | 0 {lib => src}/common/toml_utils.h | 0 {lib => src}/common/types.h | 0 {lib => src}/common/utils.cpp | 0 {lib => src}/common/utils.h | 0 {lib/map => src/device}/CMakeLists.txt | 37 ++++----- src/{profile => device}/conversions.cpp | 0 src/{profile => device}/conversions.h | 0 src/{profile => device}/device.cpp | 0 src/{profile => device}/device.h | 0 src/{profile => device}/device_list.cpp | 0 src/{profile => device}/device_list.h | 0 src/{profile => device}/hid_device.cpp | 0 src/{profile => device}/hid_device.h | 0 {lib/map => src/device}/map_in/CMakeLists.txt | 0 {lib/map => src/device}/map_in/label.h | 0 {lib/map => src/device}/map_in/map_in.cpp | 0 {lib/map => src/device}/map_in/map_in.h | 0 {lib/map => src/device}/map_in/map_in_cmd.cpp | 0 {lib/map => src/device}/map_in/map_in_cmd.h | 0 {lib/map => src/device}/map_in/map_in_drf.cpp | 0 {lib/map => src/device}/map_in/map_in_drf.h | 0 {lib/map => src/device}/map_in/map_in_enc.cpp | 0 {lib/map => src/device}/map_in/map_in_enc.h | 0 .../device}/map_in/map_in_label.cpp | 0 {lib/map => src/device}/map_in/map_in_label.h | 0 .../map => src/device}/map_in/map_in_list.cpp | 0 {lib/map => src/device}/map_in/map_in_list.h | 0 {lib/map => src/device}/map_in/map_in_pnp.cpp | 0 {lib/map => src/device}/map_in/map_in_pnp.h | 0 {lib/map => src/device}/map_in/map_in_sld.cpp | 0 {lib/map => src/device}/map_in/map_in_sld.h | 0 .../device}/map_init/CMakeLists.txt | 0 {lib/map => src/device}/map_init/map_init.cpp | 0 {lib/map => src/device}/map_init/map_init.h | 0 .../device}/map_init/map_init_list.cpp | 0 .../device}/map_init/map_init_list.h | 0 .../map => src/device}/map_out/CMakeLists.txt | 0 {lib/map => src/device}/map_out/map_out.cpp | 0 {lib/map => src/device}/map_out/map_out.h | 0 .../device}/map_out/map_out_con.cpp | 0 {lib/map => src/device}/map_out/map_out_con.h | 0 .../device}/map_out/map_out_drf.cpp | 0 {lib/map => src/device}/map_out/map_out_drf.h | 0 .../device}/map_out/map_out_list.cpp | 0 .../map => src/device}/map_out/map_out_list.h | 0 .../device}/map_out/map_out_sld.cpp | 0 {lib/map => src/device}/map_out/map_out_sld.h | 0 src/{profile => device}/midi_device.cpp | 1 + src/{profile => device}/midi_device.h | 0 .../virtual_midi_device.cpp | 0 src/{profile => device}/virtual_midi_device.h | 0 {lib => src}/env/CMakeLists.txt | 28 +------ {lib => src}/env/commands.h | 0 {lib => src}/env/data.h | 0 {lib => src}/env/data_item.h | 0 {lib => src}/env/environment.cpp | 0 {lib => src}/env/environment.h | 0 {lib => src}/env/inbound_task.h | 0 {lib => src}/env/inbound_worker.cpp | 0 {lib => src}/env/inbound_worker.h | 0 {lib => src}/env/info_message.h | 0 {lib => src}/env/settings.cpp | 0 {lib => src}/env/settings.h | 0 {lib => src/env/tests}/CMakeLists.txt | 33 +++++--- {lib => src}/env/tests/command_tests.cpp | 0 {lib => src}/env/tests/command_tests.h | 0 {lib => src}/env/tests/data_tests.cpp | 0 {lib => src}/env/tests/data_tests.h | 0 {lib => src}/env/tests/env_tests.cpp | 0 {lib => src}/env/tests/env_tests.h | 0 src/{ui => env/xplane}/CMakeLists.txt | 41 +++++++--- src/{ui => env/xplane}/ImGuiFontAtlas.cpp | 0 src/{ui => env/xplane}/ImGuiFontAtlas.h | 0 {lib => src}/env/xplane/cmd_xplane.cpp | 0 {lib => src}/env/xplane/cmd_xplane.h | 0 {lib => src}/env/xplane/data_xplane.cpp | 0 {lib => src}/env/xplane/data_xplane.h | 0 {lib => src}/env/xplane/env_xplane.cpp | 0 {lib => src}/env/xplane/env_xplane.h | 0 src/{ui => env/xplane}/imgui_window.cpp | 0 src/{ui => env/xplane}/imgui_window.h | 0 src/{ui => env/xplane}/xplane_window.cpp | 0 src/{ui => env/xplane}/xplane_window.h | 0 src/plugin/CMakeLists.txt | 64 ++++++++++++++- src/{profile => plugin}/profile.cpp | 0 src/{profile => plugin}/profile.h | 0 src/profile/CMakeLists.txt | 47 ----------- tests/CMakeLists.txt | 4 +- 115 files changed, 145 insertions(+), 191 deletions(-) rename {lib => src}/common/CMakeLists.txt (100%) rename {lib => src}/common/device_settings.h (100%) rename {lib => src}/common/hid.cpp (100%) rename {lib => src}/common/hid.h (100%) rename {lib => src}/common/hid_event.h (100%) rename {lib => src}/common/hid_logger.cpp (100%) rename {lib => src}/common/hid_logger.h (100%) rename {lib => src}/common/map.cpp (100%) rename {lib => src}/common/map.h (100%) rename {lib => src}/common/map_param.cpp (100%) rename {lib => src}/common/map_param.h (100%) rename {lib => src}/common/map_param_in.cpp (100%) rename {lib => src}/common/map_param_in.h (100%) rename {lib => src}/common/map_param_out.cpp (100%) rename {lib => src}/common/map_param_out.h (100%) rename {lib => src}/common/map_result.h (100%) rename {lib => src}/common/midi_logger.cpp (100%) rename {lib => src}/common/midi_logger.h (100%) rename {lib => src}/common/midi_message.cpp (100%) rename {lib => src}/common/midi_message.h (100%) rename {lib => src}/common/outbound_task.h (100%) rename {lib => src}/common/text_log_msg.h (100%) rename {lib => src}/common/text_logger.cpp (100%) rename {lib => src}/common/text_logger.h (100%) rename {lib => src}/common/toml_utils.cpp (100%) rename {lib => src}/common/toml_utils.h (100%) rename {lib => src}/common/types.h (100%) rename {lib => src}/common/utils.cpp (100%) rename {lib => src}/common/utils.h (100%) rename {lib/map => src/device}/CMakeLists.txt (65%) rename src/{profile => device}/conversions.cpp (100%) rename src/{profile => device}/conversions.h (100%) rename src/{profile => device}/device.cpp (100%) rename src/{profile => device}/device.h (100%) rename src/{profile => device}/device_list.cpp (100%) rename src/{profile => device}/device_list.h (100%) rename src/{profile => device}/hid_device.cpp (100%) rename src/{profile => device}/hid_device.h (100%) rename {lib/map => src/device}/map_in/CMakeLists.txt (100%) rename {lib/map => src/device}/map_in/label.h (100%) rename {lib/map => src/device}/map_in/map_in.cpp (100%) rename {lib/map => src/device}/map_in/map_in.h (100%) rename {lib/map => src/device}/map_in/map_in_cmd.cpp (100%) rename {lib/map => src/device}/map_in/map_in_cmd.h (100%) rename {lib/map => src/device}/map_in/map_in_drf.cpp (100%) rename {lib/map => src/device}/map_in/map_in_drf.h (100%) rename {lib/map => src/device}/map_in/map_in_enc.cpp (100%) rename {lib/map => src/device}/map_in/map_in_enc.h (100%) rename {lib/map => src/device}/map_in/map_in_label.cpp (100%) rename {lib/map => src/device}/map_in/map_in_label.h (100%) rename {lib/map => src/device}/map_in/map_in_list.cpp (100%) rename {lib/map => src/device}/map_in/map_in_list.h (100%) rename {lib/map => src/device}/map_in/map_in_pnp.cpp (100%) rename {lib/map => src/device}/map_in/map_in_pnp.h (100%) rename {lib/map => src/device}/map_in/map_in_sld.cpp (100%) rename {lib/map => src/device}/map_in/map_in_sld.h (100%) rename {lib/map => src/device}/map_init/CMakeLists.txt (100%) rename {lib/map => src/device}/map_init/map_init.cpp (100%) rename {lib/map => src/device}/map_init/map_init.h (100%) rename {lib/map => src/device}/map_init/map_init_list.cpp (100%) rename {lib/map => src/device}/map_init/map_init_list.h (100%) rename {lib/map => src/device}/map_out/CMakeLists.txt (100%) rename {lib/map => src/device}/map_out/map_out.cpp (100%) rename {lib/map => src/device}/map_out/map_out.h (100%) rename {lib/map => src/device}/map_out/map_out_con.cpp (100%) rename {lib/map => src/device}/map_out/map_out_con.h (100%) rename {lib/map => src/device}/map_out/map_out_drf.cpp (100%) rename {lib/map => src/device}/map_out/map_out_drf.h (100%) rename {lib/map => src/device}/map_out/map_out_list.cpp (100%) rename {lib/map => src/device}/map_out/map_out_list.h (100%) rename {lib/map => src/device}/map_out/map_out_sld.cpp (100%) rename {lib/map => src/device}/map_out/map_out_sld.h (100%) rename src/{profile => device}/midi_device.cpp (99%) rename src/{profile => device}/midi_device.h (100%) rename src/{profile => device}/virtual_midi_device.cpp (100%) rename src/{profile => device}/virtual_midi_device.h (100%) rename {lib => src}/env/CMakeLists.txt (58%) rename {lib => src}/env/commands.h (100%) rename {lib => src}/env/data.h (100%) rename {lib => src}/env/data_item.h (100%) rename {lib => src}/env/environment.cpp (100%) rename {lib => src}/env/environment.h (100%) rename {lib => src}/env/inbound_task.h (100%) rename {lib => src}/env/inbound_worker.cpp (100%) rename {lib => src}/env/inbound_worker.h (100%) rename {lib => src}/env/info_message.h (100%) rename {lib => src}/env/settings.cpp (100%) rename {lib => src}/env/settings.h (100%) rename {lib => src/env/tests}/CMakeLists.txt (54%) rename {lib => src}/env/tests/command_tests.cpp (100%) rename {lib => src}/env/tests/command_tests.h (100%) rename {lib => src}/env/tests/data_tests.cpp (100%) rename {lib => src}/env/tests/data_tests.h (100%) rename {lib => src}/env/tests/env_tests.cpp (100%) rename {lib => src}/env/tests/env_tests.h (100%) rename src/{ui => env/xplane}/CMakeLists.txt (50%) rename src/{ui => env/xplane}/ImGuiFontAtlas.cpp (100%) rename src/{ui => env/xplane}/ImGuiFontAtlas.h (100%) rename {lib => src}/env/xplane/cmd_xplane.cpp (100%) rename {lib => src}/env/xplane/cmd_xplane.h (100%) rename {lib => src}/env/xplane/data_xplane.cpp (100%) rename {lib => src}/env/xplane/data_xplane.h (100%) rename {lib => src}/env/xplane/env_xplane.cpp (100%) rename {lib => src}/env/xplane/env_xplane.h (100%) rename src/{ui => env/xplane}/imgui_window.cpp (100%) rename src/{ui => env/xplane}/imgui_window.h (100%) rename src/{ui => env/xplane}/xplane_window.cpp (100%) rename src/{ui => env/xplane}/xplane_window.h (100%) rename src/{profile => plugin}/profile.cpp (100%) rename src/{profile => plugin}/profile.h (100%) delete mode 100644 src/profile/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 8021d5a6..fcb66e94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,9 +78,6 @@ endif() # add external libraries add_subdirectory(external) -# Add libraries -add_subdirectory(lib) - # Add plugin add_subdirectory(src) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dd3395b5..340e365f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,7 @@ #---------------------------------------------------------------------------------------------------------------------- # XMidiCtrl - MIDI Controller plugin for X-Plane # -# Copyright (c) 2021-2023 Marco Auer +# Copyright (c) 2021-2024 Marco Auer # # XMidiCtrl is free software: you can redistribute it and/or modify it under the terms of the # GNU Affero General Public License as published by the Free Software Foundation, either version 3 @@ -15,78 +15,10 @@ # If not, see . #---------------------------------------------------------------------------------------------------------------------- -message("-- Configuring build scripts for ${PROJECT_NAME}") - set(CMAKE_CXX_STANDARD 20) -# Include fonts -include_directories(${FONTS_INCLUDEDIR}) - -# Include the ImGui files -include_directories(${IMGUI_INCLUDEDIR}) - -# Build shared library -add_library(${PROJECT_NAME} SHARED) - # Include sub directories -add_subdirectory(profile) - -include(${CMAKE_CURRENT_LIST_DIR}/ui/CMakeLists.txt) -include(${CMAKE_CURRENT_LIST_DIR}/plugin/CMakeLists.txt) - -# Apple deprecated OpenGL...yea, we know, keep quiet -if (APPLE) - set_source_files_properties( - ${CMAKE_CURRENT_LIST_DIR}/ui/ImgFontAtlas.cpp - ${CMAKE_CURRENT_LIST_DIR}/ui/imgui_window.cpp - PROPERTIES - COMPILE_OPTIONS "-Wno-deprecated-declarations") -endif() - -# add static libraries for xmidictrl -target_link_libraries(${PROJECT_NAME} xmidictrl-common xmidictrl-env xmidictrl-map xmidictrl-profile) - -# link required dependencies -if (WIN32) - message("Build for Windows Platform") - if (MINGW) - target_link_libraries(${PROJECT_NAME} mingw_stdthreads) - endif() - if (MSVC) - target_link_libraries(${PROJECT_NAME} toml11 fmt::fmt-header-only rtmidi hidapi::hidapi winmm xpsdk imgui) - include(GenerateExportHeader) - generate_export_header(${PROJECT_NAME}) - add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different - $ "${PROJECT_SOURCE_DIR}/package/${PROJECT_NAME}/win_x64/$" - ) - else() - target_link_libraries(${PROJECT_NAME} -s -static -static-libgcc -static-libstdc++ toml11 fmt::fmt-header-only rtmidi hidapi::hidapi winmm xpsdk imgui) - set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/package/${PROJECT_NAME}/win_x64") - endif() -elseif (APPLE) - message("Build for Apple Platform") - find_library(CORE_FOUNDATION_LIBRARY CoreFoundation REQUIRED) - find_library(Cocoa_LIBRARY Cocoa REQUIRED) - find_library(Security_LIBRARY Security REQUIRED) - find_library(GSS_LIBRARY GSS REQUIRED) - find_library(OpenGL_LIBRARY OpenGL REQUIRED) - # Link OS X core system libraries. - target_link_libraries(${PROJECT_NAME} ${CORE_FOUNDATION_LIBRARY} ${Cocoa_LIBRARY} ${Security_LIBRARY} ${GSS_LIBRARY} ${OpenGL_LIBRARY}) - target_link_libraries(${PROJECT_NAME} toml11 fmt::fmt-header-only rtmidi hidapi::hidapi xpsdk imgui) - target_link_options(${PROJECT_NAME} PRIVATE "-Wl,-no_weak_imports") - - # Restrict set of symbols exported from the plugin to the ones required by XPLM: - # target_link_options(${PROJECT_NAME} PRIVATE "-exported_symbols_list ${CMAKE_SOURCE_DIR}/src/xmidictrl.sym_mac") - set_target_properties(${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/package/${PROJECT_NAME}/mac_x64") -elseif (UNIX) - message("Build for Linux Platform") - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/package/${PROJECT_NAME}/lin_64") - target_link_libraries(${PROJECT_NAME} -static-libgcc -static-libstdc++ -fPIC toml11 fmt::fmt-header-only rtmidi hidapi::hidapi xpsdk imgui) - set_target_properties(${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/package/${PROJECT_NAME}/lin_x64") -endif () - -# Set output properties for X-Plane standards -set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "") -set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}") -set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".xpl") +add_subdirectory(common) +add_subdirectory(env) +add_subdirectory(device) +add_subdirectory(plugin) \ No newline at end of file diff --git a/lib/common/CMakeLists.txt b/src/common/CMakeLists.txt similarity index 100% rename from lib/common/CMakeLists.txt rename to src/common/CMakeLists.txt diff --git a/lib/common/device_settings.h b/src/common/device_settings.h similarity index 100% rename from lib/common/device_settings.h rename to src/common/device_settings.h diff --git a/lib/common/hid.cpp b/src/common/hid.cpp similarity index 100% rename from lib/common/hid.cpp rename to src/common/hid.cpp diff --git a/lib/common/hid.h b/src/common/hid.h similarity index 100% rename from lib/common/hid.h rename to src/common/hid.h diff --git a/lib/common/hid_event.h b/src/common/hid_event.h similarity index 100% rename from lib/common/hid_event.h rename to src/common/hid_event.h diff --git a/lib/common/hid_logger.cpp b/src/common/hid_logger.cpp similarity index 100% rename from lib/common/hid_logger.cpp rename to src/common/hid_logger.cpp diff --git a/lib/common/hid_logger.h b/src/common/hid_logger.h similarity index 100% rename from lib/common/hid_logger.h rename to src/common/hid_logger.h diff --git a/lib/common/map.cpp b/src/common/map.cpp similarity index 100% rename from lib/common/map.cpp rename to src/common/map.cpp diff --git a/lib/common/map.h b/src/common/map.h similarity index 100% rename from lib/common/map.h rename to src/common/map.h diff --git a/lib/common/map_param.cpp b/src/common/map_param.cpp similarity index 100% rename from lib/common/map_param.cpp rename to src/common/map_param.cpp diff --git a/lib/common/map_param.h b/src/common/map_param.h similarity index 100% rename from lib/common/map_param.h rename to src/common/map_param.h diff --git a/lib/common/map_param_in.cpp b/src/common/map_param_in.cpp similarity index 100% rename from lib/common/map_param_in.cpp rename to src/common/map_param_in.cpp diff --git a/lib/common/map_param_in.h b/src/common/map_param_in.h similarity index 100% rename from lib/common/map_param_in.h rename to src/common/map_param_in.h diff --git a/lib/common/map_param_out.cpp b/src/common/map_param_out.cpp similarity index 100% rename from lib/common/map_param_out.cpp rename to src/common/map_param_out.cpp diff --git a/lib/common/map_param_out.h b/src/common/map_param_out.h similarity index 100% rename from lib/common/map_param_out.h rename to src/common/map_param_out.h diff --git a/lib/common/map_result.h b/src/common/map_result.h similarity index 100% rename from lib/common/map_result.h rename to src/common/map_result.h diff --git a/lib/common/midi_logger.cpp b/src/common/midi_logger.cpp similarity index 100% rename from lib/common/midi_logger.cpp rename to src/common/midi_logger.cpp diff --git a/lib/common/midi_logger.h b/src/common/midi_logger.h similarity index 100% rename from lib/common/midi_logger.h rename to src/common/midi_logger.h diff --git a/lib/common/midi_message.cpp b/src/common/midi_message.cpp similarity index 100% rename from lib/common/midi_message.cpp rename to src/common/midi_message.cpp diff --git a/lib/common/midi_message.h b/src/common/midi_message.h similarity index 100% rename from lib/common/midi_message.h rename to src/common/midi_message.h diff --git a/lib/common/outbound_task.h b/src/common/outbound_task.h similarity index 100% rename from lib/common/outbound_task.h rename to src/common/outbound_task.h diff --git a/lib/common/text_log_msg.h b/src/common/text_log_msg.h similarity index 100% rename from lib/common/text_log_msg.h rename to src/common/text_log_msg.h diff --git a/lib/common/text_logger.cpp b/src/common/text_logger.cpp similarity index 100% rename from lib/common/text_logger.cpp rename to src/common/text_logger.cpp diff --git a/lib/common/text_logger.h b/src/common/text_logger.h similarity index 100% rename from lib/common/text_logger.h rename to src/common/text_logger.h diff --git a/lib/common/toml_utils.cpp b/src/common/toml_utils.cpp similarity index 100% rename from lib/common/toml_utils.cpp rename to src/common/toml_utils.cpp diff --git a/lib/common/toml_utils.h b/src/common/toml_utils.h similarity index 100% rename from lib/common/toml_utils.h rename to src/common/toml_utils.h diff --git a/lib/common/types.h b/src/common/types.h similarity index 100% rename from lib/common/types.h rename to src/common/types.h diff --git a/lib/common/utils.cpp b/src/common/utils.cpp similarity index 100% rename from lib/common/utils.cpp rename to src/common/utils.cpp diff --git a/lib/common/utils.h b/src/common/utils.h similarity index 100% rename from lib/common/utils.h rename to src/common/utils.h diff --git a/lib/map/CMakeLists.txt b/src/device/CMakeLists.txt similarity index 65% rename from lib/map/CMakeLists.txt rename to src/device/CMakeLists.txt index c179bb6c..eb2275e0 100644 --- a/lib/map/CMakeLists.txt +++ b/src/device/CMakeLists.txt @@ -1,7 +1,7 @@ #---------------------------------------------------------------------------------------------------------------------- # XMidiCtrl - MIDI Controller plugin for X-Plane # -# Copyright (c) 2021-2023 Marco Auer +# Copyright (c) 2021-2024 Marco Auer # # XMidiCtrl is free software: you can redistribute it and/or modify it under the terms of the # GNU Affero General Public License as published by the Free Software Foundation, either version 3 @@ -20,15 +20,19 @@ cmake_minimum_required(VERSION 3.16) # Set project details -set(XMIDICTRL_LIB_MAP xmidictrl-map) -project(${XMIDICTRL_LIB_MAP}) +set(XMIDICTRL_LIB_DEV xmidictrl-dev) +project(${XMIDICTRL_LIB_DEV}) -message("-- Configuring build scripts for library ${XMIDICTRL_LIB_MAP}") - -message("---- Directory: src/map") +message("-- Configuring build scripts for library ${XMIDICTRL_LIB_DEV}") # Add sources -set(MAP_SRC +set(DEV_SRC + ${CMAKE_CURRENT_LIST_DIR}/conversions.cpp + ${CMAKE_CURRENT_LIST_DIR}/device.cpp + ${CMAKE_CURRENT_LIST_DIR}/device_list.cpp + ${CMAKE_CURRENT_LIST_DIR}/hid_device.cpp + ${CMAKE_CURRENT_LIST_DIR}/midi_device.cpp + ${CMAKE_CURRENT_LIST_DIR}/virtual_midi_device.cpp ${CMAKE_CURRENT_LIST_DIR}/map_init/map_init.cpp ${CMAKE_CURRENT_LIST_DIR}/map_in/map_in.cpp ${CMAKE_CURRENT_LIST_DIR}/map_in/map_in_cmd.cpp @@ -48,18 +52,11 @@ set(MAP_SRC ) # Build static library -add_library(${XMIDICTRL_LIB_MAP} STATIC ${MAP_SRC}) -add_library(${XMIDICTRL_LIB_MAP}-tests STATIC ${MAP_SRC}) - -target_link_libraries(${XMIDICTRL_LIB_MAP} PUBLIC toml11 fmt::fmt-header-only xmidictrl-common xmidictrl-env) -target_link_libraries(${XMIDICTRL_LIB_MAP}-tests PUBLIC toml11 fmt::fmt-header-only xmidictrl-common xmidictrl-env-tests) +add_library(${XMIDICTRL_LIB_DEV} STATIC ${DEV_SRC}) -target_include_directories(${XMIDICTRL_LIB_MAP} PUBLIC ${CMAKE_CURRENT_LIST_DIR}) -target_include_directories(${XMIDICTRL_LIB_MAP} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/map_init) -target_include_directories(${XMIDICTRL_LIB_MAP} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/map_in) -target_include_directories(${XMIDICTRL_LIB_MAP} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/map_out) +target_link_libraries(${XMIDICTRL_LIB_DEV} PUBLIC toml11 fmt::fmt-header-only rtmidi xmidictrl-common xmidictrl-env) -target_include_directories(${XMIDICTRL_LIB_MAP}-tests PUBLIC ${CMAKE_CURRENT_LIST_DIR}) -target_include_directories(${XMIDICTRL_LIB_MAP}-tests PUBLIC ${CMAKE_CURRENT_LIST_DIR}/map_init) -target_include_directories(${XMIDICTRL_LIB_MAP}-tests PUBLIC ${CMAKE_CURRENT_LIST_DIR}/map_in) -target_include_directories(${XMIDICTRL_LIB_MAP}-tests PUBLIC ${CMAKE_CURRENT_LIST_DIR}/map_out) \ No newline at end of file +target_include_directories(${XMIDICTRL_LIB_DEV} PUBLIC ${CMAKE_CURRENT_LIST_DIR}) +target_include_directories(${XMIDICTRL_LIB_DEV} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/map_init) +target_include_directories(${XMIDICTRL_LIB_DEV} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/map_in) +target_include_directories(${XMIDICTRL_LIB_DEV} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/map_out) diff --git a/src/profile/conversions.cpp b/src/device/conversions.cpp similarity index 100% rename from src/profile/conversions.cpp rename to src/device/conversions.cpp diff --git a/src/profile/conversions.h b/src/device/conversions.h similarity index 100% rename from src/profile/conversions.h rename to src/device/conversions.h diff --git a/src/profile/device.cpp b/src/device/device.cpp similarity index 100% rename from src/profile/device.cpp rename to src/device/device.cpp diff --git a/src/profile/device.h b/src/device/device.h similarity index 100% rename from src/profile/device.h rename to src/device/device.h diff --git a/src/profile/device_list.cpp b/src/device/device_list.cpp similarity index 100% rename from src/profile/device_list.cpp rename to src/device/device_list.cpp diff --git a/src/profile/device_list.h b/src/device/device_list.h similarity index 100% rename from src/profile/device_list.h rename to src/device/device_list.h diff --git a/src/profile/hid_device.cpp b/src/device/hid_device.cpp similarity index 100% rename from src/profile/hid_device.cpp rename to src/device/hid_device.cpp diff --git a/src/profile/hid_device.h b/src/device/hid_device.h similarity index 100% rename from src/profile/hid_device.h rename to src/device/hid_device.h diff --git a/lib/map/map_in/CMakeLists.txt b/src/device/map_in/CMakeLists.txt similarity index 100% rename from lib/map/map_in/CMakeLists.txt rename to src/device/map_in/CMakeLists.txt diff --git a/lib/map/map_in/label.h b/src/device/map_in/label.h similarity index 100% rename from lib/map/map_in/label.h rename to src/device/map_in/label.h diff --git a/lib/map/map_in/map_in.cpp b/src/device/map_in/map_in.cpp similarity index 100% rename from lib/map/map_in/map_in.cpp rename to src/device/map_in/map_in.cpp diff --git a/lib/map/map_in/map_in.h b/src/device/map_in/map_in.h similarity index 100% rename from lib/map/map_in/map_in.h rename to src/device/map_in/map_in.h diff --git a/lib/map/map_in/map_in_cmd.cpp b/src/device/map_in/map_in_cmd.cpp similarity index 100% rename from lib/map/map_in/map_in_cmd.cpp rename to src/device/map_in/map_in_cmd.cpp diff --git a/lib/map/map_in/map_in_cmd.h b/src/device/map_in/map_in_cmd.h similarity index 100% rename from lib/map/map_in/map_in_cmd.h rename to src/device/map_in/map_in_cmd.h diff --git a/lib/map/map_in/map_in_drf.cpp b/src/device/map_in/map_in_drf.cpp similarity index 100% rename from lib/map/map_in/map_in_drf.cpp rename to src/device/map_in/map_in_drf.cpp diff --git a/lib/map/map_in/map_in_drf.h b/src/device/map_in/map_in_drf.h similarity index 100% rename from lib/map/map_in/map_in_drf.h rename to src/device/map_in/map_in_drf.h diff --git a/lib/map/map_in/map_in_enc.cpp b/src/device/map_in/map_in_enc.cpp similarity index 100% rename from lib/map/map_in/map_in_enc.cpp rename to src/device/map_in/map_in_enc.cpp diff --git a/lib/map/map_in/map_in_enc.h b/src/device/map_in/map_in_enc.h similarity index 100% rename from lib/map/map_in/map_in_enc.h rename to src/device/map_in/map_in_enc.h diff --git a/lib/map/map_in/map_in_label.cpp b/src/device/map_in/map_in_label.cpp similarity index 100% rename from lib/map/map_in/map_in_label.cpp rename to src/device/map_in/map_in_label.cpp diff --git a/lib/map/map_in/map_in_label.h b/src/device/map_in/map_in_label.h similarity index 100% rename from lib/map/map_in/map_in_label.h rename to src/device/map_in/map_in_label.h diff --git a/lib/map/map_in/map_in_list.cpp b/src/device/map_in/map_in_list.cpp similarity index 100% rename from lib/map/map_in/map_in_list.cpp rename to src/device/map_in/map_in_list.cpp diff --git a/lib/map/map_in/map_in_list.h b/src/device/map_in/map_in_list.h similarity index 100% rename from lib/map/map_in/map_in_list.h rename to src/device/map_in/map_in_list.h diff --git a/lib/map/map_in/map_in_pnp.cpp b/src/device/map_in/map_in_pnp.cpp similarity index 100% rename from lib/map/map_in/map_in_pnp.cpp rename to src/device/map_in/map_in_pnp.cpp diff --git a/lib/map/map_in/map_in_pnp.h b/src/device/map_in/map_in_pnp.h similarity index 100% rename from lib/map/map_in/map_in_pnp.h rename to src/device/map_in/map_in_pnp.h diff --git a/lib/map/map_in/map_in_sld.cpp b/src/device/map_in/map_in_sld.cpp similarity index 100% rename from lib/map/map_in/map_in_sld.cpp rename to src/device/map_in/map_in_sld.cpp diff --git a/lib/map/map_in/map_in_sld.h b/src/device/map_in/map_in_sld.h similarity index 100% rename from lib/map/map_in/map_in_sld.h rename to src/device/map_in/map_in_sld.h diff --git a/lib/map/map_init/CMakeLists.txt b/src/device/map_init/CMakeLists.txt similarity index 100% rename from lib/map/map_init/CMakeLists.txt rename to src/device/map_init/CMakeLists.txt diff --git a/lib/map/map_init/map_init.cpp b/src/device/map_init/map_init.cpp similarity index 100% rename from lib/map/map_init/map_init.cpp rename to src/device/map_init/map_init.cpp diff --git a/lib/map/map_init/map_init.h b/src/device/map_init/map_init.h similarity index 100% rename from lib/map/map_init/map_init.h rename to src/device/map_init/map_init.h diff --git a/lib/map/map_init/map_init_list.cpp b/src/device/map_init/map_init_list.cpp similarity index 100% rename from lib/map/map_init/map_init_list.cpp rename to src/device/map_init/map_init_list.cpp diff --git a/lib/map/map_init/map_init_list.h b/src/device/map_init/map_init_list.h similarity index 100% rename from lib/map/map_init/map_init_list.h rename to src/device/map_init/map_init_list.h diff --git a/lib/map/map_out/CMakeLists.txt b/src/device/map_out/CMakeLists.txt similarity index 100% rename from lib/map/map_out/CMakeLists.txt rename to src/device/map_out/CMakeLists.txt diff --git a/lib/map/map_out/map_out.cpp b/src/device/map_out/map_out.cpp similarity index 100% rename from lib/map/map_out/map_out.cpp rename to src/device/map_out/map_out.cpp diff --git a/lib/map/map_out/map_out.h b/src/device/map_out/map_out.h similarity index 100% rename from lib/map/map_out/map_out.h rename to src/device/map_out/map_out.h diff --git a/lib/map/map_out/map_out_con.cpp b/src/device/map_out/map_out_con.cpp similarity index 100% rename from lib/map/map_out/map_out_con.cpp rename to src/device/map_out/map_out_con.cpp diff --git a/lib/map/map_out/map_out_con.h b/src/device/map_out/map_out_con.h similarity index 100% rename from lib/map/map_out/map_out_con.h rename to src/device/map_out/map_out_con.h diff --git a/lib/map/map_out/map_out_drf.cpp b/src/device/map_out/map_out_drf.cpp similarity index 100% rename from lib/map/map_out/map_out_drf.cpp rename to src/device/map_out/map_out_drf.cpp diff --git a/lib/map/map_out/map_out_drf.h b/src/device/map_out/map_out_drf.h similarity index 100% rename from lib/map/map_out/map_out_drf.h rename to src/device/map_out/map_out_drf.h diff --git a/lib/map/map_out/map_out_list.cpp b/src/device/map_out/map_out_list.cpp similarity index 100% rename from lib/map/map_out/map_out_list.cpp rename to src/device/map_out/map_out_list.cpp diff --git a/lib/map/map_out/map_out_list.h b/src/device/map_out/map_out_list.h similarity index 100% rename from lib/map/map_out/map_out_list.h rename to src/device/map_out/map_out_list.h diff --git a/lib/map/map_out/map_out_sld.cpp b/src/device/map_out/map_out_sld.cpp similarity index 100% rename from lib/map/map_out/map_out_sld.cpp rename to src/device/map_out/map_out_sld.cpp diff --git a/lib/map/map_out/map_out_sld.h b/src/device/map_out/map_out_sld.h similarity index 100% rename from lib/map/map_out/map_out_sld.h rename to src/device/map_out/map_out_sld.h diff --git a/src/profile/midi_device.cpp b/src/device/midi_device.cpp similarity index 99% rename from src/profile/midi_device.cpp rename to src/device/midi_device.cpp index faa1a483..27eb4bc7 100644 --- a/src/profile/midi_device.cpp +++ b/src/device/midi_device.cpp @@ -17,6 +17,7 @@ #include "midi_device.h" +#include #include // XMidiCtrl diff --git a/src/profile/midi_device.h b/src/device/midi_device.h similarity index 100% rename from src/profile/midi_device.h rename to src/device/midi_device.h diff --git a/src/profile/virtual_midi_device.cpp b/src/device/virtual_midi_device.cpp similarity index 100% rename from src/profile/virtual_midi_device.cpp rename to src/device/virtual_midi_device.cpp diff --git a/src/profile/virtual_midi_device.h b/src/device/virtual_midi_device.h similarity index 100% rename from src/profile/virtual_midi_device.h rename to src/device/virtual_midi_device.h diff --git a/lib/env/CMakeLists.txt b/src/env/CMakeLists.txt similarity index 58% rename from lib/env/CMakeLists.txt rename to src/env/CMakeLists.txt index b176012a..748ef105 100644 --- a/lib/env/CMakeLists.txt +++ b/src/env/CMakeLists.txt @@ -1,7 +1,7 @@ #---------------------------------------------------------------------------------------------------------------------- # XMidiCtrl - MIDI Controller plugin for X-Plane # -# Copyright (c) 2021-2023 Marco Auer +# Copyright (c) 2021-2024 Marco Auer # # XMidiCtrl is free software: you can redistribute it and/or modify it under the terms of the # GNU Affero General Public License as published by the Free Software Foundation, either version 3 @@ -30,33 +30,13 @@ set(ENV_SRC ${CMAKE_CURRENT_LIST_DIR}/settings.cpp ) -set(ENV_SRC_XPLANE - ${CMAKE_CURRENT_LIST_DIR}/xplane/cmd_xplane.cpp - ${CMAKE_CURRENT_LIST_DIR}/xplane/data_xplane.cpp - ${CMAKE_CURRENT_LIST_DIR}/xplane/env_xplane.cpp -) - -set(ENV_SRC_TESTS - ${CMAKE_CURRENT_LIST_DIR}/tests/command_tests.cpp - ${CMAKE_CURRENT_LIST_DIR}/tests/data_tests.cpp - ${CMAKE_CURRENT_LIST_DIR}/tests/env_tests.cpp -) - # Build static library for X-Plane environment add_library(${PROJECT_NAME} STATIC) -target_sources(${PROJECT_NAME} PUBLIC ${ENV_SRC} ${ENV_SRC_XPLANE}) +target_sources(${PROJECT_NAME} PUBLIC ${ENV_SRC}) target_link_libraries(${PROJECT_NAME} PUBLIC toml11 fmt::fmt-header-only imgui xpsdk xmidictrl-common) target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR}) -target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/xplane) - -# Build static library for test environment -add_library(${PROJECT_NAME}-tests STATIC) - -target_sources(${PROJECT_NAME}-tests PUBLIC ${ENV_SRC} ${ENV_SRC_TESTS}) -target_link_libraries(${PROJECT_NAME}-tests PUBLIC toml11 fmt::fmt-header-only xpsdk imgui xmidictrl-common) -target_include_directories(${PROJECT_NAME}-tests PUBLIC ${CMAKE_CURRENT_LIST_DIR}) -target_include_directories(${PROJECT_NAME}-tests PUBLIC ${CMAKE_CURRENT_LIST_DIR}/tests) -#target_include_directories(${PROJECT_NAME}-tests PUBLIC ${PROJECT_SOURCE_DIR}/external/xpsdk) \ No newline at end of file +add_subdirectory(tests) +add_subdirectory(xplane) \ No newline at end of file diff --git a/lib/env/commands.h b/src/env/commands.h similarity index 100% rename from lib/env/commands.h rename to src/env/commands.h diff --git a/lib/env/data.h b/src/env/data.h similarity index 100% rename from lib/env/data.h rename to src/env/data.h diff --git a/lib/env/data_item.h b/src/env/data_item.h similarity index 100% rename from lib/env/data_item.h rename to src/env/data_item.h diff --git a/lib/env/environment.cpp b/src/env/environment.cpp similarity index 100% rename from lib/env/environment.cpp rename to src/env/environment.cpp diff --git a/lib/env/environment.h b/src/env/environment.h similarity index 100% rename from lib/env/environment.h rename to src/env/environment.h diff --git a/lib/env/inbound_task.h b/src/env/inbound_task.h similarity index 100% rename from lib/env/inbound_task.h rename to src/env/inbound_task.h diff --git a/lib/env/inbound_worker.cpp b/src/env/inbound_worker.cpp similarity index 100% rename from lib/env/inbound_worker.cpp rename to src/env/inbound_worker.cpp diff --git a/lib/env/inbound_worker.h b/src/env/inbound_worker.h similarity index 100% rename from lib/env/inbound_worker.h rename to src/env/inbound_worker.h diff --git a/lib/env/info_message.h b/src/env/info_message.h similarity index 100% rename from lib/env/info_message.h rename to src/env/info_message.h diff --git a/lib/env/settings.cpp b/src/env/settings.cpp similarity index 100% rename from lib/env/settings.cpp rename to src/env/settings.cpp diff --git a/lib/env/settings.h b/src/env/settings.h similarity index 100% rename from lib/env/settings.h rename to src/env/settings.h diff --git a/lib/CMakeLists.txt b/src/env/tests/CMakeLists.txt similarity index 54% rename from lib/CMakeLists.txt rename to src/env/tests/CMakeLists.txt index 8d7e51ce..c9ab46af 100644 --- a/lib/CMakeLists.txt +++ b/src/env/tests/CMakeLists.txt @@ -1,7 +1,7 @@ #---------------------------------------------------------------------------------------------------------------------- # XMidiCtrl - MIDI Controller plugin for X-Plane # -# Copyright (c) 2021-2023 Marco Auer +# Copyright (c) 2021-2024 Marco Auer # # XMidiCtrl is free software: you can redistribute it and/or modify it under the terms of the # GNU Affero General Public License as published by the Free Software Foundation, either version 3 @@ -15,15 +15,28 @@ # If not, see . #---------------------------------------------------------------------------------------------------------------------- -# Set compiler options -set(CMAKE_CXX_STANDARD 20) +# Set required CMake version +cmake_minimum_required(VERSION 3.16) -# Add toml11 for reading and writing the config files -message("-- Configuring build scripts for library common") -add_subdirectory(common) +# Set project details +project(xmidictrl-env-tests) -message("-- Configuring build scripts for library environment") -add_subdirectory(env) +message("-- Configuring build scripts for library ${PROJECT_NAME}") -message("-- Configuring build scripts for library mapping") -add_subdirectory(map) \ No newline at end of file +# Include fonts +include_directories(${FONTS_INCLUDEDIR}) + +# Add sources +set(ENV_SRC_TESTS + ${CMAKE_CURRENT_LIST_DIR}/command_tests.cpp + ${CMAKE_CURRENT_LIST_DIR}/data_tests.cpp + ${CMAKE_CURRENT_LIST_DIR}/env_tests.cpp +) + +# Build static library for X-Plane environment +add_library(${PROJECT_NAME} STATIC) + +target_sources(${PROJECT_NAME} PUBLIC ${ENV_SRC_TESTS}) +target_link_libraries(${PROJECT_NAME} PUBLIC toml11 fmt::fmt-header-only imgui xpsdk xmidictrl-common xmidictrl-env) + +target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR}) \ No newline at end of file diff --git a/lib/env/tests/command_tests.cpp b/src/env/tests/command_tests.cpp similarity index 100% rename from lib/env/tests/command_tests.cpp rename to src/env/tests/command_tests.cpp diff --git a/lib/env/tests/command_tests.h b/src/env/tests/command_tests.h similarity index 100% rename from lib/env/tests/command_tests.h rename to src/env/tests/command_tests.h diff --git a/lib/env/tests/data_tests.cpp b/src/env/tests/data_tests.cpp similarity index 100% rename from lib/env/tests/data_tests.cpp rename to src/env/tests/data_tests.cpp diff --git a/lib/env/tests/data_tests.h b/src/env/tests/data_tests.h similarity index 100% rename from lib/env/tests/data_tests.h rename to src/env/tests/data_tests.h diff --git a/lib/env/tests/env_tests.cpp b/src/env/tests/env_tests.cpp similarity index 100% rename from lib/env/tests/env_tests.cpp rename to src/env/tests/env_tests.cpp diff --git a/lib/env/tests/env_tests.h b/src/env/tests/env_tests.h similarity index 100% rename from lib/env/tests/env_tests.h rename to src/env/tests/env_tests.h diff --git a/src/ui/CMakeLists.txt b/src/env/xplane/CMakeLists.txt similarity index 50% rename from src/ui/CMakeLists.txt rename to src/env/xplane/CMakeLists.txt index a699af1a..f9f60e90 100644 --- a/src/ui/CMakeLists.txt +++ b/src/env/xplane/CMakeLists.txt @@ -1,7 +1,7 @@ #---------------------------------------------------------------------------------------------------------------------- # XMidiCtrl - MIDI Controller plugin for X-Plane # -# Copyright (c) 2021-2023 Marco Auer +# Copyright (c) 2021-2024 Marco Auer # # XMidiCtrl is free software: you can redistribute it and/or modify it under the terms of the # GNU Affero General Public License as published by the Free Software Foundation, either version 3 @@ -15,17 +15,40 @@ # If not, see . #---------------------------------------------------------------------------------------------------------------------- -message("---- Directory: src/ui") +# Set required CMake version +cmake_minimum_required(VERSION 3.16) -# Set sources -set(UI_SRC +# Set project details +project(xmidictrl-env-xplane) + +message("-- Configuring build scripts for library ${PROJECT_NAME}") + +# Include fonts +include_directories(${FONTS_INCLUDEDIR}) + +# Add sources +set(ENV_SRC_XPLANE + ${CMAKE_CURRENT_LIST_DIR}/cmd_xplane.cpp + ${CMAKE_CURRENT_LIST_DIR}/data_xplane.cpp + ${CMAKE_CURRENT_LIST_DIR}/env_xplane.cpp ${CMAKE_CURRENT_LIST_DIR}/ImGuiFontAtlas.cpp ${CMAKE_CURRENT_LIST_DIR}/imgui_window.cpp ${CMAKE_CURRENT_LIST_DIR}/xplane_window.cpp - ) +) + +# Apple deprecated OpenGL...yea, we know, keep quiet +if (APPLE) + set_source_files_properties( + ${CMAKE_CURRENT_LIST_DIR}/ImgFontAtlas.cpp + ${CMAKE_CURRENT_LIST_DIR}/imgui_window.cpp + PROPERTIES + COMPILE_OPTIONS "-Wno-deprecated-declarations") +endif() + +# Build static library for X-Plane environment +add_library(${PROJECT_NAME} STATIC) -# Add sources to target -target_sources(${PROJECT_NAME} PRIVATE ${UI_SRC}) +target_sources(${PROJECT_NAME} PUBLIC ${ENV_SRC_XPLANE}) +target_link_libraries(${PROJECT_NAME} PUBLIC toml11 fmt::fmt-header-only imgui xpsdk xmidictrl-common xmidictrl-env) -# Include current directory -include_directories(${CMAKE_CURRENT_LIST_DIR}) \ No newline at end of file +target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR}) \ No newline at end of file diff --git a/src/ui/ImGuiFontAtlas.cpp b/src/env/xplane/ImGuiFontAtlas.cpp similarity index 100% rename from src/ui/ImGuiFontAtlas.cpp rename to src/env/xplane/ImGuiFontAtlas.cpp diff --git a/src/ui/ImGuiFontAtlas.h b/src/env/xplane/ImGuiFontAtlas.h similarity index 100% rename from src/ui/ImGuiFontAtlas.h rename to src/env/xplane/ImGuiFontAtlas.h diff --git a/lib/env/xplane/cmd_xplane.cpp b/src/env/xplane/cmd_xplane.cpp similarity index 100% rename from lib/env/xplane/cmd_xplane.cpp rename to src/env/xplane/cmd_xplane.cpp diff --git a/lib/env/xplane/cmd_xplane.h b/src/env/xplane/cmd_xplane.h similarity index 100% rename from lib/env/xplane/cmd_xplane.h rename to src/env/xplane/cmd_xplane.h diff --git a/lib/env/xplane/data_xplane.cpp b/src/env/xplane/data_xplane.cpp similarity index 100% rename from lib/env/xplane/data_xplane.cpp rename to src/env/xplane/data_xplane.cpp diff --git a/lib/env/xplane/data_xplane.h b/src/env/xplane/data_xplane.h similarity index 100% rename from lib/env/xplane/data_xplane.h rename to src/env/xplane/data_xplane.h diff --git a/lib/env/xplane/env_xplane.cpp b/src/env/xplane/env_xplane.cpp similarity index 100% rename from lib/env/xplane/env_xplane.cpp rename to src/env/xplane/env_xplane.cpp diff --git a/lib/env/xplane/env_xplane.h b/src/env/xplane/env_xplane.h similarity index 100% rename from lib/env/xplane/env_xplane.h rename to src/env/xplane/env_xplane.h diff --git a/src/ui/imgui_window.cpp b/src/env/xplane/imgui_window.cpp similarity index 100% rename from src/ui/imgui_window.cpp rename to src/env/xplane/imgui_window.cpp diff --git a/src/ui/imgui_window.h b/src/env/xplane/imgui_window.h similarity index 100% rename from src/ui/imgui_window.h rename to src/env/xplane/imgui_window.h diff --git a/src/ui/xplane_window.cpp b/src/env/xplane/xplane_window.cpp similarity index 100% rename from src/ui/xplane_window.cpp rename to src/env/xplane/xplane_window.cpp diff --git a/src/ui/xplane_window.h b/src/env/xplane/xplane_window.h similarity index 100% rename from src/ui/xplane_window.h rename to src/env/xplane/xplane_window.h diff --git a/src/plugin/CMakeLists.txt b/src/plugin/CMakeLists.txt index 984a35e8..e0a74977 100644 --- a/src/plugin/CMakeLists.txt +++ b/src/plugin/CMakeLists.txt @@ -1,7 +1,7 @@ #---------------------------------------------------------------------------------------------------------------------- # XMidiCtrl - MIDI Controller plugin for X-Plane # -# Copyright (c) 2021-2023 Marco Auer +# Copyright (c) 2021-2024 Marco Auer # # XMidiCtrl is free software: you can redistribute it and/or modify it under the terms of the # GNU Affero General Public License as published by the Free Software Foundation, either version 3 @@ -15,13 +15,71 @@ # If not, see . #---------------------------------------------------------------------------------------------------------------------- -message("---- Directory: src/plugin") +message("-- Configuring build scripts for ${PROJECT_NAME}") + +# Include fonts +include_directories(${FONTS_INCLUDEDIR}) + +# Include the ImGui files +include_directories(${IMGUI_INCLUDEDIR}) + +# Build shared library +add_library(${PROJECT_NAME} SHARED) + +# add static libraries for xmidictrl +target_link_libraries(${PROJECT_NAME} xmidictrl-common xmidictrl-env xmidictrl-env-xplane xmidictrl-dev) + +# link required dependencies +if (WIN32) + message("Build for Windows Platform") + if (MINGW) + target_link_libraries(${PROJECT_NAME} mingw_stdthreads) + endif() + if (MSVC) + target_link_libraries(${PROJECT_NAME} toml11 fmt::fmt-header-only rtmidi hidapi::hidapi winmm xpsdk imgui) + include(GenerateExportHeader) + generate_export_header(${PROJECT_NAME}) + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + $ "${PROJECT_SOURCE_DIR}/package/${PROJECT_NAME}/win_x64/$" + ) + else() + target_link_libraries(${PROJECT_NAME} -s -static -static-libgcc -static-libstdc++ toml11 fmt::fmt-header-only rtmidi hidapi::hidapi winmm xpsdk imgui) + set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/package/${PROJECT_NAME}/win_x64") + endif() +elseif (APPLE) + message("Build for Apple Platform") + find_library(CORE_FOUNDATION_LIBRARY CoreFoundation REQUIRED) + find_library(Cocoa_LIBRARY Cocoa REQUIRED) + find_library(Security_LIBRARY Security REQUIRED) + find_library(GSS_LIBRARY GSS REQUIRED) + find_library(OpenGL_LIBRARY OpenGL REQUIRED) + # Link OS X core system libraries. + target_link_libraries(${PROJECT_NAME} ${CORE_FOUNDATION_LIBRARY} ${Cocoa_LIBRARY} ${Security_LIBRARY} ${GSS_LIBRARY} ${OpenGL_LIBRARY}) + target_link_libraries(${PROJECT_NAME} toml11 fmt::fmt-header-only rtmidi hidapi::hidapi xpsdk imgui) + target_link_options(${PROJECT_NAME} PRIVATE "-Wl,-no_weak_imports") + + # Restrict set of symbols exported from the plugin to the ones required by XPLM: + # target_link_options(${PROJECT_NAME} PRIVATE "-exported_symbols_list ${CMAKE_SOURCE_DIR}/src/xmidictrl.sym_mac") + set_target_properties(${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/package/${PROJECT_NAME}/mac_x64") +elseif (UNIX) + message("Build for Linux Platform") + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/package/${PROJECT_NAME}/lin_64") + target_link_libraries(${PROJECT_NAME} -static-libgcc -static-libstdc++ -fPIC toml11 fmt::fmt-header-only rtmidi hidapi::hidapi xpsdk imgui) + set_target_properties(${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/package/${PROJECT_NAME}/lin_x64") +endif () + +# Set output properties for X-Plane standards +set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "") +set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}") +set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".xpl") # Add sources set(PLUGIN_SRC ${CMAKE_CURRENT_LIST_DIR}/plugin.cpp ${CMAKE_CURRENT_LIST_DIR}/plugin_main.cpp - ) + ${CMAKE_CURRENT_LIST_DIR}/profile.cpp +) # Add sources to target target_sources(${PROJECT_NAME} PRIVATE ${PLUGIN_SRC}) diff --git a/src/profile/profile.cpp b/src/plugin/profile.cpp similarity index 100% rename from src/profile/profile.cpp rename to src/plugin/profile.cpp diff --git a/src/profile/profile.h b/src/plugin/profile.h similarity index 100% rename from src/profile/profile.h rename to src/plugin/profile.h diff --git a/src/profile/CMakeLists.txt b/src/profile/CMakeLists.txt deleted file mode 100644 index ba5acd49..00000000 --- a/src/profile/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -#---------------------------------------------------------------------------------------------------------------------- -# XMidiCtrl - MIDI Controller plugin for X-Plane -# -# Copyright (c) 2021-2023 Marco Auer -# -# XMidiCtrl is free software: you can redistribute it and/or modify it under the terms of the -# GNU Affero General Public License as published by the Free Software Foundation, either version 3 -# of the License, or (at your option) any later version. -# -# XMidiCtrl is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even -# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License along with XMidiCtrl. -# If not, see . -#---------------------------------------------------------------------------------------------------------------------- - - -# Set required CMake version -cmake_minimum_required(VERSION 3.16) - -# Set project details -set(XMIDICTRL_LIB_PROFILE xmidictrl-profile) -project(${XMIDICTRL_LIB_PROFILE}) - -message("-- Configuring build scripts for library ${XMIDICTRL_LIB_PROFILE}") - -message("---- Directory: src/profile") - -# Add sources -set(PROFILE_SRC - - ${CMAKE_CURRENT_LIST_DIR}/conversions.cpp - ${CMAKE_CURRENT_LIST_DIR}/device.cpp - ${CMAKE_CURRENT_LIST_DIR}/device_list.cpp - ${CMAKE_CURRENT_LIST_DIR}/hid_device.cpp - ${CMAKE_CURRENT_LIST_DIR}/midi_device.cpp - ${CMAKE_CURRENT_LIST_DIR}/profile.cpp - ${CMAKE_CURRENT_LIST_DIR}/virtual_midi_device.cpp - ) - -# Build static library -add_library(${XMIDICTRL_LIB_PROFILE} STATIC ${PROFILE_SRC}) - -target_link_libraries(${XMIDICTRL_LIB_PROFILE} PUBLIC toml11 fmt::fmt-header-only rtmidi xmidictrl-common xmidictrl-env xmidictrl-map) - -target_include_directories(${XMIDICTRL_LIB_PROFILE} PUBLIC ${CMAKE_CURRENT_LIST_DIR}) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b7395886..c265455d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,7 +1,7 @@ #---------------------------------------------------------------------------------------------------------------------- # XMidiCtrl - MIDI Controller plugin for X-Plane # -# Copyright (c) 2021-2023 Marco Auer +# Copyright (c) 2021-2024 Marco Auer # # XMidiCtrl is free software: you can redistribute it and/or modify it under the terms of the # GNU Affero General Public License as published by the Free Software Foundation, either version 3 @@ -46,7 +46,7 @@ elseif (UNIX) message("Build unit tests for Linux Platform") endif () -target_link_libraries(${PROJECT_NAME} toml11 fmt::fmt-header-only rtmidi imgui doctest xmidictrl-common xmidictrl-env-tests xmidictrl-map-tests) +target_link_libraries(${PROJECT_NAME} toml11 fmt::fmt-header-only rtmidi imgui doctest xmidictrl-common xmidictrl-env-tests xmidictrl-dev) include(${CMAKE_SOURCE_DIR}/external/doctest/scripts/cmake/doctest.cmake) doctest_discover_tests(${PROJECT_NAME}) \ No newline at end of file