Skip to content

Instantly share code, notes, and snippets.

@fiedl
Created June 13, 2014 11:22
Show Gist options
  • Save fiedl/21fb1b94caadc86f1156 to your computer and use it in GitHub Desktop.
Save fiedl/21fb1b94caadc86f1156 to your computer and use it in GitHub Desktop.
Genie Cmake configuration Hack for homebrew on Mac OS X 10.9.
#
# Copyright (C) 2011
# Claudio Kopper <[email protected]>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
colormsg("")
colormsg(HICYAN "genie")
if(NOT SYSTEM_PACKAGES)
if(NOT GENIE_VERSION)
message(STATUS "Looking for Genie version")
if(IS_DIRECTORY ${I3_PORTS}/Genie-2.6.4)
set(GENIE_VERSION "2.6.4")
elseif(IS_DIRECTORY ${I3_PORTS}/Genie-2.6.2)
set(GENIE_VERSION "2.6.2")
elseif(IS_DIRECTORY ${I3_PORTS}/Genie-2.6.0)
set(GENIE_VERSION "2.6.0")
else(IS_DIRECTORY ${I3_PORTS}/Genie-2.6.4)
unset(GENIE_VERSION)
endif(IS_DIRECTORY ${I3_PORTS}/Genie-2.6.4)
else(NOT GENIE_VERSION)
message(STATUS "Using already configured Genie version: ${GENIE_VERSION}")
endif(NOT GENIE_VERSION)
else(NOT SYSTEM_PACKAGES)
colormsg("GENIE SYSTEM PACKAGE ...")
execute_process(COMMAND brew info davidchall/hep/genie
COMMAND head -n 1
COMMAND cut -d " " -f 3
COMMAND xargs echo -n
OUTPUT_VARIABLE GENIE_VERSION)
message(STATUS "Using Genie version ${GENIE_VERSION}.")
execute_process(COMMAND brew --prefix davidchall/hep/genie
COMMAND xargs echo -n
OUTPUT_VARIABLE GENIE_PATH)
message(STATUS "Using Genie path ${GENIE_PATH}.")
set (GENIE_FOUND TRUE)
endif(NOT SYSTEM_PACKAGES)
# does Genie exist at all?
if(NOT GENIE_VERSION)
message(STATUS "Genie not installed.")
else(NOT GENIE_VERSION)
message(STATUS "Configuring for Genie version ${GENIE_VERSION}.")
if(NOT GENIE_PATH)
set(GENIE_PATH ${I3_PORTS}/Genie-${GENIE_VERSION} CACHE STRING "Genie's very own ROOTSYS equivalent.." FORCE)
endif(NOT GENIE_PATH)
message(STATUS "Looking for Genie genie-config program")
find_program (GENIE_CONFIG genie-config
PATHS ${GENIE_PATH}/bin
NO_DEFAULT_PATH
)
if (${GENIE_CONFIG} MATCHES ".*NOTFOUND$")
message(STATUS "Looking for Genie genie-config program -- not found")
set(GENIE_CONFIG_ERROR TRUE)
else (${GENIE_CONFIG} MATCHES ".*NOTFOUND$")
#message(STATUS "Looking for Genie genie-config program -- found")
#message(STATUS "Genie-config: ${GENIE_CONFIG}")
execute_process(#COMMAND export }
COMMAND bash -c "GENIE=${GENIE_PATH} ${GENIE_CONFIG} --libs"
OUTPUT_VARIABLE GENIE_CONFIG_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE
)
#message(STATUS "Genie-config output: ${GENIE_CONFIG_OUTPUT}")
string(REGEX REPLACE "-l([^ ]*)" "${CMAKE_SHARED_LIBRARY_PREFIX}\\1${CMAKE_SHARED_LIBRARY_SUFFIX}" GENIE_LIBRARIES ${GENIE_CONFIG_OUTPUT})
string(REGEX REPLACE "-L([^ ]*)" "" GENIE_LIBRARIES ${GENIE_LIBRARIES})
#message(STATUS "Genie libraries: ${GENIE_LIBRARIES}")
separate_arguments(GENIE_LIBRARIES)
string(REGEX REPLACE "-L([^ ]*)" "\\1" GENIE_LIB_DIR ${GENIE_CONFIG_OUTPUT})
string(REGEX REPLACE "-l([^ ]*)" "" GENIE_LIB_DIR ${GENIE_LIB_DIR})
string(STRIP ${GENIE_LIB_DIR} GENIE_LIB_DIR)
#message(STATUS "Genie lib dir: \"${GENIE_LIB_DIR}\"")
string (REPLACE "${I3_PORTS}/" "" GENIE_RELATIVE_LIB_DIR "${GENIE_LIB_DIR}")
#message(STATUS "Genie relative lib dir: \"${GENIE_RELATIVE_LIB_DIR}\"")
set(GENIE_INC_DIR ${GENIE_PATH}/include/GENIE)
string (REPLACE "${I3_PORTS}/" "" GENIE_RELATIVE_INC_DIR "${GENIE_INC_DIR}")
#message(STATUS "Genie include dir: \"${GENIE_INC_DIR}\"")
#message(STATUS "Genie relative include dir: \"${GENIE_RELATIVE_INC_DIR}\"")
TOOLDEF (genie
${GENIE_RELATIVE_INC_DIR}
EVGCore/EventRecord.h
${GENIE_RELATIVE_LIB_DIR}
NONE # bin is n/a, placeholder
${GENIE_LIBRARIES}
)
endif (${GENIE_CONFIG} MATCHES ".*NOTFOUND$")
endif(NOT GENIE_VERSION)
@fiedl
Copy link
Author

fiedl commented Jun 13, 2014

@claudiok : Hallo Claudio, mit diesem "Hack" habe ich es hinbekommen, dass Genie erkannt wird. Hältst Du das so für sinnvoll? Das funktioniert natürlich nur mit Homebrew.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment