Making the project tag in simdjson more explicit and disabling LTO (#452)

* Making the project tag in simdjson more explicit

* Let us disable deliberately LTO.
This commit is contained in:
Daniel Lemire 2020-01-20 10:18:58 -05:00 committed by GitHub
parent ab6d4871d8
commit 33060738b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 9 deletions

View File

@ -1,10 +1,23 @@
cmake_minimum_required(VERSION 3.9) # CMP0069 NEW
include(CheckIPOSupported)
check_ipo_supported(RESULT ltoresult)
if(ltoresult)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Release")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
endif()
project(simdjson
DESCRIPTION "Parsing gigabytes of JSON per second"
LANGUAGES CXX
)
# LTO seems to create all sorts of fun problems. Let us
# disable temporarily.
#include(CheckIPOSupported)
#check_ipo_supported(RESULT ltoresult)
#if(ltoresult)
#set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
#endif()
# usage: cmake -DSIMDJSON_DISABLE_AVX=on ..
option(SIMDJSON_DISABLE_AVX "Forcefully disable AVX even if hardware supports it" OFF)
@ -14,12 +27,8 @@ set(CMAKE_MACOSX_RPATH OFF)
set(CMAKE_THREAD_PREFER_PTHREAD ON)
set(THREADS_PREFER_PTHREAD_FLAG ON)
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Release")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
endif()
project(simdjson)
set(SIMDJSON_LIB_NAME simdjson)
set(PROJECT_VERSION_MAJOR 0)
set(PROJECT_VERSION_MINOR 2)

View File

@ -5,6 +5,14 @@ if(MSVC)
endif()
add_cpp_test(basictests)
## Next bit should not be needed!
#if(CMAKE_INTERPROCEDURAL_OPTIMIZATION)
# next line is a workaround for an odr-violation in basictests regarding the globals 0x432a40 and 0x52045c under clang
#set_tests_properties(basictests PROPERTIES
# ENVIRONMENT ASAN_OPTIONS="detect_odr_violation=0")
#endif()
add_cpp_test(jsoncheck)
add_cpp_test(jsonstream_test)
add_cpp_test(pointercheck)