Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
| Download
GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
Project: cocalc-sagemath-dev-slelievre
Views: 418384# Pre-requisites about cmake itself1CMAKE_MINIMUM_REQUIRED(VERSION 2.6)23SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")45if(COMMAND cmake_policy)6cmake_policy(SET CMP0005 NEW) # new in 2.67cmake_policy(SET CMP0003 NEW) # new in 2.68if(POLICY CMP0042) # new in 2.8.29cmake_policy(SET CMP0042 NEW) # MACOSX_RPATH enabled by default10endif(POLICY CMP0042)11endif(COMMAND cmake_policy)12set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required1314# The project name and the type of project15PROJECT(libQnormaliz)16SET(VERSION_MAJOR 3)17SET(VERSION_MINOR 3)18SET(VERSION_PATCH 0)19SET(VERSION_STRING ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})20SET(VERSION ${VERSION_STRING})2122# automatically set lib suffix, disabled for now23#IF(UNIX AND NOT APPLE AND NOT CMAKE_CROSSCOMPILING AND NOT EXISTS "/etc/debian_version")24# IF(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT LIB_SUFFIX)25# SET(LIB_SUFFIX 64)26# ENDIF()27#ENDIF()2829# PkgConfig30SET(prefix ${CMAKE_INSTALL_PREFIX})31SET(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin)32SET(includedir ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME})3334IF(${UNIX})35SET(libdir ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})36ENDIF(${UNIX})37IF(${WIN32})38SET(libdir ${CMAKE_INSTALL_PREFIX}/bin)39ENDIF(${WIN32})4041#set default build type42#IF (NOT CMAKE_BUILD_TYPE) #or IF (NOT DEFINED CMAKE_BUILD_TYPE)43# SET(CMAKE_BUILD_TYPE Release)44#ENDIF (NOT CMAKE_BUILD_TYPE)4546##### Always full RPATH #####4748# use, i.e. don't skip the full RPATH for the build tree49SET(CMAKE_SKIP_BUILD_RPATH FALSE)5051# when building, don't use the install RPATH already52# (but later on when installing)53SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)5455SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")5657# add the automatically determined parts of the RPATH58# which point to directories outside the build tree to the install RPATH59SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)606162# the RPATH to be used when installing, but only if it's not a system directory63LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)64IF("${isSystemDir}" STREQUAL "-1")65SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")66ENDIF("${isSystemDir}" STREQUAL "-1")6768##############################6970SET(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib") #needed on mac717273# compiler flags74IF (MSVC)75SET (CXX_WARNING_FLAGS "/Wall")76SET (CXX_OPTIMIZATION_FLAGS "/O2")77ELSE ()78SET (CXX_WARNING_FLAGS "-Wall -pedantic")79SET (CXX_OPTIMIZATION_FLAGS "-O3")80ENDIF ()8182IF (NOT MSVC)83include(CheckCXXCompilerFlag)84CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)85CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)86if(COMPILER_SUPPORTS_CXX11)87set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")88elseif(COMPILER_SUPPORTS_CXX0X)89set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")90else()91message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support.")92endif()93IF (${APPLE})94IF (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND (COMPILER_SUPPORTS_CXX11 OR COMPILER_SUPPORTS_CXX0X) )95# using clang with new c++11 library on Apple96set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")97ENDIF ()98ENDIF ()99ENDIF()100101102SET (QNMZ_OPENMP "YES" CACHE BOOL "use openmp")103IF (QNMZ_OPENMP)104FIND_PACKAGE(OpenMP)105IF (NOT OPENMP_FOUND)106MESSAGE(STATUS "Not using OpenMP, compiler does not support it")107SET (QNMZ_OPENMP "NO" CACHE BOOL "use openmp" FORCE)108ENDIF(NOT OPENMP_FOUND)109ENDIF (QNMZ_OPENMP)110IF (QNMZ_OPENMP)111include("${CMAKE_SOURCE_DIR}/cmake/detect_features.cmake")112QNMZ_CHECK_FOR_EXCEPTION_PTR()113IF (NOT HAVE_EXCEPTION_PTR)114MESSAGE(STATUS "Not using OpenMP, compiler does not support std::exception_ptr and std::rethrow")115SET (QNMZ_OPENMP "NO" CACHE BOOL "use openmp" FORCE)116ENDIF (NOT HAVE_EXCEPTION_PTR)117ENDIF (QNMZ_OPENMP)118IF (QNMZ_OPENMP)119SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")120SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")121SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")122ELSE (QNMZ_OPENMP)123SET (CXX_WARNING_FLAGS "${CXX_WARNING_FLAGS} -Wno-unknown-pragmas")124ENDIF (QNMZ_OPENMP)125126# add compiler flags127SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_WARNING_FLAGS} ${CXX_OPTIMIZATION_FLAGS}")128129INCLUDE_DIRECTORIES(.)130131# handle static compilation132SET (QNMZ_BUILD_STATIC "NO" CACHE BOOL "build Qnormaliz statically")133IF (QNMZ_BUILD_STATIC)134IF (${APPLE})135IF (CMAKE_COMPILER_IS_GNUCXX)136SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc")137ENDIF (CMAKE_COMPILER_IS_GNUCXX)138# make it compatible with older Mac versions139SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.7")140ELSEIF (${UNIX})141SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")142ELSE ()143MESSAGE (FATAL_ERROR "Static linking not (yet) supported on this system")144ENDIF ()145ENDIF (QNMZ_BUILD_STATIC)146147# find gmp148FIND_PACKAGE(GMP REQUIRED)149INCLUDE_DIRECTORIES(${GMP_INCLUDE_DIR})150IF (GMP_FOUND)151MESSAGE(STATUS "GMP found with include dir: ${GMP_INCLUDE_DIR}")152MESSAGE(STATUS "GMP found with lib dir: ${GMP_LIBRARIES_DIR}")153MESSAGE(STATUS "GMP found with lib : ${GMP_LIBRARIES}")154MESSAGE(STATUS "GMP found with static lib : ${GMP_STATIC_LIBRARIES}")155ENDIF()156157FIND_PACKAGE(GMPXX REQUIRED)158INCLUDE_DIRECTORIES(${GMPXX_INCLUDE_DIR})159IF (GMPXX_FOUND)160MESSAGE(STATUS "GMPXX found with include dir: ${GMPXX_INCLUDE_DIR}")161MESSAGE(STATUS "GMPXX found with lib : ${GMPXX_LIBRARIES}")162MESSAGE(STATUS "GMPXX found with static lib : ${GMPXX_STATIC_LIBRARIES}")163ENDIF()164165ADD_SUBDIRECTORY(libQnormaliz)166167# add the Qnormaliz executable168ADD_EXECUTABLE (Qnormaliz Qnormaliz.cpp)169170IF (QNMZ_BUILD_STATIC)171TARGET_LINK_LIBRARIES (Qnormaliz Qnormaliz-static)172TARGET_LINK_LIBRARIES (Qnormaliz ${GMPXX_STATIC_LIBRARIES} ${GMP_STATIC_LIBRARIES})173#Static start and end174SET_TARGET_PROPERTIES(Qnormaliz PROPERTIES LINK_SEARCH_START_STATIC 1)175SET_TARGET_PROPERTIES(Qnormaliz PROPERTIES LINK_SEARCH_END_STATIC 1)176# Don't try to modify the RPATH177SET_TARGET_PROPERTIES(Qnormaliz PROPERTIES INSTALL_RPATH "")178ELSE (QNMZ_BUILD_STATIC)179TARGET_LINK_LIBRARIES (Qnormaliz Qnormaliz-shared)180TARGET_LINK_LIBRARIES (Qnormaliz ${GMPXX_LIBRARIES} ${GMP_LIBRARIES})181ENDIF (QNMZ_BUILD_STATIC)182183184INSTALL(TARGETS Qnormaliz DESTINATION bin)185186#custom make targets187ADD_CUSTOM_TARGET (uninstall @echo uninstall package)188IF (UNIX)189ADD_CUSTOM_COMMAND(190COMMENT "uninstall package"191COMMAND xargs ARGS rm < install_manifest.txt192TARGET uninstall193)194ELSE(UNIX)195ADD_CUSTOM_COMMAND(196COMMENT "uninstall only implemented in unix"197TARGET uninstall198)199ENDIF(UNIX)200201ADD_CUSTOM_TARGET (dep @echo install package dependencies)202IF (UNIX)203ADD_CUSTOM_COMMAND(204COMMENT "make package dependencies"205COMMAND ./make_dep.sh ARGS -d ../dependencies206TARGET dep207)208ELSE(UNIX)209ADD_CUSTOM_COMMAND(210COMMENT "make package dependencies only implemented in unix"211TARGET dep212)213ENDIF(UNIX)214215ADD_CUSTOM_TARGET (check)216IF (UNIX)217ADD_CUSTOM_COMMAND(218COMMENT "run tests"219COMMAND make --directory=../Qtest/ -f Makefile.classic QNORMALIZ=${CMAKE_CURRENT_BINARY_DIR}/Qnormaliz220TARGET check221DEPENDS Qnormaliz222)223ELSE(UNIX)224ADD_CUSTOM_COMMAND(225COMMENT "check only implemented in unix"226TARGET check227)228ENDIF(UNIX)229230231