Skip to content

Commit

Permalink
Merged new folder structure
Browse files Browse the repository at this point in the history
  • Loading branch information
mauer committed Mar 2, 2024
1 parent 0da01c9 commit 25d5636
Show file tree
Hide file tree
Showing 115 changed files with 145 additions and 191 deletions.
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ endif()
# add external libraries
add_subdirectory(external)

# Add libraries
add_subdirectory(lib)

# Add plugin
add_subdirectory(src)

Expand Down
78 changes: 5 additions & 73 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,78 +15,10 @@
# If not, see <https://www.gnu.org/licenses/>.
#----------------------------------------------------------------------------------------------------------------------

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
$<TARGET_FILE:${PROJECT_NAME}> "${PROJECT_SOURCE_DIR}/package/${PROJECT_NAME}/win_x64/$<TARGET_FILE_NAME:${PROJECT_NAME}>"
)
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)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
37 changes: 17 additions & 20 deletions lib/map/CMakeLists.txt → src/device/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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)
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)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions src/profile/midi_device.cpp → src/device/midi_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "midi_device.h"

#include <mutex>
#include <utility>

// XMidiCtrl
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
28 changes: 4 additions & 24 deletions lib/env/CMakeLists.txt → src/env/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
add_subdirectory(tests)
add_subdirectory(xplane)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 23 additions & 10 deletions lib/CMakeLists.txt → src/env/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,15 +15,28 @@
# If not, see <https://www.gnu.org/licenses/>.
#----------------------------------------------------------------------------------------------------------------------

# 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)
# 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})
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
41 changes: 32 additions & 9 deletions src/ui/CMakeLists.txt → src/env/xplane/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,17 +15,40 @@
# If not, see <https://www.gnu.org/licenses/>.
#----------------------------------------------------------------------------------------------------------------------

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})
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR})
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 25d5636

Please sign in to comment.