1053, 1009, 1054 cmake update (#1055)

* #1053 #1009 cmake configure correct clang libs

* #1054 fix sie-rework to be compatible with CMake build

closes #1053  closes #1009  closes #1054
This commit is contained in:
Scott Fennell 2020-09-13 18:38:35 -05:00 committed by GitHub
parent c9f060c94f
commit 5bb32279b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 11 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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}

View File

@ -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";
}