From 6d49ffd60b606ac32af9257ab1158903c3500d0e Mon Sep 17 00:00:00 2001 From: Rick V Date: Tue, 3 Dec 2019 21:40:16 -0600 Subject: [PATCH] include all platform dependencies transitively --- cmake/win32.cmake | 4 ++-- daemon/CMakeLists.txt | 6 ------ llarp/CMakeLists.txt | 7 ++----- test/CMakeLists.txt | 2 +- ui-win32/dlgBootstrap.cs | 13 ++++++++----- 5 files changed, 13 insertions(+), 19 deletions(-) diff --git a/cmake/win32.cmake b/cmake/win32.cmake index 215ec2a3d..5e732fe59 100644 --- a/cmake/win32.cmake +++ b/cmake/win32.cmake @@ -20,7 +20,7 @@ if(NOT MSVC_VERSION) # GNU ld sees fit to merge *all* the .ident sections in object files # to .r[o]data section one after the other! add_compile_options(-fno-ident -Wa,-mbig-obj) - link_libraries( -lws2_32 -liphlpapi -lshlwapi -ldbghelp ) + link_libraries( -lshlwapi -ldbghelp ) add_definitions(-DWINVER=0x0500 -D_WIN32_WINNT=0x0500) endif() @@ -31,7 +31,7 @@ endif() list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-windows.c) get_filename_component(EV_SRC "llarp/ev/ev_libuv.cpp" ABSOLUTE) add_definitions(-DWIN32_LEAN_AND_MEAN -DWIN32 -DWINVER=0x0500) -set(EXE_LIBS ${STATIC_LIB} ws2_32 iphlpapi) +set(EXE_LIBS ${STATIC_LIB} ${FS_LIB}) if(RELEASE_MOTTO) add_definitions(-DLLARP_RELEASE_MOTTO="${RELEASE_MOTTO}") diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt index 6b68f8cba..2025a7411 100644 --- a/daemon/CMakeLists.txt +++ b/daemon/CMakeLists.txt @@ -54,19 +54,13 @@ else() endif(CURL_FOUND) if(WIN32) target_include_directories(${CTL} PRIVATE ../win32-setup/include) - target_include_directories(${EXE} PRIVATE ../win32-setup/include) target_compile_definitions(${CTL} PRIVATE -DWITH_CURL=1 -DCURL_STATICLIB) - target_compile_definitions(${EXE} PRIVATE -DWITH_CURL=1 -DCURL_STATICLIB) if (CMAKE_SIZEOF_VOID_P EQUAL 8) target_link_directories(${CTL} PRIVATE ../win32-setup/lib64) target_link_directories(${EXE} PRIVATE ../win32-setup/lib64) - target_link_libraries(${CTL} PRIVATE curl crypt32) - target_link_libraries(${EXE} PRIVATE curl crypt32) else() target_link_directories(${CTL} PRIVATE ../win32-setup/lib) target_link_directories(${EXE} PRIVATE ../win32-setup/lib) - target_link_libraries(${CTL} PRIVATE curl mbedtls mbedx509 mbedcrypto ws2_32) - target_link_libraries(${EXE} PRIVATE curl mbedtls mbedx509 mbedcrypto ws2_32) endif() endif(WIN32) diff --git a/llarp/CMakeLists.txt b/llarp/CMakeLists.txt index 106a01747..199d5c788 100644 --- a/llarp/CMakeLists.txt +++ b/llarp/CMakeLists.txt @@ -68,9 +68,9 @@ if (WIN32) target_include_directories(${UTIL_LIB} PUBLIC ../win32-setup/include) target_compile_definitions(${UTIL_LIB} PUBLIC -DCURL_STATICLIB) if(CMAKE_SIZEOF_VOID_P EQUAL 8) - target_link_libraries(${UTIL_LIB} PUBLIC ${CRYPTOGRAPHY_LIB} ${FS_LIB} ${LOG_LIB} curl crypt32 ws2_32) + target_link_libraries(${UTIL_LIB} PUBLIC ${CRYPTOGRAPHY_LIB} ${FS_LIB} ${LOG_LIB} curl crypt32 ws2_32 iphlpapi) else() - target_link_libraries(${UTIL_LIB} PUBLIC ${CRYPTOGRAPHY_LIB} ${FS_LIB} ${LOG_LIB} curl mbedtls mbedx509 mbedcrypto ws2_32) + target_link_libraries(${UTIL_LIB} PUBLIC ${CRYPTOGRAPHY_LIB} ${FS_LIB} ${LOG_LIB} curl mbedtls mbedx509 mbedcrypto ws2_32 iphlpapi) endif() endif() if(ANDROID) @@ -263,9 +263,6 @@ if(TESTNET) endif() add_library(${STATIC_LIB} STATIC ${LIB_SRC}) -if (WIN32) - target_include_directories(${STATIC_LIB} PUBLIC ../win32-setup/include) -endif() target_include_directories(${STATIC_LIB} PUBLIC ${CURL_INCLUDE_DIRS}) target_link_libraries(${STATIC_LIB} PUBLIC cxxopts ${ABYSS_LIB} ${PLATFORM_LIB} ${UTIL_LIB} ${CRYPTOGRAPHY_LIB} ${CURL_LIBRARIES}) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 17f8cd068..3aea0d14e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -58,7 +58,7 @@ add_executable(${TEST_EXE} ${TEST_SRC} ) -target_link_libraries(${TEST_EXE} PUBLIC gmock gtest curl ${STATIC_LIB}) +target_link_libraries(${TEST_EXE} PUBLIC gmock gtest ${STATIC_LIB}) target_include_directories(${TEST_EXE} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) if(NOT WIN32) diff --git a/ui-win32/dlgBootstrap.cs b/ui-win32/dlgBootstrap.cs index 474d8c649..c2d784405 100644 --- a/ui-win32/dlgBootstrap.cs +++ b/ui-win32/dlgBootstrap.cs @@ -14,16 +14,19 @@ namespace network.loki.lokinet.win32.ui { InitializeComponent(); if (Program.platform == PlatformID.Win32NT) - default_path = Environment.ExpandEnvironmentVariables("%APPDATA%\\.lokinet\\bootstrap.signed"); + default_path = Environment.ExpandEnvironmentVariables("%APPDATA%\\.lokinet"); else - default_path = Environment.ExpandEnvironmentVariables("%HOME%/.lokinet/bootstrap.signed"); - label2.Text = String.Format("This file is automatically saved as {0}.", default_path); + default_path = Environment.ExpandEnvironmentVariables("%HOME%/.lokinet"); + label2.Text = String.Format("This file is automatically saved as {0}{1}{2}.", default_path, Path.DirectorySeparatorChar, rcName); } private WebClient wc; private string default_path; + private const string rcName = "bootstrap.signed"; + private void button1_Click(object sender, EventArgs e) { + Directory.CreateDirectory(default_path); // add something more unique, this is the IE 5.0 default string try { @@ -31,7 +34,7 @@ namespace network.loki.lokinet.win32.ui ServicePointManager.SecurityProtocol = (SecurityProtocolType)48 | 0 | (SecurityProtocolType)192 | (SecurityProtocolType)768 | (SecurityProtocolType)3072; wc = new WebClient(); wc.Headers.Add("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT 5.0)"); - wc.DownloadFile(uriBox.Text, default_path); + wc.DownloadFile(uriBox.Text, string.Format("{0}{1}{2}", default_path, Path.DirectorySeparatorChar, rcName)); MessageBox.Show("LokiNET node bootstrapped", "LokiNET", MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult = DialogResult.OK; } @@ -49,7 +52,7 @@ namespace network.loki.lokinet.win32.ui lokinet_bootstrap.StartInfo.CreateNoWindow = true; lokinet_bootstrap.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory(); lokinet_bootstrap.StartInfo.FileName = lokinetExeString; - lokinet_bootstrap.StartInfo.Arguments = string.Format("--cacert rootcerts.pem -L {0} --output \"{1}\"", uriBox.Text, default_path); + lokinet_bootstrap.StartInfo.Arguments = string.Format("--cacert rootcerts.pem -L {0} --output \"{1}{2}{3}\"", uriBox.Text, default_path, Path.DirectorySeparatorChar, rcName); lokinet_bootstrap.Start(); lokinet_bootstrap.WaitForExit(); if (lokinet_bootstrap.ExitCode == 0)