Skip to content

Commit

Permalink
To support ubuntu24, clang 18+, and gcc13.
Browse files Browse the repository at this point in the history
  • Loading branch information
hchen99 committed Nov 15, 2024
1 parent 0292b52 commit 7a207da
Show file tree
Hide file tree
Showing 8 changed files with 153 additions and 80 deletions.
28 changes: 17 additions & 11 deletions autoconf/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,23 @@ AC_PATH_PROG(CLANG, clang, noclang, "$LLVM_BIN_DIR:/bin:/usr/bin:/usr/local/bin:
AS_IF([test "$ac_cv_path_CLANG" = "noclang"],AC_MSG_ERROR([could not find clang]),[])
AC_SUBST([LLVM_HOME])

OLD_CLANG_LIBS="-lclangFrontend -lclangDriver -lclangSerialization -lclangParse -lclangSema -lclangAnalysis -lclangEdit -lclangAST -lclangLex -lclangBasic"
TR_CLANG_VERSION
dnl if llvm/clang, test for version >= 3.4.2
AS_IF([test "x$CLANG_VERSION" = "x"],[],
[AC_MSG_CHECKING([clang version >= 3.4.2])
AX_COMPARE_VERSION([$CLANG_VERSION],[ge],[3.4.2], [AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_ERROR([Trick requires llvm/clang version >= 3.4.2])
])
])

AS_IF([test "x$CLANG_VERSION" = "x"],[],
[AX_COMPARE_VERSION([$CLANG_VERSION],[ge],[18.0.0],
[OLD_CLANG_LIBS="-lclangFrontend -lclangDriver -lclangSerialization -lclangParse -lclangSema -lclangAnalysis -lclangEdit -lclangAST -lclangASTMatchers -lclangAPINotes -lclangLex -lclangBasic"],
[OLD_CLANG_LIBS="-lclangFrontend -lclangDriver -lclangSerialization -lclangParse -lclangSema -lclangAnalysis -lclangEdit -lclangAST -lclangLex -lclangBasic"]
)]
)

NEW_CLANG_LIBS="-lclang-cpp"
AC_CHECK_FILE([$LLVM_LIB_DIR/libclangFrontend.a],
[
Expand Down Expand Up @@ -237,16 +253,6 @@ AC_CHECK_FILE([$LLVM_LIB_DIR/libclangSupport.a],[ICG_CLANGLIBS="$ICG_CLANGLIBS -

AC_SUBST([ICG_CLANGLIBS])

TR_CLANG_VERSION
dnl if llvm/clang, test for version >= 3.4.2
AS_IF([test "x$CLANG_VERSION" = "x"],[],
[AC_MSG_CHECKING([clang version >= 3.4.2])
AX_COMPARE_VERSION([$CLANG_VERSION],[ge],[3.4.2], [AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_ERROR([Trick requires llvm/clang version >= 3.4.2])
])
])

AX_CHECK_ZLIB([],AC_MSG_ERROR([could not find zlib]))

dnl look for udunits in /usr/include and /usr/include/udunits2
Expand Down
178 changes: 116 additions & 62 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions libexec/trick/pm/parse_s_define.pm
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,9 @@ sub handle_sim_class ($$$$) {

sub handle_sim_class_job($$$) {
my ($in_job, $job_id, $sim_ref) = @_ ;

print "in_job=$in_job\n";

my ($job_push, $is_dynamic_event) ;
my ( $child, $phase, $cycle, $start, $stop, $ov_class ,
$ov_class_self, $sup_class_data, $tag, $job_call, $job_ret, $job_name, $args , $class ) ;
Expand All @@ -716,8 +719,8 @@ sub handle_sim_class_job($$$) {
$ov_class , $ov_class_self , $sup_class_data, $tag, $job_call, $job_ret, $job_name, $args) = $in_job =~ /
(?:
\s*(?:
([Cc][\w\.\-\>]+) | # child spec
([Pp][\w\.\-\>]+) | # phase spec
([Cc][\w\.\-\>]+)?\s* # child spec
([Pp][\w\.\-\>]+)?\s* # phase spec
(?:
\(
(?:
Expand All @@ -742,6 +745,8 @@ sub handle_sim_class_job($$$) {
)\s*; # end job call
/sx ;

print "The specified child is $child \n";
print "The specified cycle is $cycle \n";

$child = 0 if ( $child eq "" ) ;
$child =~ s/^C// ;
Expand Down Expand Up @@ -777,6 +782,8 @@ sub handle_sim_class_job($$$) {
}
}

print "The specified phase is $phase\n";

if ( $phase ne "" ) {
$phase =~ s/^P// ;
$job_push .= ", $phase" ;
Expand Down
6 changes: 5 additions & 1 deletion share/trick/makefiles/config_Linux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,9 @@ ifeq "" "c++11"
TRICK_ADDITIONAL_CXXFLAGS += -std=c++11 -D_HAVE_STL_RANDOM
endif

TRICK_ADDITIONAL_TEST_FLAGS += -std=c++11
ifeq "" "c++14"
TRICK_ADDITIONAL_CXXFLAGS += -std=c++14 -D_HAVE_STL_RANDOM
endif

TRICK_ADDITIONAL_TEST_FLAGS += -std=c++14

3 changes: 2 additions & 1 deletion test/SIM_mc_generation/S_overrides.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
TRICK_CFLAGS += -g -Wall -Wextra
TRICK_CXXFLAGS += -g -std=c++11 -Wall -Wextra
TRICK_CXXFLAGS += -g -std=c++11 -Wall -Wextra -Wno-error=unused-parameter
# We can't yet make warnings to be errors on MacOS, because
# MACOS deprecates and warns about sprintf. But SWIG
# still generates code containing sprintf..
ifneq ($(TRICK_HOST_TYPE), Darwin)
TRICK_CXXFLAGS += -Werror -Wno-stringop-truncation
endif

4 changes: 2 additions & 2 deletions test/SIM_stls/S_overrides.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

TRICK_CFLAGS += -I./models
TRICK_CFLAGS += -I./models -DTRICK_UNIT_TEST
TRICK_CXXFLAGS += -I./models

TRICK_CXXFLAGS += -std=c++11
TRICK_CXXFLAGS += -std=c++11 -DTRICK_UNIT_TEST

clean: checkpoint_clean

Expand Down
1 change: 1 addition & 0 deletions test/SIM_stls/models/STLCheckpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -759,5 +759,6 @@ int STLCheckpoint::test() {
TRICK_EXPECT_EQ(vec_user_simple[i].d->c, "Here is a test string", test_suite, "vec_user_simple");
}

return 0;

}
2 changes: 1 addition & 1 deletion test/SIM_test_sched/S_overrides.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

TRICK_CFLAGS += -I./models
TRICK_CXXFLAGS += -I./models
TRICK_CXXFLAGS += -std=c++11 -I./models

0 comments on commit 7a207da

Please sign in to comment.