Commit 78bda0d1 authored by francesco's avatar francesco
Browse files

cmake should be fully operational, even for macosx

git-svn-id: svn://gal-serv.lnl.infn.it/agata/trunk/narval_emulator@1072 170316e4-aea8-4b27-aad4-0380ec0519c9
parent 60a7464d
......@@ -86,7 +86,7 @@ include(AGAPROSearchInstalledSoftware)
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
#
MESSAGE("[AGAPRO] + ${PROJECT_NAME}")
MESSAGE("[AGAPRO]")
#
#---Set pathes where to put the libraries, executables and headers-----------
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
......@@ -109,10 +109,12 @@ list (APPEND AGAPRO_INCLUDE_DIRS ${ADF_INCLUDE_DIRS})
#----------------------------------------------------------------------------
# Add modules
#
ADD_DEFINITIONS(-DHAS_AGAPROCONFIG)
#
add_subdirectory(common)
#add_subdirectory(builders)
#add_subdirectory(consumers)
#add_subdirectory(producers)
#add_subdirectory(filters)
add_subdirectory(consumers)
add_subdirectory(producers)
add_subdirectory(filters)
......@@ -3,11 +3,17 @@
#cmakedefine HAS_BOOST
#cmakedefine HAS_SKSTREAM
#cmakedefine HAS_SSE
//////////////////////////////
////// Define OS_TYPE ////////
//////////////////////////////
#define OS_LINUX 1
#define OS_WINDOWS 2
#define OS_CYGWIN 3 // rather useless ==> to be removed ??
#define OS_APPLE 4
#define OS_TYPE @CMAKE_OS_TYPE@
/////////////////////////////////////////////////////
......
......@@ -5,7 +5,7 @@ cmake_minimum_required (VERSION 2.6)
#
project (common)
#
MESSAGE(" + ${PROJECT_NAME}")
MESSAGE("[AGAPRO] + ${PROJECT_NAME}")
#
# internal and external dependencies
#
......@@ -36,7 +36,6 @@ else()
endif()
#
#
ADD_DEFINITIONS(-DHAS_AGAPROCONFIG)
configure_file (
"${CMAKE_CURRENT_SOURCE_DIR}/AGAPROConfig.h.cmake"
"${CMAKE_BINARY_DIR}/include/AGAPROConfig.h"
......
......@@ -11,6 +11,10 @@
* make -p -f/dev/null
*/
///////////////// AUTOMATIC configuration through cmake. For a certain period, manual configuration is kept
#if HAS_AGAPROCONFIG
#include "AGAPROConfig.h" // defines for your system is set there by cmake
#else
//////////////////////////////
////// Define OS_TYPE ////////
//////////////////////////////
......@@ -66,6 +70,8 @@
#endif
#endif
#endif // if #AGAPROCONFIG
///////////////////////////////////////////////
//////// constants, macros, enums, ... ////////
///////////////////////////////////////////////
......@@ -122,7 +128,13 @@ const int defTriggerSample = 10; // 60-10=50 samples passed to the PSA
//////// PSAFilter ////////
///////////////////////////
#define PSA_THREADED // enable running the PSA algorithm in parallel threads; their actual number is given in the set-up (zero --> no threads)
#ifdef HAS_AGAPROCONFIG
#ifdef HAS_BOOST
#define PSA_THREADED // automatic / enable running the PSA algorithm in parallel threads; their actual number is given in the set-up (zero --> no threads)
#endif
#else
#define PSA_THREADED // manual / enable running the PSA algorithm in parallel threads; their actual number is given in the set-up (zero --> no threads)
#endif
#define PSA_MULTIHIST // enable MultiHist spectra
//#define PSA_FromGRU // enable GRU/ViGRU
......
......@@ -4,7 +4,7 @@ cmake_minimum_required (VERSION 2.6)
#
project (Basic)
#
MESSAGE(" + ${PROJECT_NAME}")
MESSAGE("[AGAPRO] + ${PROJECT_NAME}")
#
# internal and external dependencies
#
......
......@@ -3,7 +3,7 @@
project(consumers)
#
MESSAGE(" + ${PROJECT_NAME}")
MESSAGE("[AGAPRO] + ${PROJECT_NAME}")
add_subdirectory(Basic)
......@@ -4,7 +4,7 @@ cmake_minimum_required (VERSION 2.6)
#
project (ancillary)
#
MESSAGE(" + ${PROJECT_NAME}")
MESSAGE("[AGAPRO] + ${PROJECT_NAME}")
#
# internal and external dependencies
#
......
......@@ -3,9 +3,11 @@
project(filters)
MESSAGE(" + ${PROJECT_NAME}")
MESSAGE("[AGAPRO] + ${PROJECT_NAME}")
add_subdirectory(Preprocessing)
add_subdirectory(Tracking)
add_subdirectory(Ancillary)
add_subdirectory(PSA)
add_subdirectory(PostPSA)
add_subdirectory(Global)
# CMake for module of AGAPRO
# O. Stezowski
cmake_minimum_required (VERSION 2.6)
#
project (global)
#
MESSAGE("[AGAPRO] + ${PROJECT_NAME}")
#
# internal and external dependencies
#
set( EXTRA_INTERNAL_LIBRARIES AgataDPPCommon )
set( EXTRA_EXTERNAL_LIBRARIES ${ADF_LIBRARY} )
#
# headers / sources
file(GLOB headers ${PROJECT_SOURCE_DIR}/*.h)
file(GLOB sources ${PROJECT_SOURCE_DIR}/*.cpp)
# Remove if any
#if ( NOT DO_NARVAL_INTERFACE )
# list(REMOVE_ITEM sources ${PROJECT_SOURCE_DIR}/libPostPSAFilter.cpp)
#endif()
# add to includes
#
include_directories(${AGAPRO_INCLUDE_DIRS})
#----------------------------------------------------------------------------
#
add_library(GlobalFilter SHARED ${sources})
#
target_link_libraries(GlobalFilter ${EXTRA_EXTERNAL_LIBRARIES} ${EXTRA_INTERNAL_LIBRARIES})
#
set_target_properties(GlobalFilter PROPERTIES ${AGAPRO_LIBRARY_PROPERTIES})
#
install(TARGETS GlobalFilter RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
COMPONENT libraries)
install(FILES ${headers} DESTINATION include COMPONENT headers )
#
# copy headers file in a single directory
# because cmake2.6 does not provide COPY in file, do it another way
if( ${CMAKE_VERSION} VERSION_GREATER "2.8.0" )
file(COPY ${headers} DESTINATION ${CMAKE_BINARY_DIR}/include)
else()
if ( EXISTS ${CMAKE_BINARY_DIR}/include )
else()
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/include/ )
endif()
foreach ( f ${headers} )
execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${f} ${CMAKE_BINARY_DIR}/include/ )
endforeach()
endif()
......@@ -4,7 +4,7 @@ cmake_minimum_required (VERSION 2.6)
#
project (psa)
#
MESSAGE(" + ${PROJECT_NAME}")
MESSAGE("[AGAPRO] + ${PROJECT_NAME}")
#
# internal and external dependencies
#
......
......@@ -52,7 +52,13 @@ const float MAXNORM = 1000.f; // normalization of the signal basis
// We should check this in PSAFilterGridSearch or, maybe, go back to the formulation by
// Roberto Venturelli where the experimental signal is rescaled event-by-event to MAXNORM.
#ifdef HAS_AGAPROCONFIG
#ifdef HAS_SSE
#define USE_SSE_VERSION // automatic through cmake
#endif
#else
#define USE_SSE_VERSION // uncomment to use SSE intrinsics for the innermost figure-of-merit loop
#endif
// the vectorized version only for the standard values .._MODULO, .._SQUARE, .._1SQRT, .._2SQRT
#if defined(USE_SSE_VERSION)
......
# CMake for module of AGAPRO
# O. Stezowski
cmake_minimum_required (VERSION 2.6)
#
project (postpsa)
#
MESSAGE("[AGAPRO] + ${PROJECT_NAME}")
#
# internal and external dependencies
#
set( EXTRA_INTERNAL_LIBRARIES AgataDPPCommon )
set( EXTRA_EXTERNAL_LIBRARIES ${ADF_LIBRARY} )
#
# headers / sources
file(GLOB headers ${PROJECT_SOURCE_DIR}/*.h)
file(GLOB sources ${PROJECT_SOURCE_DIR}/*.cpp)
# Remove if any
if ( NOT DO_NARVAL_INTERFACE )
list(REMOVE_ITEM sources ${PROJECT_SOURCE_DIR}/libPostPSAFilter.cpp)
endif()
# add to includes
#
include_directories(${AGAPRO_INCLUDE_DIRS})
#----------------------------------------------------------------------------
#
add_library(PostPSAFilter SHARED ${sources})
#
target_link_libraries(PostPSAFilter ${EXTRA_EXTERNAL_LIBRARIES} ${EXTRA_INTERNAL_LIBRARIES})
#
set_target_properties(PostPSAFilter PROPERTIES ${AGAPRO_LIBRARY_PROPERTIES})
#
install(TARGETS PostPSAFilter RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
COMPONENT libraries)
install(FILES ${headers} DESTINATION include COMPONENT headers )
#
# copy headers file in a single directory
# because cmake2.6 does not provide COPY in file, do it another way
if( ${CMAKE_VERSION} VERSION_GREATER "2.8.0" )
file(COPY ${headers} DESTINATION ${CMAKE_BINARY_DIR}/include)
else()
if ( EXISTS ${CMAKE_BINARY_DIR}/include )
else()
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/include/ )
endif()
foreach ( f ${headers} )
execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${f} ${CMAKE_BINARY_DIR}/include/ )
endforeach()
endif()
......@@ -4,7 +4,7 @@ cmake_minimum_required (VERSION 2.6)
#
project (preprocessing)
#
MESSAGE(" + ${PROJECT_NAME}")
MESSAGE("[AGAPRO] + ${PROJECT_NAME}")
#
# internal and external dependencies
#
......
......@@ -4,7 +4,7 @@ cmake_minimum_required (VERSION 2.6)
#
project (Tracking)
#
MESSAGE(" + ${PROJECT_NAME}")
MESSAGE("[AGAPRO] + ${PROJECT_NAME}")
#
# internal and external dependencies
#
......
......@@ -14,7 +14,12 @@ extern "C" {
int mgt_initialize(double chiLimit, char* summary);
void mgt_process_event(MgtStruct *mydata, unsigned int *error_code);
}
#else // *.c stuff compiled using C++
#elif OS_TYPE == OS_APPLE
extern "C" {
int mgt_initialize(double chiLimit, char* summary);
void mgt_process_event(MgtStruct *mydata, unsigned int *error_code);
}
#else // *.c stuff compiled using C++
void mgt_process_event(MgtStruct *mydata, unsigned int *error_code);
int mgt_initialize(double chiLimit, char* summary);
#endif
......
......@@ -9,12 +9,17 @@
using namespace std;
using namespace ADF;
#ifdef _MSC_VER // *.c stuff compiled using C
#ifdef _MSC_VER // *.c stuff compiled using C
extern "C" {
void process_event(OftStruct *mydata, unsigned int *error_code);
void initialize_oft(double probLimit);
}
#else // *.c stuff compiled using C++
#elif OS_TYPE == OS_APPLE
extern "C" {
void process_event(OftStruct *mydata, unsigned int *error_code);
void initialize_oft(double probLimit);
}
#else // *.c stuff compiled using C++
void process_event(OftStruct *mydata, unsigned int *error_code);
void initialize_oft(double probLimit);
#endif
......
......@@ -26,7 +26,7 @@ std::string AncillaryProducerTCP::gConfPath;
using namespace std;
#if NRV_TYPE != NRV_ONLINE
#if NRV_TYPE != NRV_ONLINE && OS_TYPE != OS_APPLE
extern
#endif
unsigned int library_timeout;
......
......@@ -161,7 +161,7 @@ private:
// Returns pointers to next event, reading new buffers if needed
bool read_event(uint32_t *error_code);
#if NRV_TYPE != NRV_ONLINE
#if NRV_TYPE != NRV_ONLINE && OS_TYPE != OS_APPLE
uint32_t htonl(uint32_t iv) {
uint32_t ov = (iv&0xFF000000) >> 24 |
(iv&0x00FF0000) >> 8 |
......
......@@ -4,7 +4,7 @@ cmake_minimum_required (VERSION 2.6)
#
project (AncillaryTCP)
#
MESSAGE(" + ${PROJECT_NAME}")
MESSAGE("[AGAPRO] + ${PROJECT_NAME}")
#
# internal and external dependencies
#
......
......@@ -4,7 +4,7 @@ cmake_minimum_required (VERSION 2.6)
#
project (Basic)
#
MESSAGE(" + ${PROJECT_NAME}")
MESSAGE("[AGAPRO] + ${PROJECT_NAME}")
#
# internal and external dependencies
#
......
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