diff --git a/.vscode/settings.json b/.vscode/settings.json index 6ca437e..76b8183 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,5 +3,8 @@ "cmake.configureArgs": [ "-DIBM=ON" ], - "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools" + "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", + "files.associations": { + "cmath": "cpp" + } } \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 8473c7e..84f88e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,9 @@ set(PLUGIN_NAME GAConnector) option(DEBUG "Debug symbols" OFF) +add_subdirectory( + makerwysxp +) add_subdirectory( xplugin ) diff --git a/file/pathSegment.hpp b/file/pathSegment.hpp index 75431cb..c0dd626 100644 --- a/file/pathSegment.hpp +++ b/file/pathSegment.hpp @@ -1,3 +1,6 @@ +#ifndef GERMANAIRLINESVA_GACONNECTOR_PATHSEGMENT_H +#define GERMANAIRLINESVA_GACONNECTOR_PATHSEGMENT_H + #include #include #include @@ -54,3 +57,5 @@ class PathSegment return !(lhs == rhs); } }; + +#endif diff --git a/file/recordingPath.hpp b/file/recordingPath.hpp index 8740256..6672c41 100644 --- a/file/recordingPath.hpp +++ b/file/recordingPath.hpp @@ -1,3 +1,6 @@ +#ifndef GERMANAIRLINESVA_GACONNECTOR_RECORDINGPATH_H +#define GERMANAIRLINESVA_GACONNECTOR_RECORDINGPATH_H + #include #include #include @@ -21,4 +24,6 @@ class Path std::uint8_t *getBinaryData() { return file.data(); } std::size_t getBinaryLength() { return file.size(); } -}; \ No newline at end of file +}; + +#endif \ No newline at end of file diff --git a/makerwysxp/CMakeLists.txt b/makerwysxp/CMakeLists.txt new file mode 100644 index 0000000..0e9c029 --- /dev/null +++ b/makerwysxp/CMakeLists.txt @@ -0,0 +1,92 @@ +file(GLOB makerwysxp CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/makerwysxp/*.cpp) + +add_library(makerwysxp SHARED + ${makerwysxp} +) + +target_include_directories(makerwysxp PRIVATE + ${CMAKE_SOURCE_DIR}/makerwysxp/include + ${CMAKE_SOURCE_DIR}/file +) + +set_target_properties(makerwysxp PROPERTIES + PUBLIC_HEADER ${CMAKE_SOURCE_DIR}/makerwysxp/include +) +target_compile_definitions(makerwysxp PRIVATE + _USE_MATH_DEFINES +) +target_compile_options(makerwysxp PRIVATE + -Wall + -Wextra + -pedantic +) +if(DEBUG) + target_compile_options(makerwysxp PRIVATE + -g + ) + target_link_options(makerwysxp PRIVATE + -g + ) +else() + target_compile_options(makerwysxp PRIVATE + -O2 + ) +endif() + +if(APPLE) + message("Building makerwysxp for MacOSX Universal into ${PROJECT_BINARY_DIR}/${PLUGIN_NAME}/${BIT}") + + set_target_properties(makerwysxp PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}" + BUILD_WITH_INSTALL_NAME_DIR TRUE + ) + + target_compile_options(makerwysxp PRIVATE + "SHELL:-arch i386" + "SHELL:-arch x86_64" + ) + target_link_options(makerwysxp PRIVATE + "SHELL:-arch i386" + "SHELL:-arch x86_64" + ) + target_link_libraries(makerwysxp PRIVATE + "-framework Security" + ) +elseif(UNIX) + message("Building makerwysxp for Linux ${BIT} into ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}") + + set_target_properties(makerwysxp PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}" + ) + + target_compile_options(makerwysxp PRIVATE + -nodefaultlibs + ) + if(BIT STREQUAL "32") + target_compile_options(makerwysxp PRIVATE + -m32 + ) + target_link_options(makerwysxp PRIVATE + -m32 + ) + endif() +elseif(WIN32) + message("Building makerwysxp for Windows ${BIT} into ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}") + + set_target_properties(makerwysxp PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}" + ) + + if(DEBUG) + target_compile_options(makerwysxp PRIVATE + -gcodeview + ) + target_link_options(makerwysxp PRIVATE + -Wl,-pdb= + ) + endif() + target_link_options(makerwysxp PRIVATE + -static-libgcc + -static-libstdc++ + ) +endif() diff --git a/file/gate.hpp b/makerwysxp/include/gate.hpp similarity index 100% rename from file/gate.hpp rename to makerwysxp/include/gate.hpp diff --git a/xplugin/include/makeRwysXP.h b/makerwysxp/include/makeRwysXP.h similarity index 100% rename from xplugin/include/makeRwysXP.h rename to makerwysxp/include/makeRwysXP.h diff --git a/file/runway.hpp b/makerwysxp/include/runway.hpp similarity index 100% rename from file/runway.hpp rename to makerwysxp/include/runway.hpp diff --git a/xplugin/makeRwysXP.cpp b/makerwysxp/makeRwysXP.cpp similarity index 100% rename from xplugin/makeRwysXP.cpp rename to makerwysxp/makeRwysXP.cpp diff --git a/xplugin/CMakeLists.txt b/xplugin/CMakeLists.txt index 217885f..1ff6786 100644 --- a/xplugin/CMakeLists.txt +++ b/xplugin/CMakeLists.txt @@ -4,11 +4,11 @@ file(GLOB file CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/file/*.cpp) add_library(germanairlinesva_xplugin SHARED ${socket} ${file} - makeRwysXP.cpp main.cpp ) target_include_directories(germanairlinesva_xplugin PRIVATE + ${CMAKE_SOURCE_DIR}/makerwysxp/include ${CMAKE_SOURCE_DIR}/socket/include ${CMAKE_SOURCE_DIR}/XPSDK/CHeaders ${CMAKE_SOURCE_DIR}/nlohmann @@ -133,3 +133,7 @@ elseif(WIN32) xPluginWin.cpp ) endif() + +target_link_libraries(germanairlinesva_xplugin PRIVATE + makerwysxp +) diff --git a/xplugin/xPluginWin.cpp b/xplugin/xPluginWin.cpp index 07fd884..1abbc96 100644 --- a/xplugin/xPluginWin.cpp +++ b/xplugin/xPluginWin.cpp @@ -1,6 +1,8 @@ #include #include +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-parameter" BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) @@ -15,3 +17,5 @@ BOOL APIENTRY DllMain(HANDLE hModule, } return TRUE; } + +#pragma clang diagnostic pop