reading is hard
This commit is contained in:
parent
5742d3604c
commit
a0704ef240
|
@ -14,30 +14,29 @@ find_package(Threads REQUIRED)
|
||||||
find_package(Boost REQUIRED)
|
find_package(Boost REQUIRED)
|
||||||
|
|
||||||
# default linker
|
# default linker
|
||||||
if(NOT SSXTOOLS_LINKER AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
if(NOT PROJECT_LINKER AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
set(SSXTOOLS_LINKER "lld")
|
set(PROJECT_LINKER "lld")
|
||||||
elseif(NOT SSXTOOLS_LINKER)
|
elseif(NOT PROJECT_LINKER)
|
||||||
set(SSXTOOLS_LINKER "bfd")
|
set(PROJECT_LINKER "bfd")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
ssxtools_set_alternate_linker()
|
project_set_alternate_linker()
|
||||||
|
|
||||||
add_executable(swsf_scramble
|
add_executable(swsf_bruteforce
|
||||||
src/asio_impl.cpp
|
src/asio_impl.cpp
|
||||||
src/main.cpp
|
src/main.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(swsf_scramble PRIVATE
|
target_compile_definitions(swsf_bruteforce PRIVATE
|
||||||
#-DBOOST_ASIO_HAS_IO_URING=1
|
# We compile Asio in a separate TU (src/asio_impl.cpp)
|
||||||
# We compile Asio in another TU
|
|
||||||
-DBOOST_ASIO_SEPARATE_COMPILATION=1
|
-DBOOST_ASIO_SEPARATE_COMPILATION=1
|
||||||
-DBOOST_ASIO_NO_DEPRECATED=1
|
-DBOOST_ASIO_NO_DEPRECATED=1
|
||||||
-DBOOST_ASIO_DISABLE_BOOST_ARRAY=1
|
-DBOOST_ASIO_DISABLE_BOOST_ARRAY=1
|
||||||
-DBOOST_ASIO_DISABLE_BOOST_BIND=1
|
-DBOOST_ASIO_DISABLE_BOOST_BIND=1
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_features(swsf_scramble PRIVATE cxx_std_20)
|
target_compile_features(swsf_bruteforce PRIVATE cxx_std_20)
|
||||||
target_include_directories(swsf_scramble PRIVATE ${PROJECT_SOURCE_DIR}/src)
|
target_include_directories(swsf_bruteforce PRIVATE ${PROJECT_SOURCE_DIR}/src)
|
||||||
|
|
||||||
ssxtools_target(swsf_scramble)
|
project_target(swsf_bruteforce)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function(ssxtools_target target)
|
function(project_target target)
|
||||||
target_compile_definitions(${target} PRIVATE "$<$<CONFIG:DEBUG>:SSXTOOLS_DEBUG>")
|
target_compile_definitions(${target} PRIVATE "$<$<CONFIG:DEBUG>:DEBUG>")
|
||||||
|
|
||||||
# public headers reside with a component (if they exist)
|
# public headers reside with a component (if they exist)
|
||||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||||
|
@ -22,11 +22,11 @@ function(ssxtools_target target)
|
||||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
set(_CORE_COMPILE_ARGS ${_CORE_COMPILE_ARGS} -flto=thin)
|
set(_CORE_COMPILE_ARGS ${_CORE_COMPILE_ARGS} -flto=thin)
|
||||||
set(_CORE_LINKER_ARGS ${_CORE_LINKER_ARGS} -flto=thin)
|
set(_CORE_LINKER_ARGS ${_CORE_LINKER_ARGS} -flto=thin)
|
||||||
target_link_options(${target} PRIVATE -fuse-ld=${SSXTOOLS_LINKER} -flto=thin)
|
target_link_options(${target} PRIVATE -fuse-ld=${PROJECT_LINKER} -flto=thin)
|
||||||
else("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
else("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||||
set(_CORE_COMPILE_ARGS ${_CORE_COMPILE_ARGS} -flto)
|
set(_CORE_COMPILE_ARGS ${_CORE_COMPILE_ARGS} -flto)
|
||||||
set(_CORE_LINKER_ARGS ${_CORE_LINKER_ARGS} -flto)
|
set(_CORE_LINKER_ARGS ${_CORE_LINKER_ARGS} -flto)
|
||||||
target_link_options(${target} PRIVATE -fuse-ld=${SSXTOOLS_LINKER} -flto)
|
target_link_options(${target} PRIVATE -fuse-ld=${PROJECT_LINKER} -flto)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
@ -60,16 +60,16 @@ function(ssxtools_target target)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(ssxtools_header_only_target target)
|
function(project_header_only_target target)
|
||||||
target_include_directories(${target} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
target_include_directories(${target} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||||
target_compile_features(${target} INTERFACE cxx_std_20)
|
target_compile_features(${target} INTERFACE cxx_std_20)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(ssxtools_set_alternate_linker)
|
function(project_set_alternate_linker)
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
find_program(LINKER_EXECUTABLE ld.${SSXTOOLS_LINKER} ${SSXTOOLS_LINKER})
|
find_program(LINKER_EXECUTABLE ld.${PROJECT_LINKER} ${PROJECT_LINKER})
|
||||||
if(LINKER_EXECUTABLE)
|
if(LINKER_EXECUTABLE)
|
||||||
message(STATUS "Using ${SSXTOOLS_LINKER} as linker for ssxtools projects")
|
message(STATUS "Using ${SSXTOOLS_LINKER} as linker")
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Linker ${SSXTOOLS_LINKER} does not exist on your system. Please specify one which does or omit this option from your configure command.")
|
message(FATAL_ERROR "Linker ${SSXTOOLS_LINKER} does not exist on your system. Please specify one which does or omit this option from your configure command.")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -81,7 +81,7 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string_view ResetLine() {
|
std::string_view ResetLine() {
|
||||||
return "\33[2J";
|
return "\33[2K";
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
Loading…
Reference in New Issue