Skip to content

Commit

Permalink
Move configuration headers to OMCompiler/
Browse files Browse the repository at this point in the history
  - Configuration headers like `omc_config.h` should not be deep down in
    the OMCompiler/Compiler/runtime folder. They belong to the top scope
    where their effect applies.

  - `omc_config.h` is moved from `OMCompiler/Compiler/runtime` to `OMCompiler/`

  - `config.unix.h.in` is also  moved from `OMCompiler/Compiler/runtime` to
    `OMCompiler/` and is renamed to `omc_config.unix.h.in`

  - `revision.h.in` is moved from `OMCompiler/Compiler/runtime` to `OMCompiler/`

    This also means `revision.h` and `omc_config.unix.h` will be generated
    in the OMCompiler directory.
  • Loading branch information
mahge committed Aug 11, 2021
1 parent b9a2996 commit 702aee8
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 25 deletions.
2 changes: 1 addition & 1 deletion OMCompiler/.gitignore
Expand Up @@ -84,6 +84,7 @@ build_cmake/
.metadata
.vscode/
revision.h
omc_config.unix.h
SimulationRuntime/c/Makefile
SimulationRuntime/OMSICpp/Makefile
SimulationRuntime/OMSICpp/Makefile.env
Expand Down Expand Up @@ -148,7 +149,6 @@ Compiler/boot/Makefile.depends
Compiler/boot/Makefile.sources
Compiler/boot/patches/*.patch
Compiler/runtime/Makefile
Compiler/runtime/config.unix.h
Compiler/runtime/omc_communication.cc
Compiler/runtime/omc_communication.h
Compiler/susan_codegen/TplCodegen.mo
Expand Down
8 changes: 4 additions & 4 deletions OMCompiler/Compiler/runtime/CMakeLists.txt
Expand Up @@ -192,7 +192,7 @@ target_link_libraries(omcgraphstream-boot PUBLIC omc::3rd::netstream)


################################################################################
# This is a lazy approach to generating runtime/config.unix.h and Compiler/Util/Autoconf.mo
# This is a lazy approach to generating OMCompiler/omc_config.unix.h and Compiler/Util/Autoconf.mo
# Needs to be refactored quite a bit. The variable names should be updated to be more
# unique and descriptive.
# However, If I do that I need to update the .in files which means the normal compilation is
Expand Down Expand Up @@ -255,11 +255,11 @@ set(WITH_UUID "#define WITH_LIBUUID 1")

set(USE_GRAPH 0)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/revision.h.in ${CMAKE_CURRENT_SOURCE_DIR}/revision.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.unix.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.unix.h)
configure_file(${OMCompiler_SOURCE_DIR}/revision.h.in ${OMCompiler_SOURCE_DIR}/revision.h)
configure_file(${OMCompiler_SOURCE_DIR}/omc_config.unix.h.in ${OMCompiler_SOURCE_DIR}/omc_config.unix.h)


# Generate Autoconf.mo here since we have some of the variables already defined for config.unix.h above.
# Generate Autoconf.mo here since we have some of the variables already defined for omc_config.unix.h above.

if(WIN32)

Expand Down
12 changes: 6 additions & 6 deletions OMCompiler/Compiler/runtime/Makefile.common
@@ -1,8 +1,6 @@
#
# Makefile for Compiler/runtime
#
# $Id$
#

top_builddir=../..
builddir_bin=$(OMBUILDDIR)/bin
Expand All @@ -16,7 +14,7 @@ LDFLAGS += ../../3rdParty/FMIL/build/Config.cmake/Minizip/libminizip.a
SimRuntimeCDir = $(top_builddir)/SimulationRuntime/c/

ifndef OMDEV
configUnix = config.unix.h
configUnix = $(OMC_CONFIG_INC)/omc_config.unix.h
else
configUnix =
endif
Expand All @@ -42,8 +40,10 @@ OMC_OBJ = $(OMC_OBJ_SHARED) \

all: install
.PHONY: all install

install: libomcruntime$(SHREXT) libomcgraphstream.a libomcbackendruntime.a
cp libomcruntime$(SHREXT) $(builddir_lib)/$(TRIPLE)/omc/

OBJEXT=.o
BOOTH=../OpenModelicaBootstrappingHeader.h
ifeq ($(BOOTSTRAPPING),1)
Expand Down Expand Up @@ -109,7 +109,7 @@ Print_omc.o : printimpl.c printimpl.h
omc_communication_impl.o: omc_communication.h
Corba_omc.o: omc_communication.h corbaimpl.cpp
Database_omc.o: Database.c Database_omc.c
Lapack_omc.o : lapackimpl.c omc_config.h $(configUnix) $(RML_COMPAT)
Lapack_omc.o : lapackimpl.c $(configUnix) $(RML_COMPAT) $(OMC_CONFIG_INC)/omc_config.h
IOStreamExt_omc.o : IOStreamExt.c
ErrorMessage.o : ErrorMessage.cpp ErrorMessage.hpp errorext.h
serializer.o: serializer.cpp
Expand All @@ -123,15 +123,15 @@ ffi_omc.o : ffi_omc.c
# Objects depending on BOOTH
Dynload_omc$(OBJEXT): systemimpl.h errorext.h $(BOOTH) $(SimRuntimeCDir)/util/read_write.h $(SimRuntimeCDir)/gc/omc_gc.h Dynload.cpp $(RML_COMPAT)
Error_omc$(OBJEXT) : errorext.cpp ErrorMessage.hpp $(BOOTH)
System_omc$(OBJEXT) : System_omc.c systemimpl.c omc_config.h errorext.h printimpl.h $(configUnix) $(RML_COMPAT) $(BOOTH)
System_omc$(OBJEXT) : System_omc.c systemimpl.c errorext.h printimpl.h $(configUnix) $(RML_COMPAT) $(BOOTH) $(OMC_CONFIG_INC)/omc_config.h
SimulationResults_omc$(OBJEXT) : SimulationResults.c SimulationResultsCmp.c SimulationResultsCmpTubes.c errorext.h $(SimRuntimeCDir)/util/read_matlab4.h $(BOOTH)
TaskGraphResults_omc$(OBJEXT) : TaskGraphResultsCmp.h TaskGraphResultsCmp.cpp $(BOOTH)
HpcOmBenchmarkExt_omc$(OBJEXT) : HpcOmBenchmarkExt.cpp $(BOOTH)
HpcOmSchedulerExt_omc$(OBJEXT) : TaskGraphResultsCmp.h HpcOmSchedulerExt.cpp $(BOOTH)
ptolemyio_omc$(OBJEXT) : ptolemyio.cpp errorext.h $(RML_COMPAT) $(BOOTH)
FMI_omc$(OBJEXT) : FMIImpl.c $(BOOTH)
GraphStreamExt_omc$(OBJEXT) : $(BOOTH) GraphStreamExt_impl.cpp $(RML_COMPAT)
Settings_omc$(OBJEXT) : Settings_omc.cpp settingsimpl.c omc_config.h $(configUnix) $(BOOTH)
Settings_omc$(OBJEXT) : Settings_omc.cpp settingsimpl.c $(configUnix) $(BOOTH) $(OMC_CONFIG_INC)/omc_config.h

%.boot.o: %.c
$(CC) -c -o "$@" "$<" $(CFLAGS) $(CPPFLAGS) -DOPENMODELICA_BOOTSTRAPPING_FILE -I../boot/tarball-include/
Expand Down
7 changes: 3 additions & 4 deletions OMCompiler/Compiler/runtime/Makefile.in
Expand Up @@ -13,6 +13,8 @@ GRAPHSTREAMINCLUDE = ../../3rdParty/graphstream/gs-netstream/c++/src/
CJSONINCLUDE = ../../3rdParty/cJSON
ZMQINCLUDE = ../../3rdParty/libzmq/include
GCINCLUDE = -DGC_THREADS -I$(top_builddir)/3rdParty/gc/include
OMC_CONFIG_INC = $(top_builddir)

CFLAGS = @CFLAGS@ @CHECK_C_ERRORS@ $(USE_CORBA)
OMPCC = @CC@ @OMPCFLAGS@
OMBUILDDIR = @OMBUILDDIR@
Expand All @@ -34,16 +36,13 @@ CXX = @CXX@
IDL = @IDLCMD@
IDLPYTHON = @IDLPYTHONCMD@
CXXFLAGS = @CXXFLAGS@
CPPFLAGS = @CPPFLAGS@ -I$(top_builddir)/SimulationRuntime/c -I$(top_builddir)/SimulationRuntime/c/simulation/results -I$(top_builddir)/SimulationRuntime/c/util -I$(top_builddir)/SimulationRuntime/c/meta -I$(top_builddir)/SimulationRuntime/c/meta/gc -I. $(CORBAINCL) $(GCINCLUDE) -I$(FMIINCLUDE) -I$(GRAPHSTREAMINCLUDE) -I$(GRAPHINCLUDE) -I$(CJSONINCLUDE) -I$(ZMQINCLUDE) -I"$(TOP_DIR)/3rdParty/FMIL/ThirdParty/Zlib/zlib-1.2.6" -I"$(TOP_DIR)/3rdParty/FMIL/build/zlib/" -I"$(TOP_DIR)/3rdParty/libffi/install/include/"
CPPFLAGS = @CPPFLAGS@ -I$(OMC_CONFIG_INC) -I$(top_builddir)/SimulationRuntime/c -I$(top_builddir)/SimulationRuntime/c/simulation/results -I$(top_builddir)/SimulationRuntime/c/util -I$(top_builddir)/SimulationRuntime/c/meta -I$(top_builddir)/SimulationRuntime/c/meta/gc -I. $(CORBAINCL) $(GCINCLUDE) -I$(FMIINCLUDE) -I$(GRAPHSTREAMINCLUDE) -I$(GRAPHINCLUDE) -I$(CJSONINCLUDE) -I$(ZMQINCLUDE) -I"$(TOP_DIR)/3rdParty/FMIL/ThirdParty/Zlib/zlib-1.2.6" -I"$(TOP_DIR)/3rdParty/FMIL/build/zlib/" -I"$(TOP_DIR)/3rdParty/libffi/install/include/"
TRIPLE=@host_short@
SHREXT=@SHREXT@
RPATH=@RPATH@
LDFLAGS = -L "$(builddir_lib)/$(TRIPLE)/omc/" -lOpenModelicaRuntimeC @OMCRUNTIME_SHARED_LDFLAGS@

include Makefile.common

config.unix.h: config.unix.h.in
cd $(top_builddir) && ./config.status

Makefile: Makefile.in
cd @top_builddir@ && ./config.status
4 changes: 3 additions & 1 deletion OMCompiler/Compiler/runtime/Makefile.omdev.mingw
Expand Up @@ -30,6 +30,8 @@ LPSOLVEINCLUDE = ../../3rdParty/lpsolve/build/include/
SQLITE3INCLUDE = ../../3rdParty/sqlite3/build/include/
ZMQINCLUDE = ../../3rdParty/libzmq/include
GCINCLUDE = -DGC_WIN32_PTHREADS -I../../3rdParty/gc/include
OMC_CONFIG_INC = $(top_builddir)

OMC=$(OMBUILDDIR)/bin/omc
SHREXT=.a
OMPCC = gcc -fopenmp
Expand All @@ -49,7 +51,7 @@ OMCCORBASRC = omc_communication.o omc_communication_impl.o Corba_omc.o
SHELL = /bin/sh
CC = gcc
CXX = g++
override CFLAGS += -I. $(USE_CORBA) $(USE_METIS) -Werror=implicit-function-declaration -Wall -Wno-unused-variable -I../../ -I$(top_builddir) -I$(top_builddir)/SimulationRuntime/c -I$(top_builddir)/SimulationRuntime/c/simulation/results -I$(top_builddir)/SimulationRuntime/c/util -I$(top_builddir)/SimulationRuntime/c/meta -I$(top_builddir)/SimulationRuntime/c/meta/gc $(CORBAINCL) $(GCINCLUDE) -I$(FMIINCLUDE) -I$(GRAPHSTREAMINCLUDE) -I$(CJSONINCLUDE) -I$(GRAPHINCLUDE) -I$(LPSOLVEINCLUDE) -I$(SQLITE3INCLUDE) -I$(ZMQINCLUDE) -I"$(TOP_DIR)/3rdParty/FMIL/ThirdParty/Zlib/zlib-1.2.6" -I"$(TOP_DIR)/3rdParty/FMIL/build/zlib/" -I"$(TOP_DIR)/3rdParty/libffi/install/include/"
override CFLAGS += $(USE_CORBA) $(USE_METIS) -Werror=implicit-function-declaration -Wall -Wno-unused-variable -I$(OMC_CONFIG_INC) -I$(top_builddir)/SimulationRuntime/c -I$(top_builddir)/SimulationRuntime/c/simulation/results -I$(top_builddir)/SimulationRuntime/c/util -I$(top_builddir)/SimulationRuntime/c/meta -I$(top_builddir)/SimulationRuntime/c/meta/gc $(CORBAINCL) $(GCINCLUDE) -I$(FMIINCLUDE) -I$(GRAPHSTREAMINCLUDE) -I$(CJSONINCLUDE) -I$(GRAPHINCLUDE) -I$(LPSOLVEINCLUDE) -I$(SQLITE3INCLUDE) -I$(ZMQINCLUDE) -I"$(TOP_DIR)/3rdParty/FMIL/ThirdParty/Zlib/zlib-1.2.6" -I"$(TOP_DIR)/3rdParty/FMIL/build/zlib/" -I"$(TOP_DIR)/3rdParty/libffi/install/include/"
override CXXFLAGS += -std=c++11 $(CFLAGS)

include Makefile.common
3 changes: 3 additions & 0 deletions OMCompiler/Makefile.in
Expand Up @@ -101,6 +101,9 @@ settings:

omc: omc-bootstrapped

omc_config.unix.h: omc_config.unix.h.in
cd $(top_builddir) && ./config.status

boehm-gc-lib: @LIBGC@
$(OMBUILDDIR)/$(LIB_OMC)/libomcgc.so: 3rdParty/gc/.libs/libomcgc.so
mkdir -p $(OMBUILDDIR)/$(LIB_OMC)
Expand Down
3 changes: 2 additions & 1 deletion OMCompiler/Parser/Makefile.common
Expand Up @@ -3,8 +3,9 @@ ANTLR=../3rdParty/antlr/3.2/libantlr3c-3.2
ANTLRJAR = $(ANTLR)/../tool/antlr-3.2.jar
#ANTLRJAR = $(ANTLR)/../tool/antlr-3.4-complete.jar
ANTLRCMD=java -cp $(ANTLRJAR) org.antlr.Tool -Xconversiontimeout 10000 -report
OMC_CONFIG_INC = ../

BUILDINC = -I../Compiler/runtime -I../SimulationRuntime/c/meta -I../SimulationRuntime/c/ -I../SimulationRuntime/c/meta/gc -I../SimulationRuntime/c/util
BUILDINC = -I$(OMC_CONFIG_INC) -I../Compiler/runtime -I../SimulationRuntime/c/meta -I../SimulationRuntime/c/ -I../SimulationRuntime/c/meta/gc -I../SimulationRuntime/c/util

.PHONY: all
.SUFFIXES: .h .c .o
Expand Down
2 changes: 1 addition & 1 deletion OMCompiler/Parser/Makefile.omdev.mingw
@@ -1,7 +1,7 @@
CC=gcc
CXX=g++
CFLAGS=-O3 -Wall
CPPFLAGS=$(RMLINC) -I.. -I. -I$(ANTLR) -I$(ANTLR)/include $(BUILDINC) -I../3rdParty/gc/include
CPPFLAGS=$(RMLINC) -I. -I$(ANTLR) -I$(ANTLR)/include $(BUILDINC) -I../3rdParty/gc/include
SHREXT=.dll

OMBUILDDIR=../build
Expand Down
3 changes: 2 additions & 1 deletion OMCompiler/SimulationRuntime/c/Makefile.common
Expand Up @@ -5,6 +5,7 @@
# for both UNIX/Linux and Windows platforms.

BUILDPATH?=build/c
OMC_CONFIG_INC=$(top_builddir)

# Forces the generation of the dgesv sources
NEED_DGESV=1
Expand All @@ -14,7 +15,7 @@ LIBSIMULATIONFMI=libSimulationRuntimeFMI.a
OMC_MINIMAL_RUNTIME=
INCLUDE_NONFMI=-I. -I$(builddir_inc)/c

CPPFLAGS = -I$(top_builddir)/Compiler/runtime -I$(top_builddir)/3rdParty/gc/include -I$(top_builddir)/3rdParty/FMIL/install/include/ -I$(top_builddir)/3rdParty/lis-1.4.12/include/ -I$(builddir_inc)/c/sundials/ -I$(builddir_inc)/c/suitesparse/ $(CONFIG_CPPFLAGS) -DGC_REDIRECT_TO_LOCAL -DLINK_SUNDIALS_STATIC
CPPFLAGS = -I$(OMC_CONFIG_INC) -I$(top_builddir)/Compiler/runtime -I$(top_builddir)/3rdParty/gc/include -I$(top_builddir)/3rdParty/FMIL/install/include/ -I$(top_builddir)/3rdParty/lis-1.4.12/include/ -I$(builddir_inc)/c/sundials/ -I$(builddir_inc)/c/suitesparse/ $(CONFIG_CPPFLAGS) -DGC_REDIRECT_TO_LOCAL -DLINK_SUNDIALS_STATIC
override CFLAGS += $(CPPFLAGS) $(CONFIG_CFLAGS) $(EXTRA_CFLAGS)
# CXXFLAGS can include everything as before. For FMI we need to use relative paths since
# automatic builds might not add the -I., etc
Expand Down
2 changes: 1 addition & 1 deletion OMCompiler/SimulationRuntime/c/Makefile.in
Expand Up @@ -46,7 +46,7 @@ defaultMakefileTarget = Makefile

LIBMAKEFILE = Makefile
QMAKE=@QMAKE@
CONFIG_H=$(top_builddir)/Compiler/runtime/config.h $(top_builddir)/Compiler/runtime/config.unix.h
CONFIG_H=$(top_builddir)/config.h $(top_builddir)/omc_config.unix.h
LIBSIMULATION=@LIBSIMULATION@
LIBRUNTIME=@LIBRUNTIME@
LIBFMIRUNTIME=@LIBFMIRUNTIME@
Expand Down
2 changes: 1 addition & 1 deletion OMCompiler/configure-post.sh
@@ -1,4 +1,4 @@
#!/bin/sh
# Input is the configure command, e.g. '--with-omniORB'
CMD=`echo $@ | tr -d \" | tr -d \' | sed s/\\\\//\\\\\\\\\\\\//g`
sed -i.bak "s/@CONFIGURE_ARGS@/$CMD/" Compiler/runtime/config.unix.h && rm -f Compiler/runtime/config.unix.h.bak
sed -i.bak "s/@CONFIGURE_ARGS@/$CMD/" omc_config.unix.h && rm -f omc_config.unix.h.bak
6 changes: 3 additions & 3 deletions OMCompiler/configure.ac
Expand Up @@ -985,13 +985,13 @@ date=`date "+%Y-%m-%d %H:%M:%S"`
CONFIGURE_ARGS="$ac_configure_args"

GENERATED_AUTOCONF_FILES="Makefile \
omc_config.unix.h \
revision.h \
Compiler/Util/Autoconf.mo \
Compiler/Makefile \
Compiler/Script/Makefile \
Compiler/Template/Makefile \
Compiler/runtime/Makefile \
Compiler/runtime/config.unix.h \
Compiler/runtime/revision.h \
Parser/Makefile \
SimulationRuntime/OMSICpp/Makefile.env \
SimulationRuntime/cpp/Makefile.env \
Expand Down Expand Up @@ -1031,7 +1031,7 @@ for dir_target in SimulationRuntime/cpp; do
fi
done

AC_CONFIG_COMMANDS([config.unix.h.fix],[./configure-post.sh $ac_cs_config])
AC_CONFIG_COMMANDS([omc_config.unix.h.fix],[./configure-post.sh $ac_cs_config])

AC_OUTPUT(${GENERATED_AUTOCONF_FILES})

Expand Down
Expand Up @@ -139,7 +139,7 @@
#define CONFIG_GCC_VERSION ""
#define DEFAULT_LDFLAGS ""

#include "config.unix.h"
#include "omc_config.unix.h"

#endif /* #if !defined(MSYS2_AUTOCONF) && (defined(__MINGW32__) || defined(_MSC_VER)) */

Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 702aee8

Please sign in to comment.