Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmakeupdates #46

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
cce6210
remove some irrelevant tests
sjunges Mar 27, 2023
343df83
typetraits.h specifies it should not be included directly, so lets no…
sjunges Mar 28, 2023
702cb66
updates regarding logging (use a more descriptive ifdef to avoid dupl…
sjunges Mar 28, 2023
12c9bdb
remove cad
sjunges Mar 28, 2023
8f4a187
avoid code that cannot compile
sjunges Mar 28, 2023
05ae723
fix ordering for polynomials to GrLexOrdering, thereby paving the way…
sjunges Mar 28, 2023
6ee4b6c
version includes patch versions now, update to version 14.24.0
sjunges Mar 28, 2023
8320577
Merge branch 'master' of https://github.com/moves-rwth/carl-storm
sjunges Apr 3, 2023
8f6ed12
Merge branch 'master' of https://github.com/moves-rwth/carl-storm
sjunges Apr 16, 2023
63d3461
Merge branch 'master' of https://github.com/moves-rwth/carl-storm
sjunges Jun 27, 2023
8104453
Merge branch 'master' of https://github.com/moves-rwth/carl-storm
sjunges Dec 10, 2023
b1b5da1
Merge branch 'master' of https://github.com/moves-rwth/carl-storm
sjunges May 22, 2024
0753294
fixes https://github.com/moves-rwth/carl-storm/issues/27
sjunges May 22, 2024
deb591d
move ifdef up
sjunges May 22, 2024
6b6b9a1
cmake to project
sjunges Aug 20, 2024
d493e43
Merge branch 'master' of https://github.com/moves-rwth/carl-storm
sjunges Aug 22, 2024
73e5394
towards carl for fetchcontent
sjunges Aug 26, 2024
eaaffc7
updates
sjunges Aug 28, 2024
8ec7070
Merge branch 'master' of https://github.com/moves-rwth/carl-storm
sjunges Aug 28, 2024
7cc22f7
Merge branch 'master' into cmakeupdates
sjunges Aug 28, 2024
e1f43a2
updates regarding ginac and what we install
sjunges Sep 3, 2024
f7c20b8
remove comment
sjunges Sep 25, 2024
c25b8ac
Added carl prefix to more messages
volkm Nov 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 25 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ set( PROJECT_DESCRIPTION "Computer ARithmetic Library")
set( carl_NAME "CArL" )
set( carl_DESCRIPTION ${PROJECT_DESCRIPTION} )

message(STATUS "Version: ${PROJECT_FULLNAME} ${PROJECT_VERSION_FULL}")
message(STATUS "carl - Version: ${PROJECT_FULLNAME} ${PROJECT_VERSION_FULL}")

# # # # # # # # # # # # # # # # # # # # # #
# B. Options
Expand Down Expand Up @@ -63,7 +63,6 @@ option( USE_BLISS "Use bliss" OFF )
export_option(USE_BLISS)
OPTION( USE_MPFR_FLOAT "Use the mpfr implementation of floating point numbers." OFF )
export_option(USE_MPFR_FLOAT)
option( USE_COTIRE "Use cotire to generate and use precompiled headers" OFF )
option( PORTABLE "Enable portable build without hardware-specific compiler flags." OFF)
export_option(PORTABLE)
option( BUILD_STATIC "Build the static library as well" OFF )
Expand All @@ -76,31 +75,37 @@ option( PRUNE_MONOMIAL_POOL "Prune monomial pool" ON )
option( EXCLUDE_TESTS_FROM_ALL "If set, tests will not be compiled by default" OFF )
export_option(EXCLUDE_TESTS_FROM_ALL)

option( CARL_COMPILE_RELEASE "Compile in Release mode irrespectively of CMAKE_BUILD_TYPE" OFF)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need a separate flag?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is actually not advised to do, but it would allow you to compile carl in release mode while compiling storm in debug mode (or vice versa), when carl is a subproject.

I am also happy not to support that :-D

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, just wanted to confirm that my understanding is correct.
I would be in favour of removing it, because in most cases one would like to have both with the same build type. If different build types are needed, one can still manually build carl.
(The flag is currently also not used anywhere as far as I can see.)

option (CARL_COMPILE_BENCHMARKS "Compile Benchmarks" OFF)

set(CLANG_SANITIZER "none" CACHE STRING "Compile with the respective sanitizer")
set_property(CACHE CLANG_SANITIZER PROPERTY STRINGS none address memory thread)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

if (NOT CMAKE_BUILD_TYPE)
if (PROJECT_IS_TOP_LEVEL)
set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "Build type." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "DEBUG" "RELEASE")
endif()

set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "DEBUG" "RELEASE")

set(CARL_LIBRARIES_DIR "${PROJECT_BINARY_DIR}/lib")

# Offer the user the choice of overriding the installation directories
set(INCLUDE_INSTALL_DIR include/ CACHE PATH "Installation directory for header files" )
set(LIB_INSTALL_DIR lib/ CACHE PATH "Installation directory for libraries")
#set(SYSCONFIG_INSTALL_DIR etc/carl/ CACHE PATH "Installation for system configuration files)
set(BIN_INSTALL_DIR lib/ CACHE PATH "Installation directory for executables")
set(CARL_INCLUDE_INSTALL_DIR include/ CACHE PATH "Installation directory for header files" )
set(CARL_LIB_INSTALL_DIR lib/ CACHE PATH "Installation directory for libraries")
set(CARL_BIN_INSTALL_DIR bin/ CACHE PATH "Installation directory for executables")
set(CARL_CMAKE_INSTALL_DIR lib/cmake/ CACHE PATH "Installation directory for executables")



