2019-07-26 09:02:47 +00:00
|
|
|
cmake_minimum_required (VERSION 3.0)
|
2019-07-30 13:27:10 +00:00
|
|
|
project (Lagom)
|
2019-07-25 09:56:08 +00:00
|
|
|
|
2019-08-03 18:56:08 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall -Wextra -Werror -std=c++17 -fPIC -g")
|
2019-07-26 09:02:47 +00:00
|
|
|
|
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wconsumed")
|
2020-04-05 10:21:03 +00:00
|
|
|
|
|
|
|
option(ENABLE_ADDRESS_SANITIZER "Enable address sanitizer testing in gcc/clang" FALSE)
|
|
|
|
if (ENABLE_ADDRESS_SANITIZER)
|
|
|
|
add_definitions(-fsanitize=address -fno-omit-frame-pointer)
|
|
|
|
set(LINKER_FLAGS "${LINKER_FLAGS} -fsanitize=address")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
option(ENABLE_MEMORY_SANITIZER "Enable memory sanitizer testing in gcc/clang" FALSE)
|
|
|
|
if (ENABLE_MEMORY_SANITIZER)
|
|
|
|
add_definitions(-fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer)
|
|
|
|
set(LINKER_FLAGS "${LINKER_FLAGS} -fsanitize=memory -fsanitize-memory-track-origins")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
option(ENABLE_UNDEFINED_SANITIZER "Enable undefined behavior sanitizer testing in gcc/clang" FALSE)
|
|
|
|
if (ENABLE_UNDEFINED_SANITIZER)
|
|
|
|
add_definitions(-fsanitize=undefined -fno-omit-frame-pointer)
|
|
|
|
set(LINKER_FLAGS "${LINKER_FLAGS} -fsanitize=undefined")
|
|
|
|
endif()
|
|
|
|
|
2020-04-08 08:40:02 +00:00
|
|
|
option(ENABLE_FUZZER_SANITIZER "Enable fuzzer sanitizer testing in clang" FALSE)
|
|
|
|
if (ENABLE_FUZZER_SANITIZER)
|
|
|
|
add_definitions(-fsanitize=fuzzer -fno-omit-frame-pointer)
|
|
|
|
set(LINKER_FLAGS "${LINKER_FLAGS} -fsanitize=fuzzer-no-link")
|
|
|
|
endif()
|
|
|
|
|
2020-04-05 10:21:03 +00:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINKER_FLAGS}")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINKER_FLAGS}")
|
|
|
|
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}")
|
|
|
|
|
2019-07-26 09:02:47 +00:00
|
|
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-expansion-to-defined")
|
|
|
|
endif()
|
2019-07-25 09:56:08 +00:00
|
|
|
|
2019-11-19 10:14:26 +00:00
|
|
|
file(GLOB AK_SOURCES "../../AK/*.cpp")
|
|
|
|
file(GLOB LIBCORE_SOURCES "../../Libraries/LibCore/*.cpp")
|
|
|
|
file(GLOB LIBIPC_SOURCES "../../Libraries/LibIPC/*.cpp")
|
2020-03-31 16:58:59 +00:00
|
|
|
file(GLOB LIBLINE_SOURCES "../../Libraries/LibLine/*.cpp")
|
2020-04-11 11:16:17 +00:00
|
|
|
file(GLOB LIBX86_SOURCES "../../Libraries/LibX86/*.cpp")
|
2020-03-23 12:15:32 +00:00
|
|
|
file(GLOB LIBJS_SOURCES "../../Libraries/LibJS/*.cpp")
|
|
|
|
file(GLOB LIBJS_SUBDIR_SOURCES "../../Libraries/LibJS/*/*.cpp")
|
2020-05-27 10:28:39 +00:00
|
|
|
file(GLOB LIBCRYPTO_SOURCES "../../Libraries/LibCrypto/*.cpp")
|
|
|
|
file(GLOB LIBCRYPTO_SUBDIR_SOURCES "../../Libraries/LibCrypto/*/*.cpp")
|
|
|
|
file(GLOB LIBTLS_SOURCES "../../Libraries/LibTLS/*.cpp")
|
2019-07-25 09:56:08 +00:00
|
|
|
|
2020-05-06 15:40:06 +00:00
|
|
|
set(LAGOM_CORE_SOURCES ${AK_SOURCES} ${LIBCORE_SOURCES})
|
2020-05-27 10:28:39 +00:00
|
|
|
set(LAGOM_MORE_SOURCES ${LIBIPC_SOURCES} ${LIBLINE_SOURCES} ${LIBJS_SOURCES} ${LIBJS_SUBDIR_SOURCES} ${LIBX86_SOURCES} ${LIBCRYPTO_SOURCES} ${LIBCRYPTO_SUBDIR_SOURCES} ${LIBTLS_SOURCES})
|
2019-07-25 09:56:08 +00:00
|
|
|
|
2019-11-19 10:14:26 +00:00
|
|
|
include_directories (../../)
|
|
|
|
include_directories (../../Libraries/)
|
2020-05-06 15:40:06 +00:00
|
|
|
add_library(LagomCore ${LAGOM_CORE_SOURCES})
|
2019-07-25 09:56:08 +00:00
|
|
|
|
2020-05-06 15:40:06 +00:00
|
|
|
if (BUILD_LAGOM)
|
|
|
|
add_library(Lagom $<TARGET_OBJECTS:LagomCore> ${LAGOM_MORE_SOURCES})
|
2020-02-06 18:32:34 +00:00
|
|
|
|
2020-05-06 15:40:06 +00:00
|
|
|
add_executable(TestApp TestApp.cpp)
|
|
|
|
target_link_libraries(TestApp Lagom)
|
|
|
|
target_link_libraries(TestApp stdc++)
|
2020-03-23 12:15:32 +00:00
|
|
|
|
2020-05-06 15:40:06 +00:00
|
|
|
add_executable(TestJson TestJson.cpp)
|
|
|
|
target_link_libraries(TestJson Lagom)
|
|
|
|
target_link_libraries(TestJson stdc++)
|
2020-04-08 08:40:02 +00:00
|
|
|
|
2020-05-06 15:40:06 +00:00
|
|
|
add_executable(js_lagom ../../Userland/js.cpp)
|
|
|
|
set_target_properties(js_lagom PROPERTIES OUTPUT_NAME js)
|
|
|
|
target_link_libraries(js_lagom Lagom)
|
|
|
|
target_link_libraries(js_lagom stdc++)
|
|
|
|
target_link_libraries(js_lagom pthread)
|
|
|
|
|
2020-05-27 10:28:39 +00:00
|
|
|
add_executable(test-crypto_lagom ../../Userland/test-crypto.cpp)
|
|
|
|
set_target_properties(test-crypto_lagom PROPERTIES OUTPUT_NAME test-crypto)
|
|
|
|
target_link_libraries(test-crypto_lagom Lagom)
|
|
|
|
target_link_libraries(test-crypto_lagom stdc++)
|
|
|
|
|
2020-05-06 15:40:06 +00:00
|
|
|
add_executable(disasm_lagom ../../Userland/disasm.cpp)
|
|
|
|
set_target_properties(disasm_lagom PROPERTIES OUTPUT_NAME disasm)
|
|
|
|
target_link_libraries(disasm_lagom Lagom)
|
|
|
|
target_link_libraries(disasm_lagom stdc++)
|
|
|
|
endif()
|
2020-04-11 11:16:17 +00:00
|
|
|
|
2020-04-08 08:40:02 +00:00
|
|
|
if (ENABLE_FUZZER_SANITIZER)
|
|
|
|
add_subdirectory(Fuzzers)
|
|
|
|
endif()
|