reading is hard

This commit is contained in:
Lily Tsuru 2023-08-22 03:44:45 -04:00
parent 5742d3604c
commit a0704ef240
3 changed files with 20 additions and 21 deletions

View File

@ -14,30 +14,29 @@ find_package(Threads REQUIRED)
find_package(Boost REQUIRED)
# default linker
if(NOT SSXTOOLS_LINKER AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(SSXTOOLS_LINKER "lld")
elseif(NOT SSXTOOLS_LINKER)
set(SSXTOOLS_LINKER "bfd")
if(NOT PROJECT_LINKER AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(PROJECT_LINKER "lld")
elseif(NOT PROJECT_LINKER)
set(PROJECT_LINKER "bfd")
endif()
include(FetchContent)
ssxtools_set_alternate_linker()
project_set_alternate_linker()
add_executable(swsf_scramble
add_executable(swsf_bruteforce
src/asio_impl.cpp
src/main.cpp
)
target_compile_definitions(swsf_scramble PRIVATE
#-DBOOST_ASIO_HAS_IO_URING=1
# We compile Asio in another TU
target_compile_definitions(swsf_bruteforce PRIVATE
# We compile Asio in a separate TU (src/asio_impl.cpp)
-DBOOST_ASIO_SEPARATE_COMPILATION=1
-DBOOST_ASIO_NO_DEPRECATED=1
-DBOOST_ASIO_DISABLE_BOOST_ARRAY=1
-DBOOST_ASIO_DISABLE_BOOST_BIND=1
)
target_compile_features(swsf_scramble PRIVATE cxx_std_20)
target_include_directories(swsf_scramble PRIVATE ${PROJECT_SOURCE_DIR}/src)
target_compile_features(swsf_bruteforce PRIVATE cxx_std_20)
target_include_directories(swsf_bruteforce PRIVATE ${PROJECT_SOURCE_DIR}/src)
ssxtools_target(swsf_scramble)
project_target(swsf_bruteforce)

View File

@ -1,5 +1,5 @@
function(ssxtools_target target)
target_compile_definitions(${target} PRIVATE "$<$<CONFIG:DEBUG>:SSXTOOLS_DEBUG>")
function(project_target target)
target_compile_definitions(${target} PRIVATE "$<$<CONFIG:DEBUG>:DEBUG>")
# public headers reside with a component (if they exist)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/include)
@ -22,11 +22,11 @@ function(ssxtools_target target)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(_CORE_COMPILE_ARGS ${_CORE_COMPILE_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")
set(_CORE_COMPILE_ARGS ${_CORE_COMPILE_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()
@ -60,16 +60,16 @@ function(ssxtools_target target)
endif()
endfunction()
function(ssxtools_header_only_target target)
function(project_header_only_target target)
target_include_directories(${target} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_compile_features(${target} INTERFACE cxx_std_20)
endfunction()
function(ssxtools_set_alternate_linker)
function(project_set_alternate_linker)
if(NOT WIN32)
find_program(LINKER_EXECUTABLE ld.${SSXTOOLS_LINKER} ${SSXTOOLS_LINKER})
find_program(LINKER_EXECUTABLE ld.${PROJECT_LINKER} ${PROJECT_LINKER})
if(LINKER_EXECUTABLE)
message(STATUS "Using ${SSXTOOLS_LINKER} as linker for ssxtools projects")
message(STATUS "Using ${SSXTOOLS_LINKER} as linker")
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.")
endif()

View File

@ -81,7 +81,7 @@ namespace {
}
std::string_view ResetLine() {
return "\33[2J";
return "\33[2K";
}
} // namespace