Commit 653b0a71 authored by Johnny Jazeix's avatar Johnny Jazeix

use otfconfig to find otf directories

parent ab8fc768
......@@ -96,7 +96,7 @@ check_include_files(string.h HAVE_STRING_H)
# Components : filesystem, iostreams, programoptions, python, regex,
# serialization, signals, system, thread, wave
if(VITE_ENABLE_SERIALIZATION)
find_package( Boost COMPONENTS serialization thread iostreams)
find_package( Boost COMPONENTS serialization thread iostreams system)
endif(VITE_ENABLE_SERIALIZATION)
if(VITE_ENABLE_VBO)
......
......@@ -3,7 +3,8 @@
#
# OTF_INCLUDE_DIR - Directories to include to use OTF
# OTF_LIBRARY - Files to link against to use OTF
# OTF_LIBRARY - Files to link against to use OTF
# OTF_LIBRARY_DIR - Directories to link to use OTF
# OTF_FOUND - When false, don't try to use OTF
#
# OTF_DIR can be used to make it simpler to find the various include
......@@ -12,32 +13,48 @@
# compilation or because you installed it in an "unusual" directory).
# Just set OTF_DIR it to your specific installation directory
#
FIND_LIBRARY(OTF_LIBRARY otf
FIND_PROGRAM( OTF_CONFIG_EXE otfconfig
PATHS
/usr/lib
/usr/local/lib
${OTF_DIR}/lib
/usr/bin
/usr/local/bin
${OTF_DIR}/bin
)
IF(OTF_LIBRARY)
GET_FILENAME_COMPONENT(OTF_GUESSED_INCLUDE_DIR_tmp "${OTF_LIBRARY}" PATH)
STRING(REGEX REPLACE "lib$" "include" OTF_GUESSED_INCLUDE_DIR "${OTF_GUESSED_INCLUDE_DIR_tmp}")
ENDIF(OTF_LIBRARY)
# Use otfconfig to find paths
IF( OTF_CONFIG_EXE )
EXECUTE_PROCESS( COMMAND "${OTF_CONFIG_EXE}" "--includes" OUTPUT_VARIABLE OTF_INCLUDE_DIR )
EXECUTE_PROCESS( COMMAND "${OTF_CONFIG_EXE}" "--libs" OUTPUT_VARIABLE OTF_LIBS )
ENDIF( OTF_CONFIG_EXE )
FIND_PATH( OTF_INCLUDE_DIR otf.h OTF_KeyValue.h
PATHS
${OTF_GUESSED_INCLUDE_DIR}
${OTF_DIR}/include
/usr/include
/usr/local/include
${CMAKE_SOURCE_DIR}/externals/otf/otflib/
)
IF( OTF_LIBS ) # OTF_LIBS is "-Lpath -lotf {-lz}"
STRING( REGEX MATCHALL "([^\ ]+\ |[^\ ]+$)" ARG_LIST "${OTF_LIBS}" )
# MESSAGE( "list = ${ARG_LIST}" )
FOREACH( listVar ${ARG_LIST} )
IF( listVar MATCHES "-L.*" ) # Gets the lib path
STRING( REGEX REPLACE "-L" "" listVar "${listVar}" )
STRING( REGEX REPLACE " " "" listVar "${listVar}" )
# MESSAGE( "libpath = ${listVar}" )
LIST( APPEND OTF_LIBRARY_DIR ${listVar} )
ENDIF()
IF( listVar MATCHES "-lo.*" ) # only gets the otf lib. If only -l.*, we also gets -lz and it does not work
STRING( REGEX REPLACE "-l" "" listVar "${listVar}" )
STRING( REGEX REPLACE " " "" listVar "${listVar}" )
# MESSAGE( "libs = ${listVar}" )
LIST( APPEND OTF_LIBRARY ${listVar} )
ENDIF()
ENDFOREACH( listVar )
ENDIF( OTF_LIBS )
IF( OTF_INCLUDE_DIR )
# Remove the -I because cmake handles it
STRING( REGEX REPLACE "-I" "" OTF_INCLUDE_DIR "${OTF_INCLUDE_DIR}" )
IF( OTF_LIBRARY )
SET( OTF_FOUND "YES" )
MARK_AS_ADVANCED( OTF_DIR )
MARK_AS_ADVANCED( OTF_INCLUDE_DIR )
MARK_AS_ADVANCED( OTF_LIBRARY_DIR )
MARK_AS_ADVANCED( OTF_LIBRARY )
ENDIF( OTF_LIBRARY )
ENDIF( OTF_INCLUDE_DIR )
......
......@@ -293,7 +293,8 @@ IF(VITE_ENABLE_OTF)
parser/OTFParser/OTFTraceBuilderThread.cpp
)
ENDIF()
INCLUDE_DIRECTORIES(${OTF_INCLUDE_DIR})
INCLUDE_DIRECTORIES(BEFORE ${OTF_INCLUDE_DIR})
ENDIF(VITE_ENABLE_OTF)
......@@ -401,6 +402,11 @@ INCLUDE_DIRECTORIES(
)
#ADD_LIBRARY(vite2 SHARED ${VITE_SRCS} ${VITE_MOC} ${VITE_RCC_SRCS})
IF( VITE_ENABLE_OTF )
LINK_DIRECTORIES( ${OTF_LIBRARY_DIR} )
ENDIF( VITE_ENABLE_OTF )
if( APPLE )
INCLUDE_DIRECTORIES(/usr/X11/include)
SET( OSX_ICON_FILES "interface/icon/mac_logo.icns")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment