Commit e86e8fc8 authored by Dario Berzano's avatar Dario Berzano Committed by Nikola Hardi
Browse files

Add proper CMake to the project

* Very simple CMake file relying on ROOT's CMake
* `Find` modules for JSON-C and libwebsockets
parent 1c883774
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
project(JAliEn-ROOT CXX)
list(APPEND CMAKE_PREFIX_PATH ${ROOTSYS})
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
find_package(JSONC REQUIRED)
find_package(libwebsockets REQUIRED)
find_package(ROOT REQUIRED COMPONENTS Net Tree)
foreach(FEATURE xrootd xml)
if(NOT ROOT_${FEATURE}_FOUND)
message(FATAL_ERROR "ROOT was built without ${FEATURE} support (required)")
endif()
endforeach()
include(${ROOT_USE_FILE})
set(CMAKE_CXX_FLAGS ${ROOT_CXX_FLAGS})
message(STATUS "Using same ROOT CXX flags: ${CMAKE_CXX_FLAGS}")
# This is our library's name
set(LIBNAME JAliEnROOT)
set(SRCS
TJAlienCollection.cxx
TJAlien.cxx
TJAlienDirectory.cxx
TJAlienFile.cxx
TJAlienJDL.cxx
TJAlienJob.cxx
TJAlienJobStatus.cxx
TJAlienJobStatusList.cxx
TJAlienMasterJob.cxx
TJAlienMasterJobStatus.cxx
TJAlienPackage.cxx
TJAlienResult.cxx
TJAlienSAXHandler.cxx
TJAlienSystem.cxx)
string(REPLACE ".cxx" ".h" HDRS "${SRCS}")
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
ROOT_GENERATE_DICTIONARY(G__${LIBNAME} "${HDRS}" LINKDEF LinkDef.h)
add_library(${LIBNAME} SHARED "${SRCS}" G__${LIBNAME}.cxx)
target_link_libraries(${LIBNAME} ${ROOT_LIBRARIES} json-c websockets)
install(TARGETS ${LIBNAME} LIBRARY DESTINATION lib)
install(FILES ${PROJECT_BINARY_DIR}/lib${LIBNAME}.rootmap DESTINATION lib)
install(FILES ${PROJECT_BINARY_DIR}/lib${LIBNAME}_rdict.pcm DESTINATION lib)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/etc/plugins DESTINATION etc)
############################################################################
# CMakeLists.txt file for building ROOT net/jalien package
# @author Pere Mato, CERN
############################################################################
ROOT_USE_PACKAGE(core)
ROOT_USE_PACKAGE(net/netx)
ROOT_USE_PACKAGE(io/xml)
ROOT_USE_PACKAGE(io/xmlparser)
ROOT_USE_PACKAGE(proof/proofd)
find_library(SSL_LIB libssl.a REQUIRED)
find_library(CRYPTO_LIB libcrypto.a REQUIRED)
ROOT_GENERATE_DICTIONARY(G__JAlien *.h LINKDEF LinkDef.h)
ROOT_GENERATE_ROOTMAP(RJAliEn LINKDEF LinkDef.h DEPENDENCIES XMLIO XMLParser Netx Tree Proof)
ROOT_LINKER_LIBRARY(RJAliEn *.cxx G__JAlien.cxx DEPENDENCIES XMLIO XMLParser Netx Tree Proof ssl crypto json-c pthread websockets)
ROOT_INSTALL_HEADERS()
# Find module for JSON-C.
# Variables:
# - JSONC_FOUND: TRUE if found
# - JSONC_LIBPATH: library path
# - JSONC_INCLUDE_DIR: include dir
include(FindPackageHandleStandardArgs)
find_library(JSONC_LIBPATH "json-c"
PATH_SUFFIXES "lib"
HINTS "${JSONC}")
find_path(JSONC_INCLUDE_DIR "json_object_iterator.h"
PATH_SUFFIXES "include/json-c"
HINTS "${JSONC}")
get_filename_component(JSONC_LIBPATH ${JSONC_LIBPATH} DIRECTORY)
get_filename_component(JSONC_INCLUDE_DIR ${JSONC_INCLUDE_DIR} DIRECTORY)
find_package_handle_standard_args(JSONC DEFAULT_MSG
JSONC_LIBPATH JSONC_INCLUDE_DIR)
include_directories(${JSONC_INCLUDE_DIR})
link_directories(${JSONC_LIBPATH})
# Find module for libwebsockets.
# Variables:
# - LWS_FOUND: TRUE if found
# - LWS_LIBPATH: library path
# - LWS_INCLUDE_DIR: include dir
include(FindPackageHandleStandardArgs)
find_library(LWS_LIBPATH "websockets"
PATH_SUFFIXES "lib"
HINTS "${LWS}")
find_path(LWS_INCLUDE_DIR "libwebsockets.h"
PATH_SUFFIXES "include"
HINTS "${LWS}")
get_filename_component(LWS_LIBPATH ${LWS_LIBPATH} DIRECTORY)
find_package_handle_standard_args(LWS DEFAULT_MSG
LWS_LIBPATH LWS_INCLUDE_DIR)
include_directories(${LWS_INCLUDE_DIR})
link_directories(${LWS_LIBPATH})
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