if(WIN32 AND NOT CYGWIN)
set(DEF_INSTALL_CMAKE_DIR CMake)
else()
set(DEF_INSTALL_CMAKE_DIR lib/cmake/carl)
endif()
set(CMAKE_INSTALL_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Installation directory for CMake files")
if (PROJECT_IS_TOP_LEVEL)
set(CMAKE_INSTALL_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Installation directory for CMake files")
endif()

if(APPLE AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES arm64)
message(STATUS "Detected that target system uses Apple Silicon.")
Expand All @@ -109,7 +114,7 @@ if(APPLE AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES arm64)
endif()

foreach(p LIB BIN INCLUDE CMAKE)
set(var ${p}_INSTALL_DIR)
set(var CARL_${p}_INSTALL_DIR)
if(NOT IS_ABSOLUTE "${${var}}")
set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif()
Expand All @@ -131,16 +136,14 @@ elseif (WIN32)
endif()

if(BUILD_STATIC)
message(STATUS "Building static: yes")
message(STATUS "carl - Building static: yes")
if (LOGGING)
message(WARNING "A static build with logging enabled will probably trigger a segfault!")
message(WARNING "carl - A static build with logging enabled will probably trigger a segfault!")
endif()
else()
message(STATUS "Building static: no")
message(STATUS "carl - Building static: no")
endif()

include(cotire)

# RPATH settings
# don't skip the full RPATH for the build tree
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
Expand Down Expand Up @@ -168,18 +171,19 @@ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
include(resources/resources.cmake)

# we only search for this libraries in the system, if we do not force using the shipped resources.

enable_testing()
if(PROJECT_IS_TOP_LEVEL)
enable_testing()
include(coverage)
endif()

#dl must be linked LAST as this is required for the stacktrace in util/platform.h
if (NOT WIN32)
list(APPEND carl_LIBRARIES_DYNAMIC pthread dl)
endif()

include(clang-tidy)
include(coverage)

if (TARGET Doxygen::doxygen)
if (TARGET Doxygen::doxygen AND PROJECT_IS_TOP_LEVEL)
include(clang-tidy)
include(resources/doc-resources.cmake)
add_subdirectory(doxygen-conf)
endif()
add_subdirectory(src)
Expand Down
5 changes: 5 additions & 0 deletions cmake/carlmacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ function(set_version major minor patch)
if(patch)
set(PROJECT_VERSION_FULL "${major}.${minor}.${patch_full}" PARENT_SCOPE)
set(PROJECT_VERSION "${major}.${minor}.${patch}" PARENT_SCOPE)

else()
set(PROJECT_VERSION_FULL "${major}.${minor}" PARENT_SCOPE)
set(PROJECT_VERSION "${major}.${minor}" PARENT_SCOPE)
endif()
set(${PROJECT_NAME}_VERSION_MAJOR ${PROJECT_VERSION_MAJOR} PARENT_SCOPE)
set(${PROJECT_NAME}_VERSION_MINOR ${PROJECT_VERSION_MINOR} PARENT_SCOPE)
set(${PROJECT_NAME}_VERSION_PATCH ${PROJECT_VERSION_PATCH} PARENT_SCOPE)

endfunction(set_version)

function(add_imported_library_interface name include)
Expand Down
18 changes: 10 additions & 8 deletions cmake/compiler-options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") # Matches "Clang" and "AppleClan
message(FATAL_ERROR " clang version must be at least 3.5!")
endif()
if (APPLE)
message(STATUS "carl - Using clang ${CMAKE_CXX_COMPILER_VERSION} on apple")
volkm marked this conversation as resolved.
Show resolved Hide resolved
set(CMAKE_MACOSX_RPATH 1)
message(STATUS "Using clang ${CMAKE_CXX_COMPILER_VERSION} on Apple")
set(CMAKE_MACOSX_RPATH 1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -stdlib=libc++ -pthread")
else()
message(STATUS "Using clang ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS "carl - Using clang ${CMAKE_CXX_COMPILER_VERSION}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -pthread")
endif()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -fomit-frame-pointer -funroll-loops")
Expand All @@ -19,18 +21,18 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
message(FATAL_ERROR " g++ version must be at least 4.9!")
endif()
message(STATUS "Using g++ ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS "carl - Using g++ ${CMAKE_CXX_COMPILER_VERSION}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wunknown-pragmas")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -fmax-errors=5 -fdiagnostics-color=auto")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O1")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
message("-- Using Visual Studio C++ ${CMAKE_CXX_COMPILER_VERSION}")
message("carl - Using Visual Studio C++ ${CMAKE_CXX_COMPILER_VERSION}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP1 /D_SCL_SECURE_NO_WARNINGS")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2 /MT")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd /bigobj")
else()
message(WARNING "Possibly unsupported compiler ${CMAKE_CXX_COMPILER_ID}")
message(WARNING "carl - Possibly unsupported compiler ${CMAKE_CXX_COMPILER_ID}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()

Expand Down Expand Up @@ -75,7 +77,7 @@ if(DEVELOPER)
set(CMAKE_BUILD_TYPE "DEBUG")
endif()

message(STATUS "CXX Flags: ${CMAKE_CXX_FLAGS}")
message(STATUS "CXX Debug Flags: ${CMAKE_CXX_FLAGS_DEBUG}")
message(STATUS "CXX Release Flags: ${CMAKE_CXX_FLAGS_RELEASE}")
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "carl - CXX Flags: ${CMAKE_CXX_FLAGS}")
message(STATUS "carl - CXX Debug Flags: ${CMAKE_CXX_FLAGS_DEBUG}")
message(STATUS "carl - CXX Release Flags: ${CMAKE_CXX_FLAGS_RELEASE}")
message(STATUS "carl - Build type: ${CMAKE_BUILD_TYPE}")
Loading
Loading