Can now build the Windows UI via CMake as well

This commit is contained in:
Grant Limberg 2019-06-21 12:54:53 -07:00
parent c8487cc395
commit d3b33e5512
7 changed files with 161 additions and 9 deletions

View File

@ -1,6 +1,6 @@
# CMake build script for ZeroTier One
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 3.8)
project (zerotier-one)
option(BUILD_CENTRAL_CONTROLLER "Build ZeroTier Central Controller" OFF)
@ -35,6 +35,8 @@ add_subdirectory(osdep)
add_subdirectory(service)
if(WIN32)
add_subdirectory("windows/WinUI")
add_subdirectory("windows/copyutil")
add_definitions(-DNOMINMAX)
endif(WIN32)

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>

View File

@ -0,0 +1,128 @@
cmake_minimum_required(VERSION 3.8)
include(CSharpUtilities)
project("ZeroTierOneUI" VERSION 1.4.0 LANGUAGES CSharp)
add_executable(
${PROJECT_NAME}
app.manifest
App.config
App.xaml
App.xaml.cs
AboutView.xaml
AboutView.xaml.cs
APIHandler.cs
CentralAPI.cs
CentralLogin.cs
CentralNetwork.cs
CentralServer.cs
CentralToken.cs
CentralUser.cs
ISwitchable.cs
JoinNetworkView.xaml
JoinNetworkView.xaml.cs
NetworkInfoView.xaml
NetworkInfoView.xaml.cs
NetworkListView.xaml
NetworkListView.xaml.cs
NetworkMonitor.cs
NetworkNameGenerator.cs
NetworkRoute.cs
NetworksPage.xaml
NetworksPage.xaml.cs
PeersPage.xaml
PeersPage.xaml.cs
PreferencesView.xaml
PreferencesView.xaml.cs
"Simple Styles.xaml"
ToolbarItem.xaml
ToolbarItem.xaml.cs
ZeroTierNetwork.cs
ZeroTierPeer.cs
ZeroTierPeerPhysicalPath.cs
ZeroTierStatus.cs
packages.config
"Properties/AssemblyInfo.cs"
"Properties/Resources.Designer.cs"
"Properties/Resources.resx"
"Properties/Settings.Designer.cs"
"Properties/Settings.settings"
"Resources/ZeroTierIcon.ico"
ZeroTierIcon.ico
)
csharp_set_designer_cs_properties(
"Properties/AssemblyInfo.cs"
"Properties/Resources.Designer.cs"
"Properties/Resources.resx"
"Properties/Settings.Designer.cs"
"Properties/Settings.settings"
)
csharp_set_xaml_cs_properties(
App.xaml
App.xaml.cs
AboutView.xaml
AboutView.xaml.cs
JoinNetworkView.xaml
JoinNetworkView.xaml.cs
NetworkInfoView.xaml
NetworkInfoView.xaml.cs
NetworkListView.xaml
NetworkListView.xaml.cs
NetworksPage.xaml
NetworksPage.xaml.cs
PeersPage.xaml
PeersPage.xaml.cs
PreferencesView.xaml
PreferencesView.xaml.cs
ToolbarItem.xaml
ToolbarItem.xaml.cs
)
set_property(SOURCE App.xaml PROPERTY VS_XAML_TYPE "ApplicationDefinition")
set_property(SOURCE ZeroTierIcon.ico PROPERTY VS_TOOL_OVERRIDE "Resource")
set_target_properties(${PROJECT_NAME} PROPERTIES
VS_GLOBAL_ROOTNAMESPACE "WinUI"
VS_DOTNET_TARGET_FRAMEWORK_VERSION "v4.5.2"
WIN32_EXECUTABLE TRUE
)
set_property(TARGET ${PROJECT_NAME} PROPERTY VS_DOTNET_REFERENCES
"Microsoft.CSharp"
"PresentationCore"
"PresentationFramework"
"System"
"System.Core"
"System.Data"
"System.Data.DataSetExtensions"
"System.Drawing"
"System.Net.Http"
"System.Xaml"
"System.Xml"
"System.Xml.Linq"
"WindowsBase"
"Newtonsoft.Json"
)
set(CMAKE_CSharp_FLAGS "/langversion:6")
target_compile_options(${PROJECT_NAME} PRIVATE "/win32icon:${CMAKE_CURRENT_SOURCE_DIR}/ZeroTierIcon.ico")
set_property(TARGET ${PROJECT_NAME} PROPERTY VS_DOTNET_REFERENCE_Hardcodet.Wpf.TaskbarNotification "${CMAKE_CURRENT_BINARY_DIR}/packages/Hardcodet.NotifyIcon.Wpf.1.0.8/lib/net45/Hardcodet.Wpf.TaskbarNotification.dll")
find_program(NUGET nuget)
add_custom_target(nuget-restore
COMMAND ${NUGET} restore ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.sln
)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/packages.config
${CMAKE_CURRENT_BINARY_DIR}/packages.config COPYONLY)
add_dependencies(${PROJECT_NAME} nuget-restore)

View File

@ -58,7 +58,7 @@ namespace WinUI
private void loadNetworks()
{
String dataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\ZeroTier\\One";
String dataFile = Path.Combine(dataPath, "networks.dat");
String dataFile = Path.Combine(dataPath, "networksv2.dat");
if (File.Exists(dataFile))
{

View File

@ -12,7 +12,7 @@ using System.Windows;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ZeroTier, Inc")]
[assembly: AssemblyProduct("ZeroTier One")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyCopyright("Copyright © 2015-2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View File

@ -19,10 +19,10 @@ namespace WinUI.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
public class Resources {
private static global::System.Resources.ResourceManager resourceMan;
@ -36,7 +36,7 @@ namespace WinUI.Properties {
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WinUI.Properties.Resources", typeof(Resources).Assembly);
@ -51,7 +51,7 @@ namespace WinUI.Properties {
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
@ -63,7 +63,17 @@ namespace WinUI.Properties {
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon ZeroTierIcon {
public static System.Drawing.Icon Icon1 {
get {
object obj = ResourceManager.GetObject("Icon1", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
public static System.Drawing.Icon ZeroTierIcon {
get {
object obj = ResourceManager.GetObject("ZeroTierIcon", resourceCulture);
return ((System.Drawing.Icon)(obj));

View File

@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.8)
include(CSharpUtilities)
project(copyutil VERSION 1.4.0 LANGUAGES CSharp)
add_executable(
${PROJECT_NAME}
App.config
Program.cs
"Properties/AssemblyInfo.cs"
)