From ce0cdc9636343c003599790c707fd5746217caf2 Mon Sep 17 00:00:00 2001 From: Alex Lin Date: Tue, 19 Nov 2019 09:01:16 -0600 Subject: [PATCH] Cmake merge (#901) * Merging changes from cmake branch to master * Fixing includes for renamed header files * still need build rule * Adding warning for swig code for gcc8+ * Adding CMakeLists.txt for data products * Cmake merge #901 Making adjustments to get cmake working on the Mac (Mojave) * Cmake merge #901 Changing string append to list append --- .gitignore | 4 +- CMakeLists.txt | 389 +++++++++++++++++ CMakeModules/FindLLVM.cmake | 193 +++++++++ CMakeModules/FindTee.cmake | 19 + CMakeModules/FindUDUNITS2.cmake | 92 ++++ include/trick/ABM_Integrator.hh | 2 +- include/trick/Euler_Cromer_Integrator.hh | 2 +- include/trick/Euler_Integrator.hh | 2 +- include/trick/MM4_Integrator.hh | 2 +- include/trick/NL2_Integrator.hh | 2 +- include/trick/RK2_Integrator.hh | 2 +- include/trick/RK4_Integrator.hh | 2 +- include/trick/RKF45_Integrator.hh | 2 +- include/trick/RKF78_Integrator.hh | 2 +- include/trick/RKG4_Integrator.hh | 2 +- libexec/trick/make_makefile_swig | 3 + libexec/trick/pm/gte.pm | 4 +- share/trick/makefiles/Makefile.common | 17 + share/trick/makefiles/Makefile.tricklib | 12 +- share/trick/makefiles/config_user_cmake.mk.in | 49 +++ .../codegen/Interface_Code_Gen/CMakeLists.txt | 49 +++ .../Interface_Code_Gen/HeaderSearchDirs.cpp | 2 + .../Interface_Code_Gen/PrintAttributes.cpp | 4 + trick_source/data_products/CMakeLists.txt | 11 + .../DPX/APPS/FXPLOT/CMakeLists.txt | 23 + .../DPX/APPS/GXPLOT/CMakeLists.txt | 22 + trick_source/data_products/DPX/CMakeLists.txt | 8 + .../data_products/DPX/DPC/CMakeLists.txt | 20 + .../data_products/DPX/DPM/CMakeLists.txt | 27 ++ .../DPX/DPV/UTILS/CMakeLists.txt | 7 + .../data_products/EQParse/CMakeLists.txt | 19 + trick_source/data_products/Log/CMakeLists.txt | 24 ++ trick_source/data_products/Var/CMakeLists.txt | 1 + .../data_products/units/CMakeLists.txt | 10 + trick_source/er7_utils/CMakeLists.txt | 72 ++++ .../er7_utils/trick/include/files_to_ICG.hh | 4 +- ...hh => trick_first_order_ode_integrator.hh} | 0 ...h => trick_second_order_ode_integrator.hh} | 0 trick_source/java/src/CMakeLists.txt | 408 ++++++++++++++++++ trick_source/sim_services/CMakeLists.txt | 246 +++++++++++ .../CheckPointAgent/input_parser.l | 2 +- .../CheckPointAgent/input_parser.y | 2 +- .../InputProcessor/CMakeLists.txt | 13 + .../sim_services/Integrator/Makefile_deps | 40 +- .../sim_services/MemoryManager/CMakeLists.txt | 81 ++++ .../sim_services/MemoryManager/adef_parser.l | 2 +- .../sim_services/MemoryManager/adef_parser.y | 2 +- .../sim_services/MemoryManager/ref_parser.l | 2 +- .../sim_services/MemoryManager/ref_parser.y | 2 +- trick_source/trick_swig/sim_services.i | 4 +- trick_source/trick_utils/CMakeLists.txt | 28 ++ trick_source/trick_utils/comm/CMakeLists.txt | 31 ++ trick_source/trick_utils/math/CMakeLists.txt | 92 ++++ trick_source/trick_utils/units/CMakeLists.txt | 9 + 54 files changed, 2019 insertions(+), 50 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 CMakeModules/FindLLVM.cmake create mode 100644 CMakeModules/FindTee.cmake create mode 100644 CMakeModules/FindUDUNITS2.cmake create mode 100644 share/trick/makefiles/config_user_cmake.mk.in create mode 100644 trick_source/codegen/Interface_Code_Gen/CMakeLists.txt create mode 100644 trick_source/data_products/CMakeLists.txt create mode 100644 trick_source/data_products/DPX/APPS/FXPLOT/CMakeLists.txt create mode 100644 trick_source/data_products/DPX/APPS/GXPLOT/CMakeLists.txt create mode 100644 trick_source/data_products/DPX/CMakeLists.txt create mode 100644 trick_source/data_products/DPX/DPC/CMakeLists.txt create mode 100644 trick_source/data_products/DPX/DPM/CMakeLists.txt create mode 100644 trick_source/data_products/DPX/DPV/UTILS/CMakeLists.txt create mode 100644 trick_source/data_products/EQParse/CMakeLists.txt create mode 100644 trick_source/data_products/Log/CMakeLists.txt create mode 100644 trick_source/data_products/Var/CMakeLists.txt create mode 100644 trick_source/data_products/units/CMakeLists.txt create mode 100644 trick_source/er7_utils/CMakeLists.txt rename trick_source/er7_utils/trick/integration/include/{first_order_ode_integrator.hh => trick_first_order_ode_integrator.hh} (100%) rename trick_source/er7_utils/trick/integration/include/{second_order_ode_integrator.hh => trick_second_order_ode_integrator.hh} (100%) create mode 100644 trick_source/java/src/CMakeLists.txt create mode 100644 trick_source/sim_services/CMakeLists.txt create mode 100644 trick_source/sim_services/InputProcessor/CMakeLists.txt create mode 100644 trick_source/sim_services/MemoryManager/CMakeLists.txt create mode 100644 trick_source/trick_utils/CMakeLists.txt create mode 100644 trick_source/trick_utils/comm/CMakeLists.txt create mode 100644 trick_source/trick_utils/math/CMakeLists.txt create mode 100644 trick_source/trick_utils/units/CMakeLists.txt diff --git a/.gitignore b/.gitignore index fa39d495..f55eade6 100644 --- a/.gitignore +++ b/.gitignore @@ -9,8 +9,8 @@ lib64 lib_Linux_* lib_Darwin_* *.lex.c -*.tab.c -*.tab.h +*.tab.cpp +*.tab.hpp *.swp *.dox *.pyc diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..3ad93a28 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,389 @@ +cmake_minimum_required(VERSION 2.8) +project(trick) +set(TRICK_MAJOR 19) +set(TRICK_MINOR 1) +set(TRICK_TINY dev) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(TRICK_FORCE_32BIT OFF CACHE BOOL "Set Trick to compile in 32bit mode") +#set(USE_JAVA ON CACHE BOOL "Use java") +set(USE_ER7_UTILS ON CACHE BOOL "Use er7_utils") +set(UDUNITS2_ROOT "" CACHE STRING "UDUNITS home directory") + +#message("UDUNITS2_ROOT = ${UDUNITS2_ROOT}") + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +if(EXISTS "/etc/redhat-release") + if(TRICK_FORCE_32BIT) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) + else() + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib64) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib64) + endif() +else() + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +endif() + +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules) +include(UseJava) +find_package(Java REQUIRED) +find_package(BISON REQUIRED) +find_package(FLEX REQUIRED) +find_package(LLVM 3.4 REQUIRED) +find_package(Perl REQUIRED) +find_package(PythonInterp REQUIRED) +find_package(PythonLibs REQUIRED) +find_package(SWIG REQUIRED) +find_package(Tee REQUIRED) +find_package(Threads REQUIRED) +find_package(UDUNITS2 REQUIRED) +find_package(LibXml2 REQUIRED) +find_package(HDF5) +find_package(GSL) + +find_package(X11) +find_package(Motif) + +add_definitions( -DTRICK_VER=${TRICK_MAJOR} ) + +if(USE_ER7_UTILS) + add_definitions( -DUSE_ER7_UTILS_INTEGRATORS) +endif() + +if(GSL_FOUND) + add_definitions( -D_HAVE_GSL) +endif() + +include_directories( ${CMAKE_BINARY_DIR}/include) +include_directories( ${CMAKE_BINARY_DIR}/include/trick/compat) + +file(COPY bin DESTINATION ${CMAKE_BINARY_DIR}) +file(COPY include DESTINATION ${CMAKE_BINARY_DIR}) +file(COPY libexec DESTINATION ${CMAKE_BINARY_DIR}) +file(COPY share DESTINATION ${CMAKE_BINARY_DIR}) +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/include/mongoose) +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/temp_src/io_src) +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/temp_src/lex_yacc) +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/temp_src/mongoose) +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/temp_src/swig) +# copy er7_util header files to build directory +file(GLOB_RECURSE ER7_UTIL_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/trick_source/er7_utils ${CMAKE_CURRENT_SOURCE_DIR}/trick_source/er7_utils/*.hh) +foreach ( infile ${ER7_UTIL_HEADERS} ) + get_filename_component(dir ${infile} DIRECTORY) + file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/trick_source/er7_utils/${infile} DESTINATION "${CMAKE_BINARY_DIR}/include/er7_utils/${dir}") +endforeach(infile) + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/share/trick/makefiles/config_user_cmake.mk.in ${CMAKE_BINARY_DIR}/share/trick/makefiles/config_user.mk) + +############################################################### +# mongoose lib +############################################################### + +add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/include/mongoose/mongoose.h + COMMAND curl --retry 4 -O https://raw.githubusercontent.com/cesanta/mongoose/6.16/mongoose.h + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/include/mongoose +) + +add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/temp_src/mongoose/mongoose.c + COMMAND curl --retry 4 -O https://raw.githubusercontent.com/cesanta/mongoose/6.16/mongoose.c + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/temp_src/mongoose + DEPENDS ${CMAKE_BINARY_DIR}/include/mongoose/mongoose.h +) + +add_library(mongoose STATIC ${CMAKE_BINARY_DIR}/temp_src/mongoose/mongoose.c) +target_include_directories( mongoose PUBLIC ${CMAKE_BINARY_DIR}/include/mongoose ) + +############################################################### +# io_src files +############################################################### + +set( IO_SRC + ${CMAKE_BINARY_DIR}/temp_src/io_src/class_map.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_ABM_Integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_AttributesMap.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_BC635Clock.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_CheckPointAgent.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_CheckPointRestart.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_Clock.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_CommandLineArguments.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_DMTCP.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_DRAscii.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_DRBinary.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_DRHDF5.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_DataRecordDispatcher.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_DataRecordGroup.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_DebugPause.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_EchoJobs.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_EnumAttributesMap.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_Environment.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_Euler_Cromer_Integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_Euler_Integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_Event.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_EventInstrument.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_EventManager.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_EventProcessor.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_Executive.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_ExecutiveException.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_ExternalApplication.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_Flag.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_FrameDataRecordGroup.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_FrameLog.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_GetTimeOfDayClock.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_IPPython.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_IPPythonEvent.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_ITimer.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_InputProcessor.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_InstrumentBase.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_IntegLoopManager.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_IntegLoopScheduler.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_IntegLoopSimObject.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_Integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_JITEvent.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_JITInputFile.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_JSONVariableServer.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_JSONVariableServerThread.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_JobData.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_MM4_Integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_MSConnect.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_MSSharedMem.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_MSSocket.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_MTV.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_MalfunctionsTrickView.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_Master.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_MemoryManager.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_MessageCout.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_MessageFile.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_MessageLCout.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_MessagePublisher.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_MessageSubscriber.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_MessageTCDevice.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_MessageThreadedCout.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_MonteCarlo.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_MonteMonitor.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_MonteVar.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_NL2_Integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_PlaybackFile.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_RK2_Integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_RK4_Integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_RKF45_Integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_RKF78_Integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_RKG4_Integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_RealtimeSync.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_RemoteShell.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_RtiEvent.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_RtiExec.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_RtiList.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_RtiStager.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_STLInterface.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_ScheduledJobQueue.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_Scheduler.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_Sie.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_SimControlPanel.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_SimObject.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_SimTime.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_Slave.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_StripChart.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_TPROCTEClock.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_ThreadBase.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_ThreadTrigger.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_Threads.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_Timer.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_TrickView.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_UCFn.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_UdUnits.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_Unit.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_UnitTest.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_UnitsMap.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_VariableServer.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_VariableServerListenThread.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_VariableServerReference.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_VariableServerThread.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_WebServer.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_WebSocketSession.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_Zeroconf.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_attributes.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_dllist.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_io_alloc.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_lqueue.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_lstack.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_message_type.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_mm_error.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_ms_sim_mode.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_n_choose_m.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_parameter_types.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_rand_generator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_reference.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_reference_frame.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_regula_falsi.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_sim_mode.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_tc.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_time_offset.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_trick_error_hndlr.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_tsm.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_units_conv.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_value.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_var.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_variable_server_sync_types.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_wave_form.cpp +) + +set( ER7_UTILS_IO_SRC + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_abm4_first_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_abm4_integrator_constructor.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_abm4_second_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_base_integration_group.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_beeman_integrator_constructor.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_beeman_second_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_bogus_integration_controls.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_deletable.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_euler_first_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_euler_integrator_constructor.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_euler_second_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_first_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_generalized_position_derivative.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_integrable_object.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_integration_controls.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_integration_messages.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_integration_technique.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_integrator_constructor.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_integrator_constructor_factory.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_integrator_interface.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_integrator_result.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_integrator_result_merger.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_integrator_result_merger_container.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_left_quaternion_functions.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_mm4_integrator_constructor.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_mm4_second_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_nl2_integrator_constructor.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_nl2_second_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_position_verlet_integrator_constructor.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_position_verlet_second_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_priming_first_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_priming_integration_controls.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_priming_integrator_constructor.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_priming_second_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_ratio128.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_rk2_heun_first_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_rk2_heun_integrator_constructor.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_rk2_heun_second_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_rk2_midpoint_first_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_rk2_midpoint_integrator_constructor.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_rk2_midpoint_second_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_rk4_first_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_rk4_integrator_constructor.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_rk4_second_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_rk4_second_order_ode_integrator_base.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_rkf45_first_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_rkf45_integrator_constructor.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_rkf45_second_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_rkf78_first_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_rkf78_integrator_constructor.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_rkf78_second_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_rkg4_first_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_rkg4_integrator_constructor.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_rkg4_second_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_second_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_single_cycle_integration_controls.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_standard_integration_controls.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_state_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_symplectic_euler_integrator_constructor.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_symplectic_euler_second_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_time_interface.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_trick_first_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_trick_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_trick_second_order_ode_integrator.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_uint128.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_velocity_verlet_integrator_constructor.cpp + ${CMAKE_BINARY_DIR}/temp_src/io_src/io_velocity_verlet_second_order_ode_integrator.cpp +) + +set(ENV{TRICK_ICG_EXCLUDE} ${CMAKE_BINARY_DIR}/include/mongoose) +set(ICG_FLAGS -I${CMAKE_BINARY_DIR}/include -I${CMAKE_BINARY_DIR}/include/trick/compat -I${UDUNITS2_INCLUDES} -DTRICK_VER=${TRICK_MAJOR} -DUSE_ER7_UTILS_INTEGRATORS) +add_custom_command(OUTPUT ${IO_SRC} ${ER7_UTILS_IO_SRC} + COMMAND TRICK_ICG_EXCLUDE=${CMAKE_BINARY_DIR}/include/mongoose ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/trick-ICG -force -sim_services -m -n -o ${CMAKE_BINARY_DIR}/temp_src/io_src ${ICG_FLAGS} ${CMAKE_BINARY_DIR}/include/trick/files_to_ICG.hh + DEPENDS trick-ICG +) + +add_library( trick STATIC $ $ ${IO_SRC}) +target_include_directories( trick PUBLIC ${UDUNITS2_INCLUDES} ) + +add_library( er7_utils STATIC $ ${ER7_UTILS_IO_SRC}) + +# fake dependency to avoid double ICG +add_dependencies(er7_utils trick) + +############################################################### +# libtrick_pyip.a +############################################################### + +set( TRICK_SWIG_SRC + trick_source/trick_swig/PrimitiveAttributesMap + trick_source/trick_swig/swig_convert_units + trick_source/trick_swig/swig_global_vars +) + +# Generated SWIG files +set( SWIG_SRC + ${CMAKE_BINARY_DIR}/temp_src/swig/sim_services_wrap + ${CMAKE_BINARY_DIR}/temp_src/swig/swig_double_wrap + ${CMAKE_BINARY_DIR}/temp_src/swig/swig_int_wrap + ${CMAKE_BINARY_DIR}/temp_src/swig//swig_ref_wrap +) + +set( SWIG_SRC_BASENAME + sim_services + swig_double + swig_int + swig_ref +) + +set(SWIG_FLAGS -DUSE_ER7_UTILS_INTEGRATORS) +if(GSL_FOUND) + list( APPEND SWIG_FLAGS -D_HAVE_GSL ) +endif() +foreach ( infile ${SWIG_SRC_BASENAME} ) + add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/temp_src/swig/${infile}_wrap.cpp + COMMAND ${SWIG_EXECUTABLE} ${SWIG_FLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/trick_source -I${CMAKE_CURRENT_SOURCE_DIR}/include -I${CMAKE_CURRENT_SOURCE_DIR} -c++ -python -includeall -ignoremissing -w201,362,389,451 -o $@ -outdir ${CMAKE_BINARY_DIR}/share/trick/swig ${CMAKE_CURRENT_SOURCE_DIR}/trick_source/trick_swig/${infile}.i + ) +endforeach(infile) + +add_library( trick_pyip STATIC $ ${TRICK_SWIG_SRC} ${SWIG_SRC}) +target_include_directories( trick_pyip PUBLIC ${PYTHON_INCLUDE_DIRS} ) +target_include_directories( trick_pyip PUBLIC ${UDUNITS2_INCLUDES} ) +if(GSL_FOUND) + target_include_directories( trick_pyip PUBLIC ${GSL_INCLUDE_DIRS} ) +endif() +target_include_directories( trick_pyip PUBLIC trick_source ) + +############################################################### +# libtrickHTTP.a +############################################################### + +set( TRICKHTTP_SRC + trick_source/web/HttpServer/src/VariableServerSession + trick_source/web/HttpServer/src/VariableServerVariable + trick_source/web/HttpServer/src/WebServer + trick_source/web/HttpServer/src/http_GET_handlers + trick_source/web/HttpServer/src/simpleJSON +) + +add_library( trickHTTP STATIC ${TRICKHTTP_SRC}) +add_dependencies( trickHTTP mongoose) + +############################################################### +# Other Trick libraries +############################################################### + +add_subdirectory(trick_source/codegen/Interface_Code_Gen) +add_subdirectory(trick_source/er7_utils) +add_subdirectory(trick_source/sim_services) +add_subdirectory(trick_source/trick_utils) +add_subdirectory(trick_source/java/src) +add_subdirectory(trick_source/data_products) diff --git a/CMakeModules/FindLLVM.cmake b/CMakeModules/FindLLVM.cmake new file mode 100644 index 00000000..a9a06bab --- /dev/null +++ b/CMakeModules/FindLLVM.cmake @@ -0,0 +1,193 @@ +# - Find LLVM headers and libraries. +# This module locates LLVM and adapts the llvm-config output for use with +# CMake. +# +# A given list of COMPONENTS is passed to llvm-config. +# +# The following variables are defined: +# LLVM_FOUND - true if LLVM was found +# LLVM_CXXFLAGS - C++ compiler flags for files that include LLVM headers. +# LLVM_HOST_TARGET - Target triple used to configure LLVM. +# LLVM_INCLUDE_DIRS - Directory containing LLVM include files. +# LLVM_LDFLAGS - Linker flags to add when linking against LLVM +# (includes -LLLVM_LIBRARY_DIRS). +# LLVM_LIBRARIES - Full paths to the library files to link against. +# LLVM_LIBRARY_DIRS - Directory containing LLVM libraries. +# LLVM_NATIVE_ARCH - Backend corresponding to LLVM_HOST_TARGET, e.g., +# X86 for x86_64 and i686 hosts. +# LLVM_ROOT_DIR - The root directory of the LLVM installation. +# llvm-config is searched for in ${LLVM_ROOT_DIR}/bin. +# LLVM_VERSION_MAJOR - Major version of LLVM. +# LLVM_VERSION_MINOR - Minor version of LLVM. +# LLVM_VERSION_STRING - Full LLVM version string (e.g. 6.0.0svn). +# LLVM_VERSION_BASE_STRING - Base LLVM version string without git/svn suffix (e.g. 6.0.0). +# +# Note: The variable names were chosen in conformance with the offical CMake +# guidelines, see ${CMAKE_ROOT}/Modules/readme.txt. + +# Try suffixed versions to pick up the newest LLVM install available on Debian +# derivatives. +# We also want an user-specified LLVM_ROOT_DIR to take precedence over the +# system default locations such as /usr/local/bin. Executing find_program() +# multiples times is the approach recommended in the docs. +set(llvm_config_names llvm-config-9.0 llvm-config90 + llvm-config-8.0 llvm-config80 + llvm-config-7.0 llvm-config70 + llvm-config-6.0 llvm-config60 + llvm-config-5.0 llvm-config50 + llvm-config-4.0 llvm-config40 + llvm-config-3.9 llvm-config39 + llvm-config) +find_program(LLVM_CONFIG + NAMES ${llvm_config_names} + PATHS ${LLVM_ROOT_DIR}/bin /usr/local/opt/llvm/bin NO_DEFAULT_PATH + DOC "Path to llvm-config tool.") +find_program(LLVM_CONFIG NAMES ${llvm_config_names}) + +# Prints a warning/failure message depending on the required/quiet flags. Copied +# from FindPackageHandleStandardArgs.cmake because it doesn't seem to be exposed. +macro(_LLVM_FAIL _msg) + if(LLVM_FIND_REQUIRED) + message(FATAL_ERROR "${_msg}") + else() + if(NOT LLVM_FIND_QUIETLY) + message(STATUS "${_msg}") + endif() + endif() +endmacro() + + +if(NOT LLVM_CONFIG) + if(NOT LLVM_FIND_QUIETLY) + message(WARNING "Could not find llvm-config (LLVM >= ${LLVM_FIND_VERSION}). Try manually setting LLVM_CONFIG to the llvm-config executable of the installation to use.") + endif() +else() + macro(llvm_set var flag) + if(LLVM_FIND_QUIETLY) + set(_quiet_arg ERROR_QUIET) + endif() + set(result_code) + execute_process( + COMMAND ${LLVM_CONFIG} --${flag} + RESULT_VARIABLE result_code + OUTPUT_VARIABLE LLVM_${var} + OUTPUT_STRIP_TRAILING_WHITESPACE + ${_quiet_arg} + ) + if(result_code) + _LLVM_FAIL("Failed to execute llvm-config ('${LLVM_CONFIG}', result code: '${result_code})'") + else() + if(${ARGV2}) + file(TO_CMAKE_PATH "${LLVM_${var}}" LLVM_${var}) + endif() + endif() + endmacro() + macro(llvm_set_libs var flag components) + if(LLVM_FIND_QUIETLY) + set(_quiet_arg ERROR_QUIET) + endif() + set(result_code) + execute_process( + COMMAND ${LLVM_CONFIG} --${flag} ${components} + RESULT_VARIABLE result_code + OUTPUT_VARIABLE tmplibs + OUTPUT_STRIP_TRAILING_WHITESPACE + ${_quiet_arg} + ) + if(result_code) + _LLVM_FAIL("Failed to execute llvm-config ('${LLVM_CONFIG}', result code: '${result_code})'") + else() + file(TO_CMAKE_PATH "${tmplibs}" tmplibs) + string(REGEX MATCHALL "${pattern}[^ ]+" LLVM_${var} ${tmplibs}) + endif() + endmacro() + + llvm_set(VERSION_STRING version) + llvm_set(CXXFLAGS cxxflags) + llvm_set(HOST_TARGET host-target) + llvm_set(INCLUDE_DIRS includedir true) + llvm_set(ROOT_DIR prefix true) + llvm_set(ENABLE_ASSERTIONS assertion-mode) + + # The LLVM version string _may_ contain a git/svn suffix, so match only the x.y.z part + string(REGEX MATCH "^[0-9]+[.][0-9]+[.][0-9]+" LLVM_VERSION_BASE_STRING "${LLVM_VERSION_STRING}") + + # Versions below 4.0 do not support components debuginfomsf and demangle + if(${LLVM_VERSION_STRING} MATCHES "^3\\..*") + list(REMOVE_ITEM LLVM_FIND_COMPONENTS "debuginfomsf" index) + list(REMOVE_ITEM LLVM_FIND_COMPONENTS "demangle" index) + endif() + # Versions below 6.0 do not support component windowsmanifest + if(${LLVM_VERSION_STRING} MATCHES "^[3-5]\\..*") + list(REMOVE_ITEM LLVM_FIND_COMPONENTS "windowsmanifest" index) + endif() + + llvm_set(LDFLAGS ldflags) + # In LLVM 3.5+, the system library dependencies (e.g. "-lz") are accessed + # using the separate "--system-libs" flag. + llvm_set(SYSTEM_LIBS system-libs) + string(REPLACE "\n" " " LLVM_LDFLAGS "${LLVM_LDFLAGS} ${LLVM_SYSTEM_LIBS}") + string(STRIP ${LLVM_LDFLAGS} LLVM_LDFLAGS) + llvm_set(LIBRARY_DIRS libdir true) + llvm_set_libs(LIBRARIES libs "${LLVM_FIND_COMPONENTS}") + # LLVM bug: llvm-config --libs tablegen returns -lLLVM-3.8.0 + # but code for it is not in shared library + if("${LLVM_FIND_COMPONENTS}" MATCHES "tablegen") + if (NOT "${LLVM_LIBRARIES}" MATCHES "LLVMTableGen") + set(LLVM_LIBRARIES "${LLVM_LIBRARIES};-lLLVMTableGen") + endif() + endif() + + # Versions below 4.0 do not support llvm-config --cmakedir + if(${LLVM_VERSION_STRING} MATCHES "^3\\..*") + set(LLVM_CMAKEDIR ${LLVM_LIBRARY_DIRS}/cmake/llvm) + else() + llvm_set(CMAKEDIR cmakedir) + endif() + + llvm_set(TARGETS_TO_BUILD targets-built) + string(REGEX MATCHALL "${pattern}[^ ]+" LLVM_TARGETS_TO_BUILD ${LLVM_TARGETS_TO_BUILD}) + + # Parse LLVM_NATIVE_ARCH manually from LLVMConfig.cmake; including it leads to issues like + # https://github.com/ldc-developers/ldc/issues/3079. + file(STRINGS "${LLVM_CMAKEDIR}/LLVMConfig.cmake" LLVM_NATIVE_ARCH LIMIT_COUNT 1 REGEX "^set\\(LLVM_NATIVE_ARCH (.+)\\)$") + string(REGEX MATCH "set\\(LLVM_NATIVE_ARCH (.+)\\)" LLVM_NATIVE_ARCH "${LLVM_NATIVE_ARCH}") + set(LLVM_NATIVE_ARCH ${CMAKE_MATCH_1}) + message(STATUS "LLVM_NATIVE_ARCH: ${LLVM_NATIVE_ARCH}") +endif() + +# On CMake builds of LLVM, the output of llvm-config --cxxflags does not +# include -fno-rtti, leading to linker errors. Be sure to add it. +if(NOT MSVC AND (CMAKE_COMPILER_IS_GNUCXX OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))) + if(NOT ${LLVM_CXXFLAGS} MATCHES "-fno-rtti") + set(LLVM_CXXFLAGS "${LLVM_CXXFLAGS} -fno-rtti") + endif() +endif() + +# Remove some clang-specific flags for gcc. +if(CMAKE_COMPILER_IS_GNUCXX) + string(REPLACE "-Wcovered-switch-default " "" LLVM_CXXFLAGS ${LLVM_CXXFLAGS}) + string(REPLACE "-Wstring-conversion " "" LLVM_CXXFLAGS ${LLVM_CXXFLAGS}) + string(REPLACE "-fcolor-diagnostics " "" LLVM_CXXFLAGS ${LLVM_CXXFLAGS}) + # this requires more recent gcc versions (not supported by 4.9) + string(REPLACE "-Werror=unguarded-availability-new " "" LLVM_CXXFLAGS ${LLVM_CXXFLAGS}) +endif() + +# Remove gcc-specific flags for clang. +if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") + string(REPLACE "-Wno-maybe-uninitialized " "" LLVM_CXXFLAGS ${LLVM_CXXFLAGS}) +endif() + +string(REGEX REPLACE "([0-9]+).*" "\\1" LLVM_VERSION_MAJOR "${LLVM_VERSION_STRING}" ) +string(REGEX REPLACE "[0-9]+\\.([0-9]+).*[A-Za-z]*" "\\1" LLVM_VERSION_MINOR "${LLVM_VERSION_STRING}" ) + +if (${LLVM_VERSION_STRING} VERSION_LESS ${LLVM_FIND_VERSION}) + message(FATAL_ERROR "Unsupported LLVM version found ${LLVM_VERSION_STRING}. At least version ${LLVM_FIND_VERSION} is required.") +endif() + +# Use the default CMake facilities for handling QUIET/REQUIRED. +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(LLVM + REQUIRED_VARS LLVM_ROOT_DIR LLVM_HOST_TARGET + VERSION_VAR LLVM_VERSION_STRING) diff --git a/CMakeModules/FindTee.cmake b/CMakeModules/FindTee.cmake new file mode 100644 index 00000000..10c285e1 --- /dev/null +++ b/CMakeModules/FindTee.cmake @@ -0,0 +1,19 @@ + +# FindTee +# -------- +# +# Find tee +# +# This module looks for tee. This module defines the following values: +# +# :: +# +# TEE_EXECUTABLE: the full path to the tee tool. +# TEE_FOUND: True if tee has been found. + +find_program(TEE_EXECUTABLE tee) +mark_as_advanced( TEE_EXECUTABLE ) + +include (FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(TEE REQUIRED_VARS TEE_EXECUTABLE) + diff --git a/CMakeModules/FindUDUNITS2.cmake b/CMakeModules/FindUDUNITS2.cmake new file mode 100644 index 00000000..d1445a0e --- /dev/null +++ b/CMakeModules/FindUDUNITS2.cmake @@ -0,0 +1,92 @@ +# - Find UDUNITS2 +# Find the native UDUNITS2 includes and library +# +# UDUNITS2_INCLUDES - where to find udunits2.h +# UDUNITS2_LIBRARIES - libraries to link with +# UDUNITS2_FOUND - True if UDUNITS2 was found. + +message(STATUS "UDUNITS2_ROOT = ${UDUNITS2_ROOT}") +if (UDUNITS2_INCLUDES) + # Already in cache, be silent + set (UDUNITS2_FIND_QUIETLY TRUE) +endif (UDUNITS2_INCLUDES) + +find_path (UDUNITS2_INCLUDES udunits2.h + HINTS "${UDUNITS2_ROOT}/include" "$ENV{UDUNITS2_ROOT}/include" + PATH_SUFFIXES "udunits2" + DOC "Path to udunits2.h") + +# UDUNITS2 headers might be in .../include or .../include/udunits2. +# We try both. +if (${UDUNITS2_INCLUDES} MATCHES "udunits2/?$") + string(REGEX REPLACE "/include/udunits2/?$" "/lib" + UDUNITS2_LIB_HINT ${UDUNITS2_INCLUDES}) +else() + string(REGEX REPLACE "/include/?$" "/lib" + UDUNITS2_LIB_HINT ${UDUNITS2_INCLUDES}) +endif() + +find_library (UDUNITS2_LIBRARIES + NAMES udunits2 + HINTS ${UDUNITS2_LIB_HINT}) + +set(UDUNITS2_TEST_SRC " +#include + +int main(int argc, char **argv) { + ut_system *s = ut_read_xml(NULL); + ut_free_system(s); + return 0; +} +") + +if ((NOT UDUNITS2_LIBRARIES) OR (NOT UDUNITS2_INCLUDES)) + message(STATUS "Trying to find UDUNITS-2 using LD_LIBRARY_PATH (we're desperate)...") + + file(TO_CMAKE_PATH "$ENV{LD_LIBRARY_PATH}" LD_LIBRARY_PATH) + + find_library(UDUNITS2_LIBRARIES + NAMES udunits2 + HINTS ${LD_LIBRARY_PATH}) + + if (UDUNITS2_LIBRARIES) + get_filename_component(UDUNITS2_LIB_DIR ${UDUNITS2_LIBRARIES} PATH) + string(REGEX REPLACE "/lib/?$" "/include" + UDUNITS2_H_HINT ${UDUNITS2_LIB_DIR}) + + find_path (UDUNITS2_INCLUDES udunits2.h + HINTS ${UDUNITS2_H_HINT} + PATH_SUFFIXES "udunits2" + DOC "Path to udunits2.h") + endif() +endif() + +include (CheckCSourceRuns) + +set(CMAKE_REQUIRED_INCLUDES ${UDUNITS2_INCLUDES}) +set(CMAKE_REQUIRED_LIBRARIES ${UDUNITS2_LIBRARIES}) +check_c_source_runs("${UDUNITS2_TEST_SRC}" UDUNITS2_WORKS_WITHOUT_EXPAT) + +if(${UDUNITS2_WORKS_WITHOUT_EXPAT}) + #message(STATUS "UDUNITS-2 does not require expat") +else() + find_package(EXPAT REQUIRED) + + set(CMAKE_REQUIRED_INCLUDES ${UDUNITS2_INCLUDES} ${EXPAT_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES ${UDUNITS2_LIBRARIES} ${EXPAT_LIBRARIES}) + check_c_source_runs("${UDUNITS2_TEST_SRC}" UDUNITS2_WORKS_WITH_EXPAT) + + if(NOT ${UDUNITS2_WORKS_WITH_EXPAT}) + message(FATAL_ERROR "UDUNITS-2 does not seem to work with or without expat") + endif() + + #message(STATUS "UDUNITS-2 requires EXPAT") + set (UDUNITS2_LIBRARIES "${UDUNITS2_LIBRARIES};${EXPAT_LIBRARIES}" CACHE STRING "" FORCE) +endif() + +# handle the QUIETLY and REQUIRED arguments and set UDUNITS2_FOUND to TRUE if +# all listed variables are TRUE +include (FindPackageHandleStandardArgs) +find_package_handle_standard_args (UDUNITS2 DEFAULT_MSG UDUNITS2_LIBRARIES UDUNITS2_INCLUDES) + +mark_as_advanced (UDUNITS2_LIBRARIES UDUNITS2_INCLUDES) diff --git a/include/trick/ABM_Integrator.hh b/include/trick/ABM_Integrator.hh index 8cc96b0b..8489d4d9 100644 --- a/include/trick/ABM_Integrator.hh +++ b/include/trick/ABM_Integrator.hh @@ -14,7 +14,7 @@ Programmers: #ifdef USE_ER7_UTILS_INTEGRATORS #include "er7_utils/integration/abm4/include/abm4_integrator_constructor.hh" -#include "er7_utils/trick/integration/include/first_order_ode_integrator.hh" +#include "er7_utils/trick/integration/include/trick_first_order_ode_integrator.hh" namespace Trick { diff --git a/include/trick/Euler_Cromer_Integrator.hh b/include/trick/Euler_Cromer_Integrator.hh index 27b5ec7a..d62ef831 100644 --- a/include/trick/Euler_Cromer_Integrator.hh +++ b/include/trick/Euler_Cromer_Integrator.hh @@ -16,7 +16,7 @@ Programmers: #include #include "er7_utils/integration/symplectic_euler/include/symplectic_euler_integrator_constructor.hh" -#include "er7_utils/trick/integration/include/second_order_ode_integrator.hh" +#include "er7_utils/trick/integration/include/trick_second_order_ode_integrator.hh" namespace Trick { diff --git a/include/trick/Euler_Integrator.hh b/include/trick/Euler_Integrator.hh index 661e1c1f..50294bb3 100644 --- a/include/trick/Euler_Integrator.hh +++ b/include/trick/Euler_Integrator.hh @@ -14,7 +14,7 @@ Programmers: #ifdef USE_ER7_UTILS_INTEGRATORS #include "er7_utils/integration/euler/include/euler_integrator_constructor.hh" -#include "er7_utils/trick/integration/include/first_order_ode_integrator.hh" +#include "er7_utils/trick/integration/include/trick_first_order_ode_integrator.hh" namespace Trick { diff --git a/include/trick/MM4_Integrator.hh b/include/trick/MM4_Integrator.hh index 1f1a4f38..75972169 100644 --- a/include/trick/MM4_Integrator.hh +++ b/include/trick/MM4_Integrator.hh @@ -14,7 +14,7 @@ Programmers: #ifdef USE_ER7_UTILS_INTEGRATORS #include "er7_utils/integration/mm4/include/mm4_integrator_constructor.hh" -#include "er7_utils/trick/integration/include/second_order_ode_integrator.hh" +#include "er7_utils/trick/integration/include/trick_second_order_ode_integrator.hh" namespace Trick { diff --git a/include/trick/NL2_Integrator.hh b/include/trick/NL2_Integrator.hh index 8dac3513..d391f38d 100644 --- a/include/trick/NL2_Integrator.hh +++ b/include/trick/NL2_Integrator.hh @@ -14,7 +14,7 @@ Programmers: #ifdef USE_ER7_UTILS_INTEGRATORS #include "er7_utils/integration/nl2/include/nl2_integrator_constructor.hh" -#include "er7_utils/trick/integration/include/second_order_ode_integrator.hh" +#include "er7_utils/trick/integration/include/trick_second_order_ode_integrator.hh" namespace Trick { diff --git a/include/trick/RK2_Integrator.hh b/include/trick/RK2_Integrator.hh index 7ef0883a..3aa92453 100644 --- a/include/trick/RK2_Integrator.hh +++ b/include/trick/RK2_Integrator.hh @@ -14,7 +14,7 @@ Programmers: #ifdef USE_ER7_UTILS_INTEGRATORS #include "er7_utils/integration/rk2_heun/include/rk2_heun_integrator_constructor.hh" -#include "er7_utils/trick/integration/include/first_order_ode_integrator.hh" +#include "er7_utils/trick/integration/include/trick_first_order_ode_integrator.hh" namespace Trick { diff --git a/include/trick/RK4_Integrator.hh b/include/trick/RK4_Integrator.hh index 108a5701..cd1a36ab 100644 --- a/include/trick/RK4_Integrator.hh +++ b/include/trick/RK4_Integrator.hh @@ -14,7 +14,7 @@ Programmers: #ifdef USE_ER7_UTILS_INTEGRATORS #include "er7_utils/integration/rk4/include/rk4_integrator_constructor.hh" -#include "er7_utils/trick/integration/include/first_order_ode_integrator.hh" +#include "er7_utils/trick/integration/include/trick_first_order_ode_integrator.hh" namespace Trick { diff --git a/include/trick/RKF45_Integrator.hh b/include/trick/RKF45_Integrator.hh index 385d81d4..dd4cca64 100644 --- a/include/trick/RKF45_Integrator.hh +++ b/include/trick/RKF45_Integrator.hh @@ -14,7 +14,7 @@ Programmers: #ifdef USE_ER7_UTILS_INTEGRATORS #include "er7_utils/integration/rkf45/include/rkf45_integrator_constructor.hh" -#include "er7_utils/trick/integration/include/first_order_ode_integrator.hh" +#include "er7_utils/trick/integration/include/trick_first_order_ode_integrator.hh" namespace Trick { diff --git a/include/trick/RKF78_Integrator.hh b/include/trick/RKF78_Integrator.hh index 4806d7b9..afbf8a43 100644 --- a/include/trick/RKF78_Integrator.hh +++ b/include/trick/RKF78_Integrator.hh @@ -14,7 +14,7 @@ Programmers: #ifdef USE_ER7_UTILS_INTEGRATORS #include "er7_utils/integration/rkf78/include/rkf78_integrator_constructor.hh" -#include "er7_utils/trick/integration/include/first_order_ode_integrator.hh" +#include "er7_utils/trick/integration/include/trick_first_order_ode_integrator.hh" namespace Trick { diff --git a/include/trick/RKG4_Integrator.hh b/include/trick/RKG4_Integrator.hh index d19c877a..007e212f 100644 --- a/include/trick/RKG4_Integrator.hh +++ b/include/trick/RKG4_Integrator.hh @@ -14,7 +14,7 @@ Programmers: #ifdef USE_ER7_UTILS_INTEGRATORS #include "er7_utils/integration/rkg4/include/rkg4_integrator_constructor.hh" -#include "er7_utils/trick/integration/include/first_order_ode_integrator.hh" +#include "er7_utils/trick/integration/include/trick_first_order_ode_integrator.hh" namespace Trick { diff --git a/libexec/trick/make_makefile_swig b/libexec/trick/make_makefile_swig index 6b0fd46c..69a58ecb 100755 --- a/libexec/trick/make_makefile_swig +++ b/libexec/trick/make_makefile_swig @@ -147,6 +147,9 @@ ifeq (\$(IS_CC_CLANG), 1) TRICK_SYSTEM_SWIG_CFLAGS += -Wno-self-assign -Wno-sometimes-uninitialized -Wno-deprecated-register else TRICK_SYSTEM_SWIG_CFLAGS += -Wno-unused-but-set-variable + ifeq (\$(shell test \$(GCC_MAJOR) -ge 8; echo \$\$?), 0) + TRICK_SYSTEM_SWIG_CFLAGS += -Wno-cast-function-type + endif endif ifndef TRICK_VERBOSE_BUILD diff --git a/libexec/trick/pm/gte.pm b/libexec/trick/pm/gte.pm index e9b6509c..60737636 100644 --- a/libexec/trick/pm/gte.pm +++ b/libexec/trick/pm/gte.pm @@ -70,7 +70,7 @@ sub gte (@) { if ( $system_type eq "Linux" ) { $def{"TRICK_HOST_CPU"} = $system_type . "_" . $gcc_version ; $machine_hardware = `uname -m` ; - if ( (! exists $ENV{"TRICK_FORCE_32BIT"} or $ENV{"TRICK_FORCE_32BIT"} == 0) and $machine_hardware eq "x86_64\n") { + if ( (! exists $ENV{"TRICK_FORCE_32BIT"} or $ENV{"TRICK_FORCE_32BIT"} == 0 or $ENV{"TRICK_FORCE_32BIT"} == "OFF" ) and $machine_hardware eq "x86_64\n") { $def{"TRICK_HOST_CPU"} .= "_x86_64" ; } } @@ -86,7 +86,7 @@ sub gte (@) { $def{"TRICK_DEBUG"} = "0" ; $def{"TRICK_EDITOR"} = "" ; $def{"TRICK_EXEC_LINK_LIBS"} = "" ; - $def{"TRICK_FORCE_32BIT"} = "0" ; + $def{"TRICK_FORCE_32BIT"} = "OFF" ; $def{"TRICK_GTE_EXT"} = "" ; $def{"TRICK_HOME"} = "$trick_home" ; $def{"TRICK_HOST_CPU_USER_SUFFIX"} = "" ; diff --git a/share/trick/makefiles/Makefile.common b/share/trick/makefiles/Makefile.common index 8780da15..ffa11edf 100644 --- a/share/trick/makefiles/Makefile.common +++ b/share/trick/makefiles/Makefile.common @@ -101,6 +101,16 @@ ifeq ($(HAVE_ZEROCONF),1) TRICK_SYSTEM_CXXFLAGS += -DHAVE_ZEROCONF endif +ifeq ($(USE_ER7_UTILS),ON) + ER7_UTILS_HOME := $(TRICK_HOME)/trick_source/er7_utils + TRICK_SYSTEM_CXXFLAGS += -DUSE_ER7_UTILS_INTEGRATORS + TRICK_LIBS += -ler7_utils + ifneq ($(wildcard ${ER7_UTILS_HOME}/CheckpointHelper),) + USE_ER7_UTILS_CHECKPOINTHELPER = 1 + TRICK_SYSTEM_CXXFLAGS += -DUSE_ER7_UTILS_CHECKPOINTHELPER + endif +endif +# older test, remove when cmake is only build system ifeq ($(USE_ER7_UTILS), 1) ER7_UTILS_HOME := $(TRICK_HOME)/trick_source/er7_utils TRICK_SYSTEM_CXXFLAGS += -DUSE_ER7_UTILS_INTEGRATORS @@ -111,6 +121,13 @@ ifeq ($(USE_ER7_UTILS), 1) endif endif +ifeq ($(TRICK_FORCE_32BIT),ON) + TRICK_ICGFLAGS += -m32 + TRICK_SYSTEM_CXXFLAGS += -m32 + TRICK_SYSTEM_LDFLAGS += -m32 + LD_PARTIAL += -melf_i386 +endif +# older test, remove when cmake is only build system ifeq ($(TRICK_FORCE_32BIT), 1) TRICK_ICGFLAGS += -m32 TRICK_SYSTEM_CXXFLAGS += -m32 diff --git a/share/trick/makefiles/Makefile.tricklib b/share/trick/makefiles/Makefile.tricklib index b4c3f6bb..2f524c34 100644 --- a/share/trick/makefiles/Makefile.tricklib +++ b/share/trick/makefiles/Makefile.tricklib @@ -30,9 +30,9 @@ L_C_PREMADE = $(subst .l,.lex.c_premade,$(L_SRC)) L_OBJS = $(addprefix $(OBJ_DIR)/,$(notdir $(subst .l,.lex.o,$(L_SRC)))) Y_SRC = $(wildcard $(SRC_DIR)*.y) -Y_C = $(subst .y,.tab.c,$(Y_SRC)) +Y_C = $(subst .y,.tab.cpp,$(Y_SRC)) Y_C_PREMADE = $(subst .y,.tab.c_premade,$(Y_SRC)) -Y_H = $(subst .y,.tab.h,$(Y_SRC)) +Y_H = $(subst .y,.tab.hpp,$(Y_SRC)) Y_OBJS = $(addprefix $(OBJ_DIR)/,$(notdir $(subst .y,.tab.o,$(Y_SRC)))) C_SRC = $(filter-out $(Y_C) $(L_C), $(wildcard $(SRC_DIR)*.c)) @@ -146,18 +146,18 @@ $(L_C) : $(SRC_DIR)%.lex.c : $(SRC_DIR)%.l $(L_C_PREMADE) : $(SRC_DIR)%.lex.c_premade : $(SRC_DIR)%.l $(LEX) -o $@ $< -$(Y_H) : $(SRC_DIR)%.tab.h : $(SRC_DIR)%.tab.c +$(Y_H) : $(SRC_DIR)%.tab.hpp : $(SRC_DIR)%.tab.cpp -$(Y_C) : $(SRC_DIR)%.tab.c : $(SRC_DIR)%.y +$(Y_C) : $(SRC_DIR)%.tab.cpp : $(SRC_DIR)%.y $(YACC) -d -o $@ $< || ( $(CD_CMD) ln -s ${@F}_premade ${@F} ; ln -s ${@F:.c=.h}_premade ${@F:.c=.h}) $(Y_C_PREMADE) : $(SRC_DIR)%.tab.c_premade : $(SRC_DIR)%.y $(YACC) -d -o $@ $< -$(L_OBJS) : $(OBJ_DIR)/%.lex.o : $(SRC_DIR)%.lex.c $(SRC_DIR)%.tab.h | $(OBJ_DIR) +$(L_OBJS) : $(OBJ_DIR)/%.lex.o : $(SRC_DIR)%.lex.c $(SRC_DIR)%.tab.hpp | $(OBJ_DIR) $(CD_CMD) $(TRICK_CXX) $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) -c ${ #include "trick/mm_error.h" #include "trick/ChkPtParseContext.hh" -#include "input_parser.tab.h" +#include "input_parser.tab.hpp" #include "trick/TrickConstant.hh" #define YY_EXTRA_TYPE ChkPtParseContext* diff --git a/trick_source/sim_services/CheckPointAgent/input_parser.y b/trick_source/sim_services/CheckPointAgent/input_parser.y index c69addaf..476cb28e 100644 --- a/trick_source/sim_services/CheckPointAgent/input_parser.y +++ b/trick_source/sim_services/CheckPointAgent/input_parser.y @@ -22,7 +22,7 @@ #include "trick/var.h" #include "trick/message_proto.h" #include "trick/message_type.h" -#include "input_parser.tab.h" +#include "input_parser.tab.hpp" using namespace std; diff --git a/trick_source/sim_services/InputProcessor/CMakeLists.txt b/trick_source/sim_services/InputProcessor/CMakeLists.txt new file mode 100644 index 00000000..f4809b66 --- /dev/null +++ b/trick_source/sim_services/InputProcessor/CMakeLists.txt @@ -0,0 +1,13 @@ + +set( INPUT_PROCESSOR_SRC + IPPython + IPPythonEvent + InputProcessor + MTV + MTV_c_intf + input_processor_ext +) + +add_library( input_processor_objs OBJECT ${INPUT_PROCESSOR_SRC}) +target_include_directories( input_processor_objs PUBLIC ${PYTHON_INCLUDE_DIRS} ) + diff --git a/trick_source/sim_services/Integrator/Makefile_deps b/trick_source/sim_services/Integrator/Makefile_deps index 9f1dfaee..3098eb2c 100644 --- a/trick_source/sim_services/Integrator/Makefile_deps +++ b/trick_source/sim_services/Integrator/Makefile_deps @@ -50,7 +50,7 @@ object_${TRICK_HOST_CPU}/IntegLoopScheduler.o: src/IntegLoopScheduler.cpp \ ${TRICK_HOME}/trick_source/er7_utils/integration/core/include/integration_controls.hh \ ${TRICK_HOME}/trick_source/er7_utils/integration/abm4/include/abm4_second_order_ode_integrator.hh \ ${TRICK_HOME}/trick_source/er7_utils/integration/core/include/priming_second_order_ode_integrator.hh \ - ${TRICK_HOME}/trick_source/er7_utils/trick/integration/include/first_order_ode_integrator.hh \ + ${TRICK_HOME}/trick_source/er7_utils/trick/integration/include/trick_first_order_ode_integrator.hh \ ${TRICK_HOME}/trick_source/er7_utils/trick/integration/include/trick_integrator.hh \ ${TRICK_HOME}/include/trick/compat/sim_services/Integrator/include/Integrator.hh \ ${TRICK_HOME}/trick_source/er7_utils/integration/core/include/base_integration_group.hh \ @@ -68,7 +68,7 @@ object_${TRICK_HOST_CPU}/IntegLoopScheduler.o: src/IntegLoopScheduler.cpp \ ${TRICK_HOME}/trick_source/er7_utils/integration/symplectic_euler/include/symplectic_euler_integrator_constructor.hh \ ${TRICK_HOME}/trick_source/er7_utils/integration/euler/include/euler_first_order_ode_integrator.hh \ ${TRICK_HOME}/trick_source/er7_utils/integration/symplectic_euler/include/symplectic_euler_second_order_ode_integrator.hh \ - ${TRICK_HOME}/trick_source/er7_utils/trick/integration/include/second_order_ode_integrator.hh \ + ${TRICK_HOME}/trick_source/er7_utils/trick/integration/include/trick_second_order_ode_integrator.hh \ ${TRICK_HOME}/include/trick/Euler_Integrator.hh \ ${TRICK_HOME}/trick_source/er7_utils/integration/euler/include/euler_integrator_constructor.hh \ ${TRICK_HOME}/trick_source/er7_utils/integration/euler/include/euler_first_order_ode_integrator.hh \ @@ -153,7 +153,7 @@ object_${TRICK_HOST_CPU}/IntegLoopManager.o: src/IntegLoopManager.cpp \ ${TRICK_HOME}/trick_source/er7_utils/integration/core/include/integration_controls.hh \ ${TRICK_HOME}/trick_source/er7_utils/integration/abm4/include/abm4_second_order_ode_integrator.hh \ ${TRICK_HOME}/trick_source/er7_utils/integration/core/include/priming_second_order_ode_integrator.hh \ - ${TRICK_HOME}/trick_source/er7_utils/trick/integration/include/first_order_ode_integrator.hh \ + ${TRICK_HOME}/trick_source/er7_utils/trick/integration/include/trick_first_order_ode_integrator.hh \ ${TRICK_HOME}/trick_source/er7_utils/trick/integration/include/trick_integrator.hh \ ${TRICK_HOME}/include/trick/compat/sim_services/Integrator/include/Integrator.hh \ ${TRICK_HOME}/trick_source/er7_utils/integration/core/include/base_integration_group.hh \ @@ -171,7 +171,7 @@ object_${TRICK_HOST_CPU}/IntegLoopManager.o: src/IntegLoopManager.cpp \ ${TRICK_HOME}/trick_source/er7_utils/integration/symplectic_euler/include/symplectic_euler_integrator_constructor.hh \ ${TRICK_HOME}/trick_source/er7_utils/integration/euler/include/euler_first_order_ode_integrator.hh \ ${TRICK_HOME}/trick_source/er7_utils/integration/symplectic_euler/include/symplectic_euler_second_order_ode_integrator.hh \ - ${TRICK_HOME}/trick_source/er7_utils/trick/integration/include/second_order_ode_integrator.hh \ + ${TRICK_HOME}/trick_source/er7_utils/trick/integration/include/trick_second_order_ode_integrator.hh \ ${TRICK_HOME}/include/trick/Euler_Integrator.hh \ ${TRICK_HOME}/trick_source/er7_utils/integration/euler/include/euler_integrator_constructor.hh \ ${TRICK_HOME}/trick_source/er7_utils/integration/euler/include/euler_first_order_ode_integrator.hh \ @@ -218,6 +218,18 @@ object_${TRICK_HOST_CPU}/IntegLoopManager.o: src/IntegLoopManager.cpp \ ${TRICK_HOME}/include/trick/sim_mode.h \ ${TRICK_HOME}/include/trick/exec_proto.h \ ${TRICK_HOME}/include/trick/sim_mode.h +object_${TRICK_HOST_CPU}/Integrator.o: src/Integrator.cpp \ + ${TRICK_HOME}/include/trick/Integrator.hh \ + ${TRICK_HOME}/include/trick/memorymanager_c_intf.h \ + ${TRICK_HOME}/include/trick/parameter_types.h \ + ${TRICK_HOME}/include/trick/attributes.h \ + ${TRICK_HOME}/include/trick/reference.h \ + ${TRICK_HOME}/include/trick/value.h \ + ${TRICK_HOME}/include/trick/dllist.h \ + ${TRICK_HOME}/include/trick/var.h \ + ${TRICK_HOME}/include/trick/io_alloc.h \ + ${TRICK_HOME}/include/trick/message_proto.h \ + ${TRICK_HOME}/include/trick/message_type.h object_${TRICK_HOST_CPU}/IntegLoopSimObject.o: src/IntegLoopSimObject.cpp \ ${TRICK_HOME}/include/trick/IntegLoopSimObject.hh \ ${TRICK_HOME}/include/trick/IntegLoopScheduler.hh \ @@ -267,7 +279,7 @@ object_${TRICK_HOST_CPU}/IntegLoopSimObject.o: src/IntegLoopSimObject.cpp \ ${TRICK_HOME}/trick_source/er7_utils/integration/core/include/integration_controls.hh \ ${TRICK_HOME}/trick_source/er7_utils/integration/abm4/include/abm4_second_order_ode_integrator.hh \ ${TRICK_HOME}/trick_source/er7_utils/integration/core/include/priming_second_order_ode_integrator.hh \ - ${TRICK_HOME}/trick_source/er7_utils/trick/integration/include/first_order_ode_integrator.hh \ + ${TRICK_HOME}/trick_source/er7_utils/trick/integration/include/trick_first_order_ode_integrator.hh \ ${TRICK_HOME}/trick_source/er7_utils/trick/integration/include/trick_integrator.hh \ ${TRICK_HOME}/include/trick/compat/sim_services/Integrator/include/Integrator.hh \ ${TRICK_HOME}/trick_source/er7_utils/integration/core/include/base_integration_group.hh \ @@ -285,7 +297,7 @@ object_${TRICK_HOST_CPU}/IntegLoopSimObject.o: src/IntegLoopSimObject.cpp \ ${TRICK_HOME}/trick_source/er7_utils/integration/symplectic_euler/include/symplectic_euler_integrator_constructor.hh \ ${TRICK_HOME}/trick_source/er7_utils/integration/euler/include/euler_first_order_ode_integrator.hh \ ${TRICK_HOME}/trick_source/er7_utils/integration/symplectic_euler/include/symplectic_euler_second_order_ode_integrator.hh \ - ${TRICK_HOME}/trick_source/er7_utils/trick/integration/include/second_order_ode_integrator.hh \ + ${TRICK_HOME}/trick_source/er7_utils/trick/integration/include/trick_second_order_ode_integrator.hh \ ${TRICK_HOME}/include/trick/Euler_Integrator.hh \ ${TRICK_HOME}/trick_source/er7_utils/integration/euler/include/euler_integrator_constructor.hh \ ${TRICK_HOME}/trick_source/er7_utils/integration/euler/include/euler_first_order_ode_integrator.hh \ @@ -338,18 +350,6 @@ object_${TRICK_HOST_CPU}/Integrator_C_Intf.o: src/Integrator_C_Intf.cpp \ ${TRICK_HOME}/include/trick/io_alloc.h \ ${TRICK_HOME}/include/trick/message_proto.h \ ${TRICK_HOME}/include/trick/message_type.h -object_${TRICK_HOST_CPU}/Integrator.o: src/Integrator.cpp \ - ${TRICK_HOME}/include/trick/Integrator.hh \ - ${TRICK_HOME}/include/trick/memorymanager_c_intf.h \ - ${TRICK_HOME}/include/trick/parameter_types.h \ - ${TRICK_HOME}/include/trick/attributes.h \ - ${TRICK_HOME}/include/trick/reference.h \ - ${TRICK_HOME}/include/trick/value.h \ - ${TRICK_HOME}/include/trick/dllist.h \ - ${TRICK_HOME}/include/trick/var.h \ - ${TRICK_HOME}/include/trick/io_alloc.h \ - ${TRICK_HOME}/include/trick/message_proto.h \ - ${TRICK_HOME}/include/trick/message_type.h object_${TRICK_HOST_CPU}/getIntegrator.o: src/getIntegrator.cpp \ ${TRICK_HOME}/include/trick/memorymanager_c_intf.h \ ${TRICK_HOME}/include/trick/parameter_types.h \ @@ -432,7 +432,7 @@ object_${TRICK_HOST_CPU}/getIntegrator.o: src/getIntegrator.cpp \ ${TRICK_HOME}/include/trick/Integrator.hh \ ${TRICK_HOME}/include/trick/IntegAlgorithms.hh \ ${TRICK_HOME}/include/trick/ABM_Integrator.hh \ - ${TRICK_HOME}/trick_source/er7_utils/trick/integration/include/first_order_ode_integrator.hh \ + ${TRICK_HOME}/trick_source/er7_utils/trick/integration/include/trick_first_order_ode_integrator.hh \ ${TRICK_HOME}/trick_source/er7_utils/trick/integration/include/trick_integrator.hh \ ${TRICK_HOME}/include/trick/compat/sim_services/Integrator/include/Integrator.hh \ ${TRICK_HOME}/trick_source/er7_utils/integration/core/include/base_integration_group.hh \ @@ -444,7 +444,7 @@ object_${TRICK_HOST_CPU}/getIntegrator.o: src/getIntegrator.cpp \ ${TRICK_HOME}/trick_source/er7_utils/integration/core/include/integrator_interface.hh \ ${TRICK_HOME}/trick_source/er7_utils/integration/core/include/time_interface.hh \ ${TRICK_HOME}/include/trick/Euler_Cromer_Integrator.hh \ - ${TRICK_HOME}/trick_source/er7_utils/trick/integration/include/second_order_ode_integrator.hh \ + ${TRICK_HOME}/trick_source/er7_utils/trick/integration/include/trick_second_order_ode_integrator.hh \ ${TRICK_HOME}/include/trick/Euler_Integrator.hh \ ${TRICK_HOME}/include/trick/MM4_Integrator.hh \ ${TRICK_HOME}/include/trick/NL2_Integrator.hh \ diff --git a/trick_source/sim_services/MemoryManager/CMakeLists.txt b/trick_source/sim_services/MemoryManager/CMakeLists.txt new file mode 100644 index 00000000..19903de0 --- /dev/null +++ b/trick_source/sim_services/MemoryManager/CMakeLists.txt @@ -0,0 +1,81 @@ +set( TRICK_MM_SRC + ADefParseContext + MemoryManager + MemoryManager_C_Intf + MemoryManager_JSON_Intf + MemoryManager_add_attr_info + MemoryManager_add_checkpoint_alloc_dependency + MemoryManager_add_shared_library_symbols + MemoryManager_add_template_name_trans + MemoryManager_add_var + MemoryManager_alloc_depends + MemoryManager_alloc_info_map + MemoryManager_clear_memory + MemoryManager_declare_var + MemoryManager_delete_var + MemoryManager_get_enumerated + MemoryManager_get_size + MemoryManager_get_stl_dependencies + MemoryManager_get_type_attributes + MemoryManager_io_src_intf + MemoryManager_is_alloced + MemoryManager_make_declaration + MemoryManager_make_reference_attr + MemoryManager_map_external_object + MemoryManager_realloc + MemoryManager_ref_allocate + MemoryManager_ref_assignment + MemoryManager_ref_attributes + MemoryManager_ref_dim + MemoryManager_ref_name + MemoryManager_ref_name_from_address + MemoryManager_ref_var + MemoryManager_restore + MemoryManager_restore_stls + MemoryManager_set_checkpointagent + MemoryManager_set_debug_level + MemoryManager_strdup + MemoryManager_write_checkpoint + MemoryManager_write_var + RefParseContext + addr_bitfield + extract_bitfield + extract_unsigned_bitfield + follow_address_path + insert_bitfield + parameter_types + ref_free + ref_to_value + trickTypeCharString + vval + wcs_ext +) + +# Sim services Lex/Yacc files +set( MM_LEX_YACC_SRC + ${CMAKE_BINARY_DIR}/temp_src/lex_yacc/adef_parser.lex + ${CMAKE_BINARY_DIR}/temp_src/lex_yacc/adef_parser.tab + ${CMAKE_BINARY_DIR}/temp_src/lex_yacc/ref_parser.lex + ${CMAKE_BINARY_DIR}/temp_src/lex_yacc/ref_parser.tab +) + +add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/temp_src/lex_yacc/adef_parser.lex.cpp + COMMAND ${FLEX_EXECUTABLE} -d -o ${CMAKE_BINARY_DIR}/temp_src/lex_yacc/adef_parser.lex.cpp ${CMAKE_CURRENT_SOURCE_DIR}/adef_parser.l + MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/adef_parser.l +) +add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/temp_src/lex_yacc/adef_parser.tab.cpp ${CMAKE_BINARY_DIR}/temp_src/lex_yacc/adef_parser.tab.hpp + COMMAND ${BISON_EXECUTABLE} -d -o ${CMAKE_BINARY_DIR}/temp_src/lex_yacc/adef_parser.tab.cpp ${CMAKE_CURRENT_SOURCE_DIR}/adef_parser.y + MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/adef_parser.y +) +add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/temp_src/lex_yacc/ref_parser.lex.cpp + COMMAND ${FLEX_EXECUTABLE} -d -o ${CMAKE_BINARY_DIR}/temp_src/lex_yacc/ref_parser.lex.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ref_parser.l + MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/ref_parser.l +) +add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/temp_src/lex_yacc/ref_parser.tab.cpp ${CMAKE_BINARY_DIR}/temp_src/lex_yacc/ref_parser.tab.hpp + COMMAND ${BISON_EXECUTABLE} -d -o ${CMAKE_BINARY_DIR}/temp_src/lex_yacc/ref_parser.tab.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ref_parser.y + MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/ref_parser.y +) + +add_library( trick_mm STATIC ${TRICK_MM_SRC} ${MM_LEX_YACC_SRC}) +target_include_directories( trick_mm PUBLIC ${UDUNITS2_INCLUDES} ) + diff --git a/trick_source/sim_services/MemoryManager/adef_parser.l b/trick_source/sim_services/MemoryManager/adef_parser.l index 61c6e0e7..ade84c8b 100644 --- a/trick_source/sim_services/MemoryManager/adef_parser.l +++ b/trick_source/sim_services/MemoryManager/adef_parser.l @@ -16,7 +16,7 @@ #include #include "trick/mm_error.h" #include "trick/ADefParseContext.hh" -#include "adef_parser.tab.h" +#include "adef_parser.tab.hpp" #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wsign-compare" diff --git a/trick_source/sim_services/MemoryManager/adef_parser.y b/trick_source/sim_services/MemoryManager/adef_parser.y index 27286eb1..0c33c032 100644 --- a/trick_source/sim_services/MemoryManager/adef_parser.y +++ b/trick_source/sim_services/MemoryManager/adef_parser.y @@ -19,7 +19,7 @@ #include "trick/value.h" #include "trick/var.h" #include "trick/ADefParseContext.hh" -#include "adef_parser.tab.h" +#include "adef_parser.tab.hpp" #pragma GCC diagnostic ignored "-Wunused-parameter" diff --git a/trick_source/sim_services/MemoryManager/ref_parser.l b/trick_source/sim_services/MemoryManager/ref_parser.l index 2eb7a5d0..367c124b 100644 --- a/trick_source/sim_services/MemoryManager/ref_parser.l +++ b/trick_source/sim_services/MemoryManager/ref_parser.l @@ -17,7 +17,7 @@ #include #include "trick/mm_error.h" #include "trick/RefParseContext.hh" -#include "ref_parser.tab.h" +#include "ref_parser.tab.hpp" #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wsign-compare" diff --git a/trick_source/sim_services/MemoryManager/ref_parser.y b/trick_source/sim_services/MemoryManager/ref_parser.y index d27cd98b..c43c4d03 100644 --- a/trick_source/sim_services/MemoryManager/ref_parser.y +++ b/trick_source/sim_services/MemoryManager/ref_parser.y @@ -19,7 +19,7 @@ #include "trick/vval.h" #include "trick/value.h" #include "trick/var.h" -#include "ref_parser.tab.h" +#include "ref_parser.tab.hpp" #pragma GCC diagnostic ignored "-Wunused-parameter" diff --git a/trick_source/trick_swig/sim_services.i b/trick_source/trick_swig/sim_services.i index 1984d64d..c2ea71d8 100644 --- a/trick_source/trick_swig/sim_services.i +++ b/trick_source/trick_swig/sim_services.i @@ -150,8 +150,8 @@ #include "er7_utils/integration/core/include/integrator_constructor_factory.hh" #include "er7_utils/integration/core/include/integrable_object.hh" #include "er7_utils/integration/core/include/base_integration_group.hh" -#include "er7_utils/trick/integration/include/first_order_ode_integrator.hh" -#include "er7_utils/trick/integration/include/second_order_ode_integrator.hh" +#include "er7_utils/trick/integration/include/trick_first_order_ode_integrator.hh" +#include "er7_utils/trick/integration/include/trick_second_order_ode_integrator.hh" #endif %} diff --git a/trick_source/trick_utils/CMakeLists.txt b/trick_source/trick_utils/CMakeLists.txt new file mode 100644 index 00000000..aca9fec6 --- /dev/null +++ b/trick_source/trick_utils/CMakeLists.txt @@ -0,0 +1,28 @@ + + +# Trick utils files that are not in their own library +set( TRICK_UTILS_SRC + interpolator/src/Interpolator.cpp + shm/src/tsm_disconnect + shm/src/tsm_init + shm/src/tsm_init_with_lock + shm/src/tsm_reconnect + trick_adt/src/MapStrToPtr + trick_adt/src/bst + trick_adt/src/bubble_sort + trick_adt/src/dllist + trick_adt/src/lqueue + trick_adt/src/lstack + trick_adt/src/record_array + unicode/src/unicode_utils +) +add_library( trick_utils_objs OBJECT ${TRICK_UTILS_SRC} ) + +############################################################### +# Other Trick libraries +############################################################### + +add_subdirectory(comm) +add_subdirectory(math) +add_subdirectory(units) + diff --git a/trick_source/trick_utils/comm/CMakeLists.txt b/trick_source/trick_utils/comm/CMakeLists.txt new file mode 100644 index 00000000..402f5b4b --- /dev/null +++ b/trick_source/trick_utils/comm/CMakeLists.txt @@ -0,0 +1,31 @@ + +set( TRICKCOMM_SRC + src/tc_accept + src/tc_blockio + src/tc_broadcast_conninfo + src/tc_clock_init + src/tc_clock_time + src/tc_connect + src/tc_dev_copy + src/tc_disconnect + src/tc_error + src/tc_init + src/tc_init_mcast_client + src/tc_init_mcast_server + src/tc_init_udp_client + src/tc_init_udp_server + src/tc_isValid + src/tc_listen + src/tc_multiconnect + src/tc_pending + src/tc_read + src/tc_read_byteswap + src/tc_set_blockio + src/tc_write + src/tc_write_byteswap + src/trick_bswap_buffer + src/trick_byteswap + src/trick_error_hndlr +) + +add_library( trick_comm STATIC ${TRICKCOMM_SRC}) diff --git a/trick_source/trick_utils/math/CMakeLists.txt b/trick_source/trick_utils/math/CMakeLists.txt new file mode 100644 index 00000000..3480e3aa --- /dev/null +++ b/trick_source/trick_utils/math/CMakeLists.txt @@ -0,0 +1,92 @@ + +set( TRICKMATH_SRC + src/LUD_inv + src/LUT_inv + src/LU_bksb + src/LU_dcmp + src/RodriguesRotation + src/dLU_Choleski + src/dLU_solver + src/dS_function + src/deuler_123 + src/deuler_123_quat + src/deuler_132 + src/deuler_132_quat + src/deuler_213 + src/deuler_213_quat + src/deuler_231 + src/deuler_231_quat + src/deuler_312 + src/deuler_312_quat + src/deuler_321 + src/deuler_321_quat + src/dm_add + src/dm_copy + src/dm_ident + src/dm_init + src/dm_invert + src/dm_invert_symm + src/dm_orthonormal + src/dm_print + src/dm_scale + src/dm_sub + src/dm_trans + src/dmtxm + src/dmtxmt + src/dmtxv + src/dmxm + src/dmxmt + src/dmxv + src/drandom_gaussian + src/dsingle_axis_rot + src/dv_add + src/dv_copy + src/dv_cross + src/dv_dot + src/dv_init + src/dv_mag + src/dv_norm + src/dv_print + src/dv_scale + src/dv_skew + src/dv_store + src/dv_sub + src/dvxm + src/dvxv_add + src/dvxv_sub + src/eigen_hh_red + src/eigen_jacobi + src/eigen_jacobi_4 + src/eigen_ql + src/euler_matrix + src/euler_quat + src/gauss_rnd_bell + src/gauss_rnd_pseudo + src/mat_copy + src/mat_permute + src/mat_print + src/mat_to_quat + src/mat_trans + src/matxmat + src/matxtrans + src/matxvec + src/quat_mult + src/quat_norm + src/quat_norm_integ + src/quat_to_mat + src/rand_num + src/roundoff + src/tm_print_error + src/transxmat + src/transxtrans + src/transxvec + src/trick_gsl_rand + src/trns_fnct_1o + src/trns_fnct_2o + src/uniform_rnd_1 + src/uniform_rnd_triple + src/vec_print + src/wave_form +) + +add_library( trick_math STATIC ${TRICKMATH_SRC}) diff --git a/trick_source/trick_utils/units/CMakeLists.txt b/trick_source/trick_utils/units/CMakeLists.txt new file mode 100644 index 00000000..613529c7 --- /dev/null +++ b/trick_source/trick_utils/units/CMakeLists.txt @@ -0,0 +1,9 @@ + +set( TRICK_UNITS_SRC + src/UCFn.cpp + src/Unit.cpp + src/units_conv +) + +add_library( trick_units STATIC ${TRICK_UNITS_SRC}) +