Skip to content
Snippets Groups Projects
Commit 59abe443 authored by Andrea Michelotti's avatar Andrea Michelotti
Browse files

restructuring compilation, enable static target

parent 69b6feab
No related branches found
No related tags found
No related merge requests found
......@@ -5,15 +5,18 @@ SET( ${PROJECT_NAME}_MAJOR_VERSION 0 )
SET( ${PROJECT_NAME}_MINOR_VERSION 1 )
SET( ${PROJECT_NAME}_PATCH_LEVEL 0 )
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)
......@@ -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
......@@ -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)
......@@ -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>
......
......@@ -2,6 +2,14 @@
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
......@@ -17,5 +25,4 @@ if [ ! -n $XCODE_PRODUCT_BUILD_VERSION ]; then
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
......@@ -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)
......@@ -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)
......@@ -26,3 +31,6 @@ INSTALL(FILES ${files} DESTINATION include/chaos/ui_toolkit/LowLevelApi)
INSTALL(TARGETS chaos_uitoolkit
DESTINATION "lib"
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment