diff --git a/CMakeTestFiles/TestICGLinkedLibs.cpp b/CMakeTestFiles/TestICGLinkedLibs.cpp new file mode 100644 index 00000000..bb243bcf --- /dev/null +++ b/CMakeTestFiles/TestICGLinkedLibs.cpp @@ -0,0 +1,17 @@ +#include "llvm/Support/Host.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/raw_ostream.h" + +#include "clang/Basic/Builtins.h" +#include "clang/Frontend/CompilerInstance.h" +#include "clang/Basic/TargetOptions.h" +#include "clang/Basic/TargetInfo.h" +#include "clang/Basic/FileManager.h" +#include "clang/Lex/Preprocessor.h" +#include "clang/Lex/PreprocessorOptions.h" +#include "clang/Basic/Diagnostic.h" +#include "clang/Parse/ParseAST.h" + +int main() { + return 0; +} \ No newline at end of file diff --git a/libexec/trick/sie_concat b/libexec/trick/sie_concat index 676fac26..aa080e28 100755 --- a/libexec/trick/sie_concat +++ b/libexec/trick/sie_concat @@ -14,7 +14,9 @@ while(my $line = <$classes_resource>) { close($classes_resource); open(my $sim_services_resource, "<", "$ENV{TRICK_HOME}/trick_source/sim_services/include/sim_services_classes.resource") - or die "cannot open trick/trick_source/sim_services/include/sim_services_classes.resource"; + or open(my $sim_services_resource, "<", "$ENV{TRICK_HOME}/temp_src/io_src/sim_services_classes.resource") + or die "cannot open sim_services_classes.resource"; + while(my $line = <$sim_services_resource>) { print $S_sie_resource $line; } diff --git a/trick_source/codegen/Interface_Code_Gen/CMakeLists.txt b/trick_source/codegen/Interface_Code_Gen/CMakeLists.txt index 9a2b5684..ba656b12 100644 --- a/trick_source/codegen/Interface_Code_Gen/CMakeLists.txt +++ b/trick_source/codegen/Interface_Code_Gen/CMakeLists.txt @@ -23,6 +23,26 @@ set ( ICG_SRC ../../sim_services/UdUnits/map_trick_units_to_udunits ) +set (ICG_CLANGLIBS + -lclangFrontend + -lclangDriver + -lclangSerialization + -lclangParse + -lclangSema + -lclangAnalysis + -lclangEdit + -lclangAST + -lclangLex + -lclangBasic + ) + +try_compile(haveOldLibs "${CMAKE_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/CMakeTestFiles/TestICGLinkedLibs.cpp" CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${LLVM_INCLUDE_DIRS}") +if(NOT haveOldLibs) + set (ICG_CLANGLIBS + -lclang-cpp + ) +endif() + add_executable( trick-ICG ${ICG_SRC} ) target_compile_options( trick-ICG PUBLIC -g -DTRICK_VERSION="${TRICK_MAJOR}.${TRICK_MINOR}.${TRICK_TINY}" -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS) target_compile_options( trick-ICG PUBLIC -DEXTERNAL_BUILD) @@ -34,16 +54,7 @@ set_property(SOURCE trick-ICG APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_BINARY_DIR} set_target_properties( trick-ICG PROPERTIES CXX_STANDARD 14) target_link_libraries( trick-ICG - -lclangFrontend - -lclangDriver - -lclangSerialization - -lclangParse - -lclangSema - -lclangAnalysis - -lclangEdit - -lclangAST - -lclangLex - -lclangBasic + ${ICG_CLANGLIBS} ${LLVM_LDFLAGS} ${LLVM_LIBRARIES} ${UDUNITS2_LIBRARIES} diff --git a/trick_source/codegen/Interface_Code_Gen/PrintAttributes.cpp b/trick_source/codegen/Interface_Code_Gen/PrintAttributes.cpp index 7671ef90..f91ea391 100644 --- a/trick_source/codegen/Interface_Code_Gen/PrintAttributes.cpp +++ b/trick_source/codegen/Interface_Code_Gen/PrintAttributes.cpp @@ -276,7 +276,11 @@ void PrintAttributes::printEnum(EnumValues* ev) { void PrintAttributes::printSieClass( ClassValues * cv ) { std::string xmlFileName; if(sim_services_flag) { + #ifdef EXTERNAL_BUILD + xmlFileName = output_dir + "/sim_services_classes.resource"; + #else xmlFileName = std::string(getenv("TRICK_HOME")) + "/trick_source/sim_services/include/sim_services_classes.resource"; + #endif } else { xmlFileName = "build/classes.resource"; } @@ -313,7 +317,12 @@ void PrintAttributes::printSieClass( ClassValues * cv ) { void PrintAttributes::printSieEnum( EnumValues * ev ) { std::string xmlFileName; if(sim_services_flag) { + #ifdef EXTERNAL_BUILD + xmlFileName = output_dir + "/sim_services_classes.resource"; + #else xmlFileName = std::string(getenv("TRICK_HOME")) + "/trick_source/sim_services/include/sim_services_classes.resource"; + #endif + } else { xmlFileName = "build/classes.resource"; }