Commit 472c23a9 authored by Nicolas Van der Noot's avatar Nicolas Van der Noot
Browse files

make dynamic

parent 59bcc85e
......@@ -30,9 +30,9 @@ message(STATUS "Processing ${PROJECT_NAME}")
# for Unix: display all the warnings, except the ones related to /* -- */ and for the unused variables
if (UNIX)
set( CMAKE_C_FLAGS "-g -Wall -Wno-unused-but-set-variable -Wno-unused-variable -Wno-comment" )
# remove some compilation warnings (This line should be removed once the loading, equil and modal modules are stabilized)
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-uninitialized -Wno-unused-result -Wno-maybe-uninitialized" )
set( CMAKE_C_FLAGS "-g -Wall -Wno-unused-but-set-variable -Wno-unused-variable -Wno-comment" )
# remove some compilation warnings (This line should be removed once the loading, equil and modal modules are stabilized)
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-uninitialized -Wno-unused-result -Wno-maybe-uninitialized" )
endif ( )
......@@ -51,7 +51,7 @@ add_subdirectory ( ${CMAKE_AUX}/make_opt/ ${CMAKE_AUX_BIN}/make_opt/ )
# MBsysC files to compile
if (NOT FLAG_SEPARATE_BUILD)
add_subdirectory( ${ROBOTRAN_SOURCE_DIR}/mbs_common ${CMAKE_CURRENT_BINARY_DIR}/mbs_common )
add_subdirectory( ${ROBOTRAN_SOURCE_DIR}/mbs_common ${CMAKE_CURRENT_BINARY_DIR}/mbs_common )
endif ( )
# make options
......@@ -76,8 +76,8 @@ definitions()
# configure a header file to pass some of the CMake settings to the source code
configure_file (
"${ROBOTRAN_SOURCE_DIR}/conf/cmake_config.h.in"
"${PROJECT_BINARY_DIR}/conf/cmake_config.h"
"${ROBOTRAN_SOURCE_DIR}/conf/cmake_config.h.in"
"${PROJECT_BINARY_DIR}/conf/cmake_config.h"
)
# 'cmake_config.h.in' is in the 'conf' folder
include_directories (${PROJECT_BINARY_DIR}/conf)
......@@ -111,9 +111,9 @@ increment_include( ${ROBOTRAN_SOURCE_DIR} )
## --- WIN32 or WIN64 DETECTION --- ##
if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) # 64bit Windows
SET(WIN_LIB_DIRECTORY win64_include_lib)
SET(WIN_LIB_DIRECTORY win64_include_lib)
else( ) # 32bit Windows
SET(WIN_LIB_DIRECTORY win32_include_lib)
SET(WIN_LIB_DIRECTORY win32_include_lib)
endif( )
## ---- WINDOWS DLL FILES ---- ##
......@@ -121,8 +121,8 @@ endif( )
# copy all the dll (except 'jvm.dll') used for Windows
# these dll files are copied in the Executable directory (Debug or Release)
if (WIN32)
file(COPY ${ROBOTRAN_SOURCE_DIR}/${WIN_LIB_DIRECTORY}/dll/ DESTINATION ${CMAKE_BINARY_DIR}/Debug)
file(COPY ${ROBOTRAN_SOURCE_DIR}/${WIN_LIB_DIRECTORY}/dll/ DESTINATION ${CMAKE_BINARY_DIR}/Release)
file(COPY ${ROBOTRAN_SOURCE_DIR}/${WIN_LIB_DIRECTORY}/dll/ DESTINATION ${CMAKE_BINARY_DIR}/Debug)
file(COPY ${ROBOTRAN_SOURCE_DIR}/${WIN_LIB_DIRECTORY}/dll/ DESTINATION ${CMAKE_BINARY_DIR}/Release)
endif ( )
set(CMAKE_MODULE_PATH ${ROBOTRAN_SOURCE_DIR}/conf)
......@@ -148,36 +148,36 @@ add_executable ( ${Executable} ${SOURCE_FILES} )
if (FLAG_SEPARATE_BUILD) # find MBSysC dynamic libraries
find_package( LibRobotranC REQUIRED )
target_link_libraries( ${Executable} ${LIB_MBSYSC_MODULES} ${LIB_MBSYSC_LOAD} ${LIB_MBSYSC_UTILITIES} )
find_package( LibRobotranC REQUIRED )
target_link_libraries( ${Executable} ${LIB_MBSYSC_MODULES} ${LIB_MBSYSC_LOAD} ${LIB_MBSYSC_UTILITIES} )
else ( )
target_link_libraries( ${Executable} MBsysC_loadXML MBsysC_module )
if (NOT FLAG_SHARED_LIB)
# find MBSysC static libraries
target_link_libraries( ${Executable} MBsysC_struct MBsysC_numerics MBsysC_realtime MBsysC_utilities )
#Libxml2 and GSL external libraries
target_link_libraries ( ${Executable} ${LIBXML2_LIBRARIES} ${GSL_LIBRARIES} )
# SDL external library
if (FLAG_PLOT)
target_link_libraries ( ${Executable} ${SDL2_LIBRARIES} ${SDL2TTF_LIBRARIES} )
endif ( )
# Java external library
if (FLAG_VISU)
target_link_libraries ( ${Executable} ${JNI_LIBRARIES} )
endif ( )
endif ( )
target_link_libraries( ${Executable} MBsysC_loadXML MBsysC_module )
if (NOT FLAG_SHARED_LIB)
# find MBSysC static libraries
target_link_libraries( ${Executable} MBsysC_struct MBsysC_numerics MBsysC_realtime MBsysC_utilities )
#Libxml2 and GSL external libraries
target_link_libraries ( ${Executable} ${LIBXML2_LIBRARIES} ${GSL_LIBRARIES} )
# SDL external library
if (FLAG_PLOT)
target_link_libraries ( ${Executable} ${SDL2_LIBRARIES} ${SDL2TTF_LIBRARIES} )
endif ( )
# Java external library
if (FLAG_VISU)
target_link_libraries ( ${Executable} ${JNI_LIBRARIES} )
endif ( )
endif ( )
endif ( )
# math external library (for Unix)
if (UNIX)
target_link_libraries ( ${Executable} m )
target_link_libraries ( ${Executable} m )
endif ( )
......@@ -50,9 +50,13 @@ endfunction()
function(flags_check)
if (NOT FLAG_REAL_TIME)
set(FLAG_PLOT OFF PARENT_SCOPE)
set(FLAG_VISU OFF PARENT_SCOPE)
set( FLAG_PLOT OFF PARENT_SCOPE )
set( FLAG_VISU OFF PARENT_SCOPE )
endif( )
if (FLAG_SEPARATE_BUILD)
set ( FLAG_SHARED_LIB ON PARENT_SCOPE )
endif ( )
endfunction()
......
......@@ -8,12 +8,32 @@
# Make options
function(make_options)
set( SCRIPTS_PATH ${ROBOTRAN_SOURCE_DIR}/cmake_aux/scripts )
if (UNIX)
add_custom_target(separate_build COMMAND ${CMAKE_COMMAND} -P ${SCRIPTS_PATH}/separate_build_options )
set( SCRIPTS_PATH ${ROBOTRAN_SOURCE_DIR}/cmake_aux/scripts )
add_custom_target(dyn_basic COMMAND ${CMAKE_COMMAND} -P ${SCRIPTS_PATH}/separate_build_basic ${ROBOTRAN_SOURCE_DIR} )
# scripts executable
execute_process(COMMAND chmod +x ${SCRIPTS_PATH}/dyn_build)
# dyn_options (options listing with an example of cmake script)
add_custom_target(dyn_options COMMAND ${CMAKE_COMMAND} -P ${SCRIPTS_PATH}/dyn_options )
# dyn_basic (SHARED_LIB, SEPARATE_BUILD, RELEASE, REAL_TIME, PLOT, VISU)
add_custom_target(dyn_basic COMMAND ${CMAKE_COMMAND} -E chdir ${SCRIPTS_PATH} ./dyn_build ${ROBOTRAN_SOURCE_DIR} ON ON ON OFF OFF OFF)
# dyn_plot (SHARED_LIB, SEPARATE_BUILD, RELEASE, REAL_TIME, PLOT, VISU)
add_custom_target(dyn_plot COMMAND ${CMAKE_COMMAND} -E chdir ${SCRIPTS_PATH} ./dyn_build ${ROBOTRAN_SOURCE_DIR} ON ON ON ON ON OFF)
# dyn_visu (SHARED_LIB, SEPARATE_BUILD, RELEASE, REAL_TIME, PLOT, VISU)
add_custom_target(dyn_visu COMMAND ${CMAKE_COMMAND} -E chdir ${SCRIPTS_PATH} ./dyn_build ${ROBOTRAN_SOURCE_DIR} ON ON ON ON OFF ON)
# dyn_realtime (SHARED_LIB, SEPARATE_BUILD, RELEASE, REAL_TIME, PLOT, VISU)
add_custom_target(dyn_realtime COMMAND ${CMAKE_COMMAND} -E chdir ${SCRIPTS_PATH} ./dyn_build ${ROBOTRAN_SOURCE_DIR} ON ON ON ON ON ON)
# dyn_clean (SHARED_LIB, SEPARATE_BUILD, RELEASE, REAL_TIME, PLOT, VISU)
add_custom_target(dyn_clean COMMAND ${CMAKE_COMMAND} -E chdir ${SCRIPTS_PATH} ./dyn_build ${ROBOTRAN_SOURCE_DIR})
endif ( )
endfunction()
# ${PROJECT_SOURCE_DIR} ${ROBOTRAN_SOURCE_DIR}
#
# Author: Nicolas Van der Noot
# September 2015
#
# Separate build: basic compilation options
#
if [ $# = 7 ]
then
echo "\n Dynamic libraries creation \n"
else
echo "\n Dynamic libraries cleaning \n"
rm -r $1/build/
exit
fi
# create empty directory
rm -r $1/build/
mkdir $1/build/
# generate CMake project
cd $1/build/
cmake $1/mbs_common -DFLAG_SHARED_LIB=$2 -DFLAG_SEPARATE_BUILD=$3 -DFLAG_RELEASE=$4 -DFLAG_REAL_TIME=$5 -DFLAG_PLOT=$6 -DFLAG_VISU=$7
# messages
echo "\n Dynamic libraries configured in: "
echo " $1build"
echo " with the following options:"
echo " FLAG_SHARED_LIB : $2"
echo " FLAG_SEPARATE_BUILD : $3"
echo " FLAG_RELEASE : $4"
echo " FLAG_REAL_TIME : $5"
echo " FLAG_PLOT : $6"
echo " FLAG_VISU : $7\n"
make
echo "\n Dynamic libraries created in: "
echo " $1build \n"
......@@ -12,4 +12,5 @@ message(" * make dyn_basic -> basic compilation options")
message(" * make dyn_plot -> real-time graphs available")
message(" * make dyn_visu -> real-time visualization availbale")
message(" * make dyn_realtime -> all real-time features available")
message(" * make dyn_clean -> clean dynamic libraries")
message("")
#
# Author: Nicolas Van der Noot
# September 2015
#
# Separate build: basic compilation options
#
# MBsysC files
set ( MBSYSC_DIR ${CMAKE_ARGV3} )
# remove possible directory
file( REMOVE_RECURSE ${MBSYSC_DIR}/build )
# create empty build folder
file( MAKE_DIRECTORY ${MBSYSC_DIR}/build )
Supports Markdown
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