Update libmagic cmake things

This commit is contained in:
simon987 2022-04-15 15:35:20 -04:00
parent 779303a2f7
commit 036ed9ea1e
2 changed files with 33 additions and 4 deletions

View File

@ -4,6 +4,7 @@ set(CMAKE_C_STANDARD 11)
project(sist2 C) project(sist2 C)
option(SIST_DEBUG "Build a debug executable" on) option(SIST_DEBUG "Build a debug executable" on)
option(SIST_FAST "Enable more optimisation flags" off)
option(SIST_FAKE_STORE "Disable IO operations of LMDB stores for debugging purposes" 0) option(SIST_FAKE_STORE "Disable IO operations of LMDB stores for debugging purposes" 0)
add_compile_definitions( add_compile_definitions(
@ -54,6 +55,10 @@ find_package(lmdb CONFIG REQUIRED)
find_package(cJSON CONFIG REQUIRED) find_package(cJSON CONFIG REQUIRED)
find_package(unofficial-mongoose CONFIG REQUIRED) find_package(unofficial-mongoose CONFIG REQUIRED)
find_package(CURL CONFIG REQUIRED) find_package(CURL CONFIG REQUIRED)
find_library(MAGIC_LIB
NAMES libmagic.so.1 magic
PATHS /usr/lib/x86_64-linux-gnu/ /usr/lib/aarch64-linux-gnu/
)
target_include_directories( target_include_directories(
@ -93,16 +98,25 @@ if (SIST_DEBUG)
PROPERTIES PROPERTIES
OUTPUT_NAME sist2_debug OUTPUT_NAME sist2_debug
) )
elseif (SIST_FAST)
target_compile_options(
sist2
PRIVATE
-Ofast
-march=native
-fno-stack-protector
-fomit-frame-pointer
-freciprocal-math
)
else () else ()
target_compile_options( target_compile_options(
sist2 sist2
PRIVATE PRIVATE
-Ofast -Ofast
#-march=native
-fno-stack-protector -fno-stack-protector
-fomit-frame-pointer -fomit-frame-pointer
#-freciprocal-math
) )
endif () endif ()
@ -124,13 +138,12 @@ target_link_libraries(
CURL::libcurl CURL::libcurl
pthread pthread
#magic
c c
scan scan
/usr/lib/x86_64-linux-gnu/libmagic.so.1 ${MAGIC_LIB}
) )
add_custom_target( add_custom_target(

View File

@ -42,6 +42,22 @@ if (SIST_DEBUG)
-fsanitize=address -fsanitize=address
-fno-inline -fno-inline
) )
elseif (SIST_FAST)
add_compile_definitions(
antiword
NDEBUG
)
target_compile_options(
scan
PRIVATE
-Ofast
-march=native
-fno-stack-protector
-fomit-frame-pointer
-freciprocal-math
)
else() else()
add_compile_definitions( add_compile_definitions(
antiword antiword