mirror of https://github.com/oxen-io/lokinet
rework cmake install targets
* redo setcap on linux so that it's required to do install targets on linux * add -DWITH_SETCAP=OFF option to bypass setcap requirement on linux * remove lokinet-bootstrap.ps1 as we bundle the bootstrap in the win32 installer now * remove references to lokinet-bootstrap.ps1 in cmakepull/1566/head
parent
32ed709839
commit
4540c964f5
@ -1,46 +1,51 @@
|
||||
add_executable(lokinet main.cpp)
|
||||
add_executable(lokinet-vpn lokinet-vpn.cpp)
|
||||
enable_lto(lokinet lokinet-vpn)
|
||||
|
||||
if(SHADOW)
|
||||
add_shadow_plugin(shadow-plugin main.cpp ${TRACY_ROOT}/TracyClient.cpp)
|
||||
target_link_libraries(shadow-plugin liblokinet)
|
||||
enable_lto(shadow-plugin)
|
||||
else()
|
||||
add_executable(lokinet main.cpp)
|
||||
add_executable(lokinet-vpn lokinet-vpn.cpp)
|
||||
enable_lto(lokinet lokinet-vpn)
|
||||
|
||||
if(TRACY_ROOT)
|
||||
target_sources(lokinet PRIVATE ${TRACY_ROOT}/TracyClient.cpp)
|
||||
endif()
|
||||
if(TRACY_ROOT)
|
||||
target_sources(lokinet PRIVATE ${TRACY_ROOT}/TracyClient.cpp)
|
||||
endif()
|
||||
|
||||
foreach(exe lokinet lokinet-vpn)
|
||||
if(WIN32 AND NOT MSVC_VERSION)
|
||||
target_sources(${exe} PRIVATE ../llarp/win32/version.rc)
|
||||
target_link_libraries(${exe} PRIVATE ws2_32 iphlpapi)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
target_link_directories(${exe} PRIVATE /usr/local/lib)
|
||||
endif()
|
||||
target_link_libraries(${exe} PRIVATE liblokinet)
|
||||
if(WITH_JEMALLOC)
|
||||
target_link_libraries(${exe} PUBLIC jemalloc)
|
||||
endif()
|
||||
target_compile_definitions(${exe} PRIVATE -DVERSIONTAG=${GIT_VERSION_REAL})
|
||||
add_log_tag(${exe})
|
||||
install(TARGETS ${exe} RUNTIME DESTINATION bin COMPONENT lokinet)
|
||||
endforeach()
|
||||
set(should_install ON)
|
||||
set(SETCAP)
|
||||
|
||||
if(WIN32)
|
||||
install(PROGRAMS ${CMAKE_SOURCE_DIR}/lokinet-bootstrap.ps1 DESTINATION bin COMPONENT lokinet)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
option(WITH_SETCAP "use setcap when installing" ON)
|
||||
if(WITH_SETCAP)
|
||||
find_program(SETCAP NAMES setcap HINTS /sbin /usr/sbin)
|
||||
if(SETCAP)
|
||||
message(STATUS "Found setcap binary: ${SETCAP}")
|
||||
else()
|
||||
install(PROGRAMS ${CMAKE_SOURCE_DIR}/lokinet-bootstrap DESTINATION bin COMPONENT lokinet)
|
||||
message(WARNING "cannot find setcap binary you will not be able use the install targets unless you use -DWITH_SETCAP=OFF")
|
||||
set(should_install OFF)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
option(WITH_SETCAP "Enables setcap'ing the lokinet binary with the required capabilities during installation (requires root)" ON)
|
||||
if(WITH_SETCAP)
|
||||
find_program(setcap_bin NAMES setcap HINTS /sbin /usr/sbin REQUIRED)
|
||||
message(STATUS "found setcap: ${setcap_bin}")
|
||||
install(CODE "execute_process(COMMAND ${setcap_bin} cap_net_admin,cap_net_bind_service=+eip ${CMAKE_INSTALL_PREFIX}/bin/lokinet)")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
foreach(exe lokinet lokinet-vpn)
|
||||
if(WIN32 AND NOT MSVC_VERSION)
|
||||
target_sources(${exe} PRIVATE ../llarp/win32/version.rc)
|
||||
target_link_libraries(${exe} PRIVATE ws2_32 iphlpapi)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
target_link_directories(${exe} PRIVATE /usr/local/lib)
|
||||
endif()
|
||||
target_link_libraries(${exe} PRIVATE liblokinet)
|
||||
if(WITH_JEMALLOC)
|
||||
target_link_libraries(${exe} PUBLIC jemalloc)
|
||||
endif()
|
||||
target_compile_definitions(${exe} PRIVATE -DVERSIONTAG=${GIT_VERSION_REAL})
|
||||
add_log_tag(${exe})
|
||||
if(should_install)
|
||||
install(TARGETS ${exe} RUNTIME DESTINATION bin COMPONENT lokinet)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(SETCAP)
|
||||
install(CODE "execute_process(COMMAND ${SETCAP} cap_net_admin,cap_net_bind_service=+eip ${CMAKE_INSTALL_PREFIX}/bin/lokinet)")
|
||||
endif()
|
||||
|
||||
if(NOT WIN32)
|
||||
if(should_install)
|
||||
install(PROGRAMS ${CMAKE_SOURCE_DIR}/lokinet-bootstrap DESTINATION bin COMPONENT lokinet)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -1,10 +0,0 @@
|
||||
[CmdletBinding()]
|
||||
param ()
|
||||
$web = New-Object System.Net.WebClient
|
||||
if( -not ( Test-Path $env:APPDATA\.lokinet -PathType Container ) )
|
||||
{
|
||||
lokinet.exe -g
|
||||
}
|
||||
|
||||
|
||||
$web.DownloadFile("https://seed.lokinet.org/lokinet.signed", "$env:APPDATA\.lokinet\bootstrap.signed")
|
Loading…
Reference in New Issue