Changeset 19715


Ignore:
Timestamp:
10/04/19 18:47:44 (5 years ago)
Author:
tbretz
Message:
Added the possibility to add RootHealPix to the Mars library.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/CMakeLists.txt

    r19659 r19715  
    9393
    9494FIND_PACKAGE(ZLIB REQUIRED)
     95
     96# *********************************
     97# **********   HEAL Pix  **********
     98# *********************************
     99
     100SET(HEALPIX_PREFIX "${CMAKE_SOURCE_DIR}/RootHealPix" CACHE FILEPATH "Base path to the RootHealPix code.")
     101
     102IF(EXISTS ${HEALPIX_PREFIX})
     103   FIND_PACKAGE_MESSAGE(HealPixPrefix "RootHealPix prefix: ${HEALPIX_PREFIX}" "[${HEALPIX_PREFIX}]")
     104   SET(FOUND_HEALPIX ON)
     105ENDIF()
    95106
    96107# ============== ROOT ================
     
    112123SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "$ENV{ROOTSYS}/etc/cmake")
    113124
     125SET(ROOT_PACKAGES Gui Minuit ASImage HistPainter)
     126IF(FOUND_HEALPIX)
     127   SET(ROOT_PACKAGES ${ROOT_PACKAGES} FITSIO)
     128ENDIF()
     129
    114130#---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
    115 FIND_PACKAGE(ROOT REQUIRED COMPONENTS Gui Minuit ASImage HistPainter)
     131FIND_PACKAGE(ROOT REQUIRED COMPONENTS ${ROOT_PACKAGES})
    116132
    117133IF(NOT DEFINED ROOT_CONFIG_EXECUTABLE)
     
    291307
    292308ADD_LIBRARY(mars SHARED dictionary/Core.cxx) # CMAKE_POSITION_INDEPENDENT_CODE
    293         SET_SOURCE_FILES_PROPERTIES(dictionary/Core.cxx PROPERTIES COMPILE_FLAGS "-Wno-deprecated-register")
     309SET_SOURCE_FILES_PROPERTIES(dictionary/Core.cxx PROPERTIES COMPILE_FLAGS "-Wno-deprecated-register")
     310
    294311TARGET_LINK_LIBRARIES(mars
    295312        ZLIB::ZLIB
     
    308325        SRCFILES(${DIR})
    309326ENDFOREACH()
     327
     328# -------------------------------------------------------
     329
     330IF(FOUND_HEALPIX)
     331   # https://github.com/akira-okumura/RootHealPix.git
     332   # THealPixD de("name", "", 2); for (int i=0; i<100; i++) de.Fill(gRandom->Uniform()*90, gRandom->Uniform()*180); de.Draw("COLZ");
     333
     334   #   INCLUDE_DIRECTORIES(${HEALPIX_PREFIX}/include)
     335   # - The first one is required to make ROOT_GENERATE_DICTIONARY
     336   #   find absolute paths. The second one is required for
     337   #   compilation. Note that any later ROOT_GENERALE_DICTIONARY
     338   #   might find the LinkDef.h in RootHealPix/include
     339   INCLUDE_DIRECTORIES(/ ${HEALPIX_PREFIX}/include)
     340
     341   ROOT_GENERATE_DICTIONARY(dictionary/HealPix
     342        ${HEALPIX_PREFIX}/include/Healoption.h
     343        ${HEALPIX_PREFIX}/include/THealAlm.h
     344        ${HEALPIX_PREFIX}/include/THealFFT.h
     345        ${HEALPIX_PREFIX}/include/THealPainter.h
     346        ${HEALPIX_PREFIX}/include/THealPaletteAxis.h
     347        ${HEALPIX_PREFIX}/include/THealPixCube.h
     348        ${HEALPIX_PREFIX}/include/THealPix.h
     349        ${HEALPIX_PREFIX}/include/THealUtil.h
     350        ${HEALPIX_PREFIX}/include/TVirtualHealPainter.h
     351        LINKDEF ${HEALPIX_PREFIX}/include/LinkDef.h OPTIONS -p)
     352
     353   # - Define the source files of the library
     354   ADD_LIBRARY(RootHealPix SHARED dictionary/HealPix.cxx
     355        ${HEALPIX_PREFIX}/src/THealAlm.cxx
     356        ${HEALPIX_PREFIX}/src/THealFFT.cxx
     357        ${HEALPIX_PREFIX}/src/THealPainter.cxx
     358        ${HEALPIX_PREFIX}/src/THealPaletteAxis.cxx
     359        ${HEALPIX_PREFIX}/src/THealPixCube.cxx
     360        ${HEALPIX_PREFIX}/src/THealPix.cxx
     361        ${HEALPIX_PREFIX}/src/THealUtil.cxx
     362        ${HEALPIX_PREFIX}/src/TVirtualHealPainter.cxx)
     363
     364   # - Tweak some warnings
     365   SET_TARGET_PROPERTIES(RootHealPix PROPERTIES COMPILE_FLAGS
     366        "-Wno-unused-variable -Wno-unused-function -Wno-unneeded-internal-declaration -Wno-shadow")
     367
     368   # - Link with the root libraries for auto-loading
     369   TARGET_LINK_LIBRARIES(mars RootHealPix)
     370
     371   # - Install the corresponding header files
     372   INSTALL(DIRECTORY ${HEALPIX_PREFIX}/include/ DESTINATION "include" FILES_MATCHING PATTERN "*.h")
     373
     374   # - Install the library
     375   INSTALL(TARGETS RootHealPix DESTINATION ".")
     376ENDIF()
     377
    310378
    311379# rootlogon.C finds the shared object only if the libmars.so is in the same directory than the dictionary files
Note: See TracChangeset for help on using the changeset viewer.