diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e5be0388d8b6f4e704a2712dc1bba899326b22b..92d00bd940c838c2fa65c587e5070e0f3d761767 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,15 +5,18 @@ SET( ${PROJECT_NAME}_MAJOR_VERSION 0 ) SET( ${PROJECT_NAME}_MINOR_VERSION 1 ) SET( ${PROJECT_NAME}_PATCH_LEVEL 0 ) -add_definitions(-DBOOST_ALL_DYN_LINK) +IF( NOT BUILD_FORCE_STATIC) + add_definitions(-DBOOST_ALL_DYN_LINK) +ENDIF() + add_definitions(-DDEBUG) OPTION( BUILD_FORCE_32 "Force 32 bit compilation" OFF ) EXECUTE_PROCESS(COMMAND chaos/common/version.sh) -INCLUDE_DIRECTORIES(. ${PROJECT_SOURCE_DIR}/usr/local/include /usr/local/include /usr/include) -LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/usr/local/lib /usr/local/lib /usr/lib) +INCLUDE_DIRECTORIES(. ${CMAKE_INSTALL_PREFIX}/include /usr/local/include) +LINK_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/lib /usr/local/lib) ADD_DEFINITIONS(-O3 ) IF( BUILD_FORCE_32 ) @@ -48,8 +51,6 @@ ADD_SUBDIRECTORY(ChaosDataService bin/bin_cds) message(STATUS "Configure Chaos Data Export") ADD_SUBDIRECTORY(ChaosDataExport bin/chaos_cde) -message(STATUS "Configure Chaos Snapshot Utility") -ADD_SUBDIRECTORY(ChaosSnapshotUtility bin/chaos_snap_util) message(STATUS "Configure Chaos CLI") ADD_SUBDIRECTORY(example/ChaosCLI bin/chaos_cli) @@ -66,5 +67,8 @@ ADD_SUBDIRECTORY(example/ChaosPerformanceTester bin/ChaosPerformanceTester) message(STATUS "Configure ChaosMemCacheTest test excutable") ADD_SUBDIRECTORY(test/MemcachedEmbeddedTest bin/cache_test) +message(STATUS "Configure Chaos Snapshot Utility") +ADD_SUBDIRECTORY(ChaosSnapshotUtility bin/chaos_snap_util) + #message(STATUS "Configure Plugin Test") #ADD_SUBDIRECTORY(test/PluginTest bin/plugin_test) diff --git a/bootstrap.sh b/bootstrap.sh index 191574b97a643b0eee0397858ff2169edccf3846..6ed14919d829066fb1a1966c0982c98176e5f177 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -88,6 +88,7 @@ if [ -n "$CHAOS_CROSS_HOST" ]; then fi do_make() { + echo "* make $1 with "$NPROC" processors" if [ -n "$CHAOS_DEVELOPMENT" ]; then if !(make -j$NPROC VERBOSE=1); then echo "## error compiling $1 in VERBOSE" @@ -207,16 +208,8 @@ if [ ! -d "$PREFIX/include/boost" ]; then cd $BASE_EXTERNAL/boost echo "Compile and install boost libraries into $PREFIX/" - if [ -n "$CHAOS32" ]; then - echo "INSTALLING BOOST 32" - ./b2 link=shared cflags=-m32 cxxflags=-m32 address-model=32 --prefix=$PREFIX --with-iostreams --with-program_options --with-chrono --with-random --with-filesystem --with-log --with-regex --with-system --with-thread --with-atomic --with-timer install - else - if [ `echo $OS | tr [:upper:] [:lower:]` = `echo "Darwin" | tr [:upper:] [:lower:]` ] && [ $KERNEL_SHORT_VER -ge 1300 ]; then - ./b2 toolset=clang cxxflags=-stdlib=libstdc++ linkflags=-stdlib=libstdc++ link=shared --prefix=$PREFIX --with-program_options --with-random --with-chrono --with-filesystem --with-iostreams --with-log --with-regex --with-system --with-thread --with-atomic --with-timer install - else - ./b2 link=shared --prefix=$PREFIX --with-program_options --with-chrono --with-filesystem --with-iostreams --with-log --with-regex --with-random --with-system --with-thread --with-atomic --with-timer install - fi - fi + ./b2 $CHAOS_BOOST_FLAGS -j $NPROC + else echo "Boost Already present" fi @@ -236,8 +229,11 @@ if [ ! -d "$PREFIX/include/modbus" ] || [ ! -d "$BASE_EXTERNAL/libmodbus" ]; the fi ./autogen.sh - ./configure --prefix=$PREFIX $CROSS_HOST_CONFIGURE - + if [ -n "$CHAOS_STATIC" ]; then + ./configure --enable-static --prefix=$PREFIX $CROSS_HOST_CONFIGURE + else + ./configure --enable-shared --prefix=$PREFIX $CROSS_HOST_CONFIGURE + fi make clean do_make "MODBUS" @@ -393,9 +389,9 @@ cmake $CHAOS_CMAKE_FLAGS . do_make "!CHAOS" -if [ -n "$CHAOS_DEVELOPMENT" ]; then - echo "Remove the installed header" - rm -rf $CHAOS_DIR/usr/local/include/chaos - echo "Link !CHAOS source root directory for include because we are in development mode" - ln -sf $CHAOS_DIR/chaos $CHAOS_DIR/usr/local/include/chaos -fi +# if [ -n "$CHAOS_DEVELOPMENT" ]; then +# echo "Remove the installed header" +# rm -rf $CHAOS_DIR/usr/local/include/chaos +# echo "Link !CHAOS source root directory for include because we are in development mode" +# ln -sf $CHAOS_DIR/chaos $CHAOS_DIR/usr/local/include/chaos +# fi diff --git a/chaos/common/CMakeLists.txt b/chaos/common/CMakeLists.txt index b0c7b02ac706f1b23d4aebce3ea4e71df0aa6e7b..61c3cf3667f7124fa64f2c8e550309c4c383d90e 100644 --- a/chaos/common/CMakeLists.txt +++ b/chaos/common/CMakeLists.txt @@ -62,7 +62,13 @@ SET(common_lib_src ${common_lib_src} batch_command/BatchCommandExecutor.cpp bat SET(common_lib_library $ENV{CHAOS_LINK_LIBRARY}) separate_arguments(common_lib_library) +IF(BUILD_FORCE_STATIC) +ADD_LIBRARY(chaos_common STATIC ${common_lib_src}) +ELSE() ADD_LIBRARY(chaos_common SHARED ${common_lib_src}) +ENDIF() + +#SET_TARGET_PROPERTIES(chaos_common_static PROPERTIES OUTPUT_NAME chaos_common) #set_target_properties(chaos_common PROPERTIES VERSION 1.0.0 SOVERSION 1) @@ -73,6 +79,8 @@ FILE(GLOB files "*.h") INSTALL(FILES ${files} DESTINATION include/chaos/common) FILE(GLOB files "async_central/*.h") INSTALL(FILES ${files} DESTINATION include/chaos/common/async_central) +FILE(GLOB files "batch_command/*.h") +INSTALL(FILES ${files} DESTINATION include/chaos/common/batch_command) FILE(GLOB files "plugin/*.h") INSTALL(FILES ${files} DESTINATION include/chaos/common/plugin) FILE(GLOB files "action/*.h") @@ -121,16 +129,27 @@ FILE(GLOB files "io/*.h") INSTALL(FILES ${files} DESTINATION include/chaos/common/io) FILE(GLOB files "direct_io/*.h") INSTALL(FILES ${files} DESTINATION include/chaos/common/direct_io) + +FILE(GLOB files "direct_io/channel/*.h") +INSTALL(FILES ${files} DESTINATION include/chaos/common/direct_io/channel) + +FILE(GLOB files "direct_io/impl/*.h") +INSTALL(FILES ${files} DESTINATION include/chaos/common/direct_io/impl) + FILE(GLOB files "message/*.h") INSTALL(FILES ${files} DESTINATION include/chaos/common/message) FILE(GLOB files "pool/*.h") INSTALL(FILES ${files} DESTINATION include/chaos/common/pool) FILE(GLOB files "pqueue/*.h") INSTALL(FILES ${files} DESTINATION include/chaos/common/pqueue) -FILE(GLOB files "rpc/*.h") -INSTALL(FILES ${files} DESTINATION include/chaos/common/rpc) FILE(GLOB files "network/*.h") INSTALL(FILES ${files} DESTINATION include/chaos/common/network) + +FILE(GLOB files "rpc/*.h") +INSTALL(FILES ${files} DESTINATION include/chaos/common/rpc) +FILE(GLOB files "rpc/zmq/*.h") +INSTALL(FILES ${files} DESTINATION include/chaos/common/rpc/zmq) + FILE(GLOB files "thread/*.h") INSTALL(FILES ${files} DESTINATION include/chaos/common/thread) FILE(GLOB files "utility/*.h") @@ -156,3 +175,7 @@ INSTALL(FILES ${files} DESTINATION include/chaos/common/caching_system/common_bu INSTALL(TARGETS chaos_common DESTINATION "lib" PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) + +# INSTALL(TARGETS chaos_common_static +# DESTINATION "lib" +# PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) diff --git a/chaos/common/bson/util/concurrency/mutex.h b/chaos/common/bson/util/concurrency/mutex.h index 976da2079820ee3f54c547fe50650c06bf461a3b..c6684a0029b0e0c3e4e95819fbc5b8d1ace5f947 100644 --- a/chaos/common/bson/util/concurrency/mutex.h +++ b/chaos/common/bson/util/concurrency/mutex.h @@ -18,7 +18,7 @@ #pragma once #ifdef _WIN32 -#include <chaos/common/bson/platform/windows_basic.h" +#include <chaos/common/bson/platform/windows_basic.h> #endif #include <boost/noncopyable.hpp> diff --git a/chaos/common/version.sh b/chaos/common/version.sh index 7c9ec118044173b1ebfb6db1ca3f0253d6443997..a5cbf893161e443ab3ec52b127ebed2eb81b54ae 100755 --- a/chaos/common/version.sh +++ b/chaos/common/version.sh @@ -2,20 +2,27 @@ BASEDIR=$(dirname $0) +git log -n 1 --pretty="format:#define CSLIB_VERSION_HEADER \"!CHAOS Library Developed By Claudio Bisegni\"%n#define CSLIB_VERSION_NUMBER \"Version:%h\"%n" > $BASEDIR/curr_version.h + +if diff $BASEDIR/curr_version.h $BASEDIR/version.h> /dev/null 2>&1; then + echo "* no version changes detected"; + exit 0; +else + cp $BASEDIR/curr_version.h $BASEDIR/version.h; +fi #check if we are using the script into xcode or no (in xcode the ssty give an error) if [ ! -n $XCODE_PRODUCT_BUILD_VERSION ]; then - git log -n 1 --pretty="format:#define CSLIB_VERSION_HEADER \"!CHAOS Library Developed By Claudio Bisegni\"%n#define CSLIB_VERSION_NUMBER \"Version:%h\"%n" > /tmp/version.h - stty -echo + git log -n 1 --pretty="format:#define CSLIB_VERSION_HEADER \"!CHAOS Library Developed By Claudio Bisegni\"%n#define CSLIB_VERSION_NUMBER \"Version:%h\"%n" > /tmp/version.h + stty -echo - if ! diff /tmp/version.h $BASEDIR/version.h>/dev/null; then - stty echo - echo "Writing version header file" $BASEDIR - cp /tmp/version.h $BASEDIR/version.h - fi - rm /tmp/version.h + if ! diff /tmp/version.h $BASEDIR/version.h>/dev/null; then stty echo + echo "Writing version header file" $BASEDIR + cp /tmp/version.h $BASEDIR/version.h + fi + rm /tmp/version.h + stty echo else - git log -n 1 --pretty="format:#define CSLIB_VERSION_HEADER \"!CHAOS Library Developed By Claudio Bisegni\"%n#define CSLIB_VERSION_NUMBER \"Version:%h\"%n" > $BASEDIR/version.h - -fi \ No newline at end of file + git log -n 1 --pretty="format:#define CSLIB_VERSION_HEADER \"!CHAOS Library Developed By Claudio Bisegni\"%n#define CSLIB_VERSION_NUMBER \"Version:%h\"%n" > $BASEDIR/version.h +fi diff --git a/chaos/cu_toolkit/CMakeLists.txt b/chaos/cu_toolkit/CMakeLists.txt index 5f215404d20a6ba4014c3458250a0870ce69efce..540d806d8134a620a99df2915450c675f7375da2 100644 --- a/chaos/cu_toolkit/CMakeLists.txt +++ b/chaos/cu_toolkit/CMakeLists.txt @@ -6,9 +6,13 @@ SET(cu_lib_src ${cu_lib_src} ControlManager/SCAbstractControlUnit.cpp ControlMa SET(cu_lib_src ${cu_lib_src} ControlManager/slow_command/SlowCommandExecutor.cpp ControlManager/slow_command/SlowCommand.cpp ControlManager/slow_command/command/SetAttributeCommand.cpp ControlManager/AttributeSharedCacheWrapper.cpp) - +IF(BUILD_FORCE_STATIC) +ADD_LIBRARY(chaos_cutoolkit STATIC ${cu_lib_src}) +ELSE() ADD_LIBRARY(chaos_cutoolkit SHARED ${cu_lib_src}) +ENDIF() +#SET_TARGET_PROPERTIES(chaos_cutoolkit_static PROPERTIES OUTPUT_NAME chaos_cutoolkit) #set_target_properties(chaos_cutoolkit PROPERTIES VERSION 1.0.0 SOVERSION 1) SET(chaos_cutoolkit_lib $ENV{CHAOS_LINK_LIBRARY}) @@ -51,3 +55,7 @@ INSTALL(TARGETS chaos_cutoolkit DESTINATION "lib" PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) +# INSTALL(TARGETS chaos_cutoolkit_static +# DESTINATION "lib" +# PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) + diff --git a/chaos/ui_toolkit/CMakeLists.txt b/chaos/ui_toolkit/CMakeLists.txt index f1f25117288c49f264e5119bb14266a9e76bbf3e..3af4324346702abfd8c345c3bab2dccf2bf1cf05 100644 --- a/chaos/ui_toolkit/CMakeLists.txt +++ b/chaos/ui_toolkit/CMakeLists.txt @@ -2,8 +2,13 @@ SET(ui_lib_src ChaosUIToolkit.cpp ChaosUIToolkitCWrapper.cc HighLevelApi/DeviceController.cpp HighLevelApi/HLDataApi.cpp HighLevelApi/HLInfrastructureApi.cpp LowLevelApi/LLDataApi.cpp LowLevelApi/LLRpcApi.cpp) +IF(BUILD_FORCE_STATIC) +ADD_LIBRARY(chaos_uitoolkit STATIC ${ui_lib_src}) +ELSE() ADD_LIBRARY(chaos_uitoolkit SHARED ${ui_lib_src}) -#set_target_properties(chaos_uitoolkit PROPERTIES VERSION 1.0.0 SOVERSION 1) +ENDIF() +#set_target_properties(chaos_uitoolkit_static PROPERTIES output_name chaos_uitoolkit) + SET(chaos_uitoolkit_lib $ENV{CHAOS_LINK_LIBRARY}) separate_arguments(chaos_uitoolkit_lib) @@ -25,4 +30,7 @@ INSTALL(FILES ${files} DESTINATION include/chaos/ui_toolkit/LowLevelApi) INSTALL(TARGETS chaos_uitoolkit DESTINATION "lib" - PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) \ No newline at end of file + PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) +# INSTALL(TARGETS chaos_uitoolkit_static +# DESTINATION "lib" +# PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) \ No newline at end of file