Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
43 changes: 24 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ name: Build DLL

on:
pull_request:
branches: [main]
branches: [main,master]
release:
types: [published]
workflow_dispatch:

jobs:
build:
Expand All @@ -17,20 +18,10 @@ jobs:
- name: Setup MSBuild Path
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce

- name: Bootstrap vcpkg
run: |
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
git checkout bdd229e13c66fa11acdc0bc8fed8e7474cd24aa5
.\bootstrap-vcpkg.bat

- name: Install libcurl
run: |
.\vcpkg\vcpkg.exe install curl[core,ssl] --triplet x86-windows-static

- name: Integrate vcpkg with MSBuild
run: |
.\vcpkg\vcpkg.exe integrate install
- name: Setup conan
run: |
pip install conan
conan profile detect

- name: Update Plugin Version
if: github.ref_type == 'tag'
Expand All @@ -39,18 +30,32 @@ jobs:
(Get-Content -Path "vSMR\SMRPlugin.hpp") -replace '#define MY_PLUGIN_VERSION.*', "#define MY_PLUGIN_VERSION `"$tag`"" | Set-Content -Path "vSMR\SMRPlugin.hpp"
shell: pwsh

- name: Build DLL
run: msbuild vSMR.sln /p:Configuration=Release /p:Platform='Win32' /p:VcpkgTriplet=x86-windows-static /m
- name: Cache Conan (v2)
uses: actions/cache@v4
with:
path: |
~/.conan2
key: conan2-${{ runner.os }}-x86-Release-${{ hashFiles('conanfile.py') }}
restore-keys: |
conan2-${{ runner.os }}-x86-Release-

- name: Install dependancies
run: conan install . -s arch=x86 -s compiler.cppstd=17 -s compiler.runtime=static -s build_type=Release --build=missing --output-folder=build

- name: Build with cmake
run: |
cmake --preset conan-default
cmake --build --preset conan-release

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: vSMR.dll
path: Release/vSMR.dll
path: build/bin/Release/vSMR.dll

- name: Upload to Release
uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8
if: github.ref_type == 'tag'
with:
files: |
Release/vSMR.dll
build/bin/Release/vSMR.dll
16 changes: 6 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,10 @@ FakesAssemblies/
# Visual Studio 6 workspace options file
*.opt

#Custom
# CMake
CMakeFiles/
CMake/
CMakeUserPresets.json

curl-7.41.0/
ipch/
package/
/vSMR/version.txt
/vSMR/SectorFileProviderDescriptor.txt
/vSMR/ipaddr.txt
/vSMR/euroscope_sector_providers.txt
vSMR/vSMR.vcxproj
/lib/include/boost_1_85_0/
# Visual Studio Code
.vscode
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

128 changes: 128 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
cmake_minimum_required(VERSION 3.25)
project(vSMR LANGUAGES CXX RC)

# Ensure MSVC static runtime for a single shipping DLL (no VCRUNTIME deps)
if(MSVC)
# Use CMake 3.15+ feature
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
# Enable MFC; 2 = use MFC in a Static Library
set(CMAKE_MFC_FLAG 2)
endif()

# Conan integrations
include(${CMAKE_BINARY_DIR}/conan_deps.cmake OPTIONAL)

# Output dirs
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)

# Collect sources
file(GLOB VSMR_SOURCES
"vSMR/*.cpp"
)
set(VSMR_HEADERS
vSMR/SMRPlugin.hpp
vSMR/SMRRadar.hpp
vSMR/InsetWindow.h
vSMR/CallsignLookup.hpp
vSMR/CPDLCSettingsDialog.hpp
vSMR/DataLinkDialog.hpp
vSMR/HttpHelper.hpp
vSMR/Config.hpp
vSMR/Rimcas.hpp
vSMR/ColorManager.h
vSMR/Logger.h
vSMR/Constant.hpp
vSMR/stdafx.h
vSMR/targetver.h
vSMR/vSMR.hpp
)

set(VSMR_RESOURCES
vSMR/vSMR.rc
)

add_library(vSMR SHARED ${VSMR_SOURCES} ${VSMR_HEADERS} ${VSMR_RESOURCES})
set_target_properties(vSMR PROPERTIES OUTPUT_NAME "vSMR")

# Precompiled headers
# stdafx.h/cpp are existing PCH; configure MSVC PCH handling
if(MSVC)
target_precompile_headers(vSMR PRIVATE vSMR/stdafx.h)
endif()

# Definitions needed by MFC
if(MSVC)
target_compile_definitions(vSMR PRIVATE
VC_EXTRALEAN
_MBCS
_CRT_SECURE_NO_WARNINGS
ASIO_STANDALONE
CURL_STATICLIB
)
endif()

# Include EuroScope SDK headers bundled in repo
target_include_directories(vSMR PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/lib/include
${CMAKE_CURRENT_SOURCE_DIR}/vSMR
)

# Link EuroScope SDK import library (32-bit). Provided under lib/EuroScopePlugInDll.lib
# Also link required Windows libs
find_package(CURL REQUIRED)
find_package(asio REQUIRED CONFIG)
find_package(RapidJSON REQUIRED CONFIG)

target_link_libraries(vSMR
PRIVATE
CURL::libcurl
rapidjson
asio::asio
)

# Windows and MFC libraries
if(MSVC)
target_link_libraries(vSMR PRIVATE
version
winmm
Gdiplus
comdlg32
gdi32
user32
advapi32
shell32
ole32
oleaut32
uuid
Ws2_32
Crypt32
)
# Link the EuroScope import lib from repo
target_link_libraries(vSMR PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/lib/EuroScopePlugInDll.lib
)
# Ensure /DELAYLOAD:version if needed; usually not required.
endif()

# Ensure we compile as 32-bit when requested
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
message(WARNING "Building 64-bit; EuroScope is 32-bit. Configure with -A Win32 or Conan -s arch=x86.")
endif()

# Resource include directories
set_source_files_properties(${VSMR_RESOURCES} PROPERTIES LANGUAGE RC)
if(MSVC)
# Add paths used by .rc for local resource includes
target_compile_options(vSMR PRIVATE
$<$<COMPILE_LANGUAGE:RC>:/I${CMAKE_CURRENT_SOURCE_DIR}/vSMR>
$<$<COMPILE_LANGUAGE:RC>:/I${CMAKE_CURRENT_SOURCE_DIR}>
)
endif()

if(MSVC)
target_compile_options(vSMR PRIVATE /W3)
# Ensure _AFXDLL is not defined
target_compile_options(vSMR PRIVATE $<$<COMPILE_LANGUAGE:CXX>:/U_AFXDLL>)
endif()
58 changes: 58 additions & 0 deletions Conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps
from conan.tools.files import copy
import os


class VsmrRecipe(ConanFile):
name = "vSMR"
settings = "os", "compiler", "build_type", "arch"
exports_sources = (
"CMakeLists.txt",
"vSMR/*",
"lib/*",
"*.cur",
"*.wav",
"README.md",
)

requires = (
"asio/1.28.2",
"libcurl/8.9.1",
"rapidjson/1.1.0",
)
default_options = {
"libcurl/*:shared": False,
"libcurl/*:with_ssl": "schannel",
"libcurl/*:with_zlib": False,
"libcurl/*:with_brotli": False,
"libcurl/*:with_ldap": False,
"libcurl/*:with_libidn": False,
}

def generate(self):
deps = CMakeDeps(self)
deps.generate()

tc = CMakeToolchain(self)
tc.cache_variables["CMAKE_MFC_FLAG"] = "2"
if str(self.settings.get_safe("arch")) == "x86":
tc.variables["CMAKE_GENERATOR_PLATFORM"] = "Win32"
tc.variables["CMAKE_BUILD_TYPE"] = str(self.settings.get_safe("build_type") or "Release")
tc.generate()

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
for src in [self.build_folder, os.path.join(self.build_folder, "bin")]:
if os.path.isdir(src):
copy(self, pattern="*.dll", src=src, dst=os.path.join(self.package_folder, "bin"), keep_path=False)
copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))

def package_info(self):
self.cpp_info.bindirs = ["bin"]
self.cpp_info.libdirs = []
self.cpp_info.includedirs = []
61 changes: 0 additions & 61 deletions appveyor.yml

This file was deleted.

3 changes: 3 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
conan install . -s arch=x86 -s compiler.cppstd=17 -s compiler.runtime=static -s build_type=Release --build=missing --output-folder=build
cmake --preset conan-default
cmake --build --preset conan-release
Loading
Loading