diff --git a/CMakeLists.txt b/CMakeLists.txt index 3eb8ed6..ed45650 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,6 @@ # CMake 3.18 due to https://gitlab.kitware.com/cmake/cmake/-/issues/20764 cmake_minimum_required(VERSION 3.18) -if(DEFINED DEPENDENCIES_DIR) - include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/mo2.cmake) -else() - include(${CMAKE_CURRENT_LIST_DIR}/../cmake_common/mo2.cmake) -endif() - # set globally as Nuget gets confused about ZERO_CHECK, ALL_BUILD and INSTALL otherwise set(CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION "v4.8") diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..e25727f --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,49 @@ +{ + "configurePresets": [ + { + "errors": { + "deprecated": true + }, + "hidden": true, + "name": "cmake-dev", + "warnings": { + "deprecated": true, + "dev": true + } + }, + { + "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "hidden": true, + "name": "vcpkg" + }, + { + "binaryDir": "${sourceDir}/vsbuild", + "architecture": { + "strategy": "set", + "value": "x64" + }, + "cacheVariables": { + "CMAKE_VS_NUGET_PACKAGE_RESTORE": { + "type": "BOOL", + "value": "ON" + }, + "INSTALL_REQUIRES_VS_PACKAGE_RESTORE": { + "type": "BOOL", + "value": "ON" + } + }, + "generator": "Visual Studio 17 2022", + "inherits": ["cmake-dev", "vcpkg"], + "name": "vs2022-windows", + "toolset": "v143" + } + ], + "buildPresets": [ + { + "name": "vs2022-windows", + "resolvePackageReferences": "on", + "configurePreset": "vs2022-windows" + } + ], + "version": 4 +} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9e0e586..f28851c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,8 +1,11 @@ -cmake_minimum_required(VERSION 3.16) +# 3.23 for CMAKE_VS_NUGET_PACKAGE_RESTORE +cmake_minimum_required(VERSION 3.23) + +find_package(mo2-cmake CONFIG REQUIRED) +find_package(mo2-uibase CONFIG REQUIRED) # Dummy .NET library as VS_PACKAGE_REFERENCES doesn't work on C++/CLI projects yet # Needs to be declared before cmake_common stuff is included as that polutes the environment and makes C# get compiled as C++ -# This only mostly works - you need to build via Visual Studio or run `msbuild -t:restore installer_omod.sln` at least once before this will build via the command line due to https://gitlab.kitware.com/cmake/cmake/-/issues/20646 add_library(dummy_cs_project SHARED DummyCSFile.cs) set_target_properties(dummy_cs_project PROPERTIES LINKER_LANGUAGE CSharp @@ -11,6 +14,7 @@ set_target_properties(dummy_cs_project PROPERTIES add_library(installer_omod SHARED) mo2_configure_plugin(installer_omod WARNINGS OFF CLI ON) +target_link_libraries(installer_omod PRIVATE mo2::uibase) # I'd like to use get_target_property(source_files ${PROJECT_NAME} SOURCES) as # globbing is naughty, but need to filter out the things that aren't relative to this directory. @@ -46,7 +50,7 @@ target_compile_definitions(installer_omod PRIVATE "NOGDI") # aren't pulled in. We do need it to build first, though. add_dependencies(installer_omod dummy_cs_project) -mo2_install_target(installer_omod FOLDER) +mo2_install_plugin(installer_omod FOLDER) install( FILES @@ -55,7 +59,7 @@ install( "$/ICSharpCode.SharpZipLib.dll" "$/System.Drawing.Common.dll" "$/RtfPipe.dll" - DESTINATION "${MO2_INSTALL_PATH}/bin/plugins/installer_omod/" + DESTINATION bin/plugins/installer_omod/ ) install( FILES "$/ICSharpCode.SharpZipLib.pdb" diff --git a/src/OMODFrameworkWrapper.cpp b/src/OMODFrameworkWrapper.cpp index 1c903d7..dea335d 100644 --- a/src/OMODFrameworkWrapper.cpp +++ b/src/OMODFrameworkWrapper.cpp @@ -10,17 +10,17 @@ using namespace cli; #include #include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include #include "implementations/CodeProgress.h" #include "implementations/Logger.h" diff --git a/src/OMODFrameworkWrapper.h b/src/OMODFrameworkWrapper.h index b806193..6906ad3 100644 --- a/src/OMODFrameworkWrapper.h +++ b/src/OMODFrameworkWrapper.h @@ -4,7 +4,7 @@ #include #include -#include +#include #include "implementations/CodeProgress.h" #include "QObject_unique_ptr.h" diff --git a/src/implementations/Logger.h b/src/implementations/Logger.h index 97a7e9f..e3d1e7e 100644 --- a/src/implementations/Logger.h +++ b/src/implementations/Logger.h @@ -2,7 +2,7 @@ using namespace cli; -#include +#include ref class Logger : OMODFramework::ILogger { diff --git a/src/implementations/ScriptFunctions.cpp b/src/implementations/ScriptFunctions.cpp index d03d549..7343bbf 100644 --- a/src/implementations/ScriptFunctions.cpp +++ b/src/implementations/ScriptFunctions.cpp @@ -9,9 +9,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include "../interop/QtDotNetConverters.h" #include "../newstuff/rtfPopup.h" diff --git a/src/implementations/ScriptFunctions.h b/src/implementations/ScriptFunctions.h index 5a40d65..28f9dee 100644 --- a/src/implementations/ScriptFunctions.h +++ b/src/implementations/ScriptFunctions.h @@ -6,7 +6,7 @@ using namespace cli; #include -#include +#include #include "../MessageBoxHelper.h" #include "../QObject_unique_ptr.h" diff --git a/src/installerOmod.cpp b/src/installerOmod.cpp index 34c83ef..3e4c390 100644 --- a/src/installerOmod.cpp +++ b/src/installerOmod.cpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include "OMODFrameworkWrapper.h" diff --git a/src/installerOmod.h b/src/installerOmod.h index 467eaf4..a122355 100644 --- a/src/installerOmod.h +++ b/src/installerOmod.h @@ -3,8 +3,8 @@ #include -#include -#include +#include +#include #include "OMODFrameworkWrapper.h" diff --git a/src/newstuff/namedialog.h b/src/newstuff/namedialog.h index 87a5fe7..72e62eb 100644 --- a/src/newstuff/namedialog.h +++ b/src/newstuff/namedialog.h @@ -2,7 +2,7 @@ #include -#include +#include #include "ui_namedialog.h" diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 0000000..4c355c2 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,10 @@ +{ + "dependencies": ["mo2-cmake"], + "vcpkg-configuration": { + "default-registry": { + "kind": "git", + "repository": "https://github.com/ModOrganizer2/vcpkg-registry", + "baseline": "c55e3ab33eb170aefb1904ded8809cb88df6bb48" + } + } +}