diff --git a/CMakeLists.txt b/CMakeLists.txt index f25239f7..75205615 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -# set(CMAKE_CXX_EXTENSIONS OFF) message(STATUS " Generator: ${CMAKE_GENERATOR}") message(STATUS " Build Target: ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}") message(STATUS " Installation Prefix: ${CMAKE_INSTALL_PREFIX}") @@ -95,7 +94,8 @@ option(DEV_MODE "Build testing dev_test.cpp with cytnx" OFF) # ##################################################################### project(CYTNX VERSION ${CYTNX_VERSION} LANGUAGES CXX C) -# C++ uses link-time optimization anyway; this enables additionally -flto=auto, for parallel compilation +# C++ uses link-time optimization anyway; this enables additionally -flto=auto, +# for parallel compilation set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) add_library(cytnx STATIC) @@ -117,20 +117,9 @@ target_include_directories(cytnx SYSTEM ${Boost_INCLUDE_DIRS} ) -# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat=0 -Wno-c++11-narrowing -w") -# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat=0 -w -fsized-deallocation -fsanitize=address") - target_compile_options(cytnx PUBLIC -Wformat=0 -w -fsized-deallocation) - -#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat=0 -w -fsized-deallocation -diag-disable=10441") - -# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_LIBCPP_DISABLE_AVAILABILITY") -# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION") target_compile_features(cytnx PUBLIC cxx_std_17) -# target_compile_definitions(cytnx PUBLIC _LIBCPP_DISABLE_AVAILABILITY) -# target_compile_definitions(cytnx PUBLIC _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION) -# set_property(TARGET cytnx PROPERTY CXX_STANDARD 11) add_subdirectory(src) if(USE_DEBUG) @@ -146,7 +135,8 @@ if(USE_ICPC) target_compile_definitions(cytnx PUBLIC UNI_ICPC) # This option is to disable the warning of icpc target_compile_options(cytnx PUBLIC -diag-disable=10441) - # This option is to maintain consistency of the floating point operation, also try to improve the performance + # This option is to maintain consistency of the floating point operation, also + # try to improve the performance target_compile_options(cytnx PUBLIC -fp-model consistent -fimf-use-svml) endif() @@ -208,35 +198,13 @@ if(RUN_TESTS) add_subdirectory(tests) #add_subdirectory(bm_tests) - #find_package(benchmark REQUIRED) - - - #include(FetchContent) - #FetchContent_Declare( - # googletest - # URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip - #) - - # For Windows: Prevent overriding the parent project's compiler/linker settings set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) - - #FetchContent_Declare( - # googlebenchmark - # GIT_REPOSITORY https://github.com/google/benchmark.git - # GIT_TAG v1.7.1) # need master for benchmark::benchmark - #set(BENCHMARK_ENABLE_TESTING off) # to suppress benchmark internal tests - - #FetchContent_MakeAvailable( - # googletest - # googlebenchmark) endif() # ####### # ## Python wrapper # ####### IF(BUILD_PYTHON) - # PythonInterp is removed in newer version of cmake - # find_package(PythonInterp REQUIRED) find_package (Python COMPONENTS Interpreter Development) find_package(pybind11 REQUIRED) @@ -406,7 +374,6 @@ message(STATUS " CXX Flags: ${CMAKE_CXX_FLAGS}") message(STATUS " BLAS and LAPACK Libraries: ${LAPACK_LIBRARIES}") message(STATUS " Link libraries: ${CYTNX_LINK_Libs}") -# # this need to append into the linkflags.tmp FILE(APPEND "${CMAKE_BINARY_DIR}/linkflags.tmp" "${LAPACK_LIBRARIES}\n" "") FILE(APPEND "${CMAKE_BINARY_DIR}/cxxflags.tmp" "${CMAKE_CXX_FLAGS}\n" "")