Move MakeRwys to own lib

This commit is contained in:
Kilian Hofmann 2022-09-04 01:19:50 +02:00
parent a820f7456a
commit 3b2f146679
11 changed files with 119 additions and 3 deletions

View File

@ -3,5 +3,8 @@
"cmake.configureArgs": [ "cmake.configureArgs": [
"-DIBM=ON" "-DIBM=ON"
], ],
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools" "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
"files.associations": {
"cmath": "cpp"
}
} }

View File

@ -12,6 +12,9 @@ set(PLUGIN_NAME GAConnector)
option(DEBUG "Debug symbols" OFF) option(DEBUG "Debug symbols" OFF)
add_subdirectory(
makerwysxp
)
add_subdirectory( add_subdirectory(
xplugin xplugin
) )

View File

@ -1,3 +1,6 @@
#ifndef GERMANAIRLINESVA_GACONNECTOR_PATHSEGMENT_H
#define GERMANAIRLINESVA_GACONNECTOR_PATHSEGMENT_H
#include <cstdint> #include <cstdint>
#include <cstring> #include <cstring>
#include <vector> #include <vector>
@ -54,3 +57,5 @@ class PathSegment
return !(lhs == rhs); return !(lhs == rhs);
} }
}; };
#endif

View File

@ -1,3 +1,6 @@
#ifndef GERMANAIRLINESVA_GACONNECTOR_RECORDINGPATH_H
#define GERMANAIRLINESVA_GACONNECTOR_RECORDINGPATH_H
#include <cstdint> #include <cstdint>
#include <cstring> #include <cstring>
#include <vector> #include <vector>
@ -21,4 +24,6 @@ class Path
std::uint8_t *getBinaryData() { return file.data(); } std::uint8_t *getBinaryData() { return file.data(); }
std::size_t getBinaryLength() { return file.size(); } std::size_t getBinaryLength() { return file.size(); }
}; };
#endif

92
makerwysxp/CMakeLists.txt Normal file
View File

@ -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()

View File

@ -4,11 +4,11 @@ file(GLOB file CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/file/*.cpp)
add_library(germanairlinesva_xplugin SHARED add_library(germanairlinesva_xplugin SHARED
${socket} ${socket}
${file} ${file}
makeRwysXP.cpp
main.cpp main.cpp
) )
target_include_directories(germanairlinesva_xplugin PRIVATE target_include_directories(germanairlinesva_xplugin PRIVATE
${CMAKE_SOURCE_DIR}/makerwysxp/include
${CMAKE_SOURCE_DIR}/socket/include ${CMAKE_SOURCE_DIR}/socket/include
${CMAKE_SOURCE_DIR}/XPSDK/CHeaders ${CMAKE_SOURCE_DIR}/XPSDK/CHeaders
${CMAKE_SOURCE_DIR}/nlohmann ${CMAKE_SOURCE_DIR}/nlohmann
@ -133,3 +133,7 @@ elseif(WIN32)
xPluginWin.cpp xPluginWin.cpp
) )
endif() endif()
target_link_libraries(germanairlinesva_xplugin PRIVATE
makerwysxp
)

View File

@ -1,6 +1,8 @@
#include <cstdio> #include <cstdio>
#include <windows.h> #include <windows.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
BOOL APIENTRY DllMain(HANDLE hModule, BOOL APIENTRY DllMain(HANDLE hModule,
DWORD ul_reason_for_call, DWORD ul_reason_for_call,
LPVOID lpReserved) LPVOID lpReserved)
@ -15,3 +17,5 @@ BOOL APIENTRY DllMain(HANDLE hModule,
} }
return TRUE; return TRUE;
} }
#pragma clang diagnostic pop