Skip to content

Commit

Permalink
Fix compilation of OMShell and mosh
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund committed May 12, 2015
1 parent b87dfa0 commit 3f8412c
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 24 deletions.
37 changes: 37 additions & 0 deletions Makefile.in
@@ -0,0 +1,37 @@
all: omshell @OMSHELL_TERMINAL@

prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
CMAKE=CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" cmake
CMAKE_TARGET = "Unix Makefiles"

ifeq (@APP@,)
install:
mkdir -p ${DESTDIR}/@bindir@
cp -a build/bin/OMShell@EXE@ ${DESTDIR}/@bindir@
else
install:
mkdir -p ${DESTDIR}/Applications/
cp -a build/Applications/OMShell@APP@ ${DESTDIR}/Applications/
endif
mkdir -p ${DESTDIR}/lib/@host_short@/omc/ ${DESTDIR}/share/omedit/nls/
cp -a build/lib/@host_short@/omc/* ${DESTDIR}/lib/@host_short@/omc/

mkbuilddirs:
mkdir -p @OMBUILDDIR@/bin @OMBUILDDIR@/lib/@host_short@/omc
omshell: mkbuilddirs
$(MAKE) -C OMShell/OMShellGUI -f Makefile.unix
mosh: mkbuilddirs
$(MAKE) -C mosh/src
clean:
$(MAKE) -C OMEdit/OMEditGUI -f Makefile.unix clean
$(MAKE) -C mosh/src clean
distclean: clean
rm -f config.status configure Makefile OMShell/OMShellGUI/Makefile.unix
Makefile: Makefile.in config.status
./config.status
config.status: configure
./config.status -recheck
configure: configure.ac common/m4/corba.m4 common/m4/omhome.m4 common/m4/qmake.m4
autoconf
19 changes: 7 additions & 12 deletions OMShell/OMShellGUI/Makefile.unix.in
@@ -1,8 +1,3 @@
top_builddir=../../
builddir_bin=$(top_builddir)/build/bin/
builddir_share=$(top_builddir)/build/share/
runtimedir=$(top_builddir)/Compiler/runtime/

QMAKE=@QMAKE@
APP=@APP@
EXE=@EXE@
Expand All @@ -18,19 +13,19 @@ Makefile: OMShell.config
clean: Makefile
rm -rf ../bin/$(NAME) ../bin/$(NAME)$(APP) omc_communication.* Makefile

omc_communication.cc omc_communication.h: $(runtimedir)/omc_communication.idl
omc_communication.cc omc_communication.h: @OPENMODELICAHOME@/share/omc/omc_communication.idl
@IDLCMD@ $<

$(NAME): Makefile OMShell.config omc_communication.cc
$(MAKE) -f Makefile

build: $(NAME)
mkdir -p $(builddir_share)/omshell/nls/
if [ "$(APP)" = ".app" ]; then cp -rp ../bin/$(NAME)$(APP) $(top_builddir)/build/Applications/ ; else cp -p ../bin/$(NAME) $(builddir_bin); fi
cp -p $(top_builddir)/OMNotebook/OMNotebookGUI/commands.xml $(builddir_share)/omshell/
cp -p OMShell_*.qm $(builddir_share)/omshell/nls/
mkdir -p @OMBUILDDIR@/share/omshell/nls/
if [ "$(APP)" = ".app" ]; then cp -rp ../bin/$(NAME)$(APP) @OMBUILDDIR@/build/Applications/ ; else cp -p ../bin/$(NAME) @OMBUILDDIR@/bin; fi
cp -p commands.xml @OMBUILDDIR@/share/omshell/
cp -p OMShell_*.qm @OMBUILDDIR@/share/omshell/nls/

Makefile.unix: Makefile.unix.in
cd $(top_builddir); ./config.status
cd @top_builddir@ && ./config.status
OMShell.config: OMShell.config.in
cd $(top_builddir); ./config.status
cd @top_builddir@ && ./config.status
1 change: 1 addition & 0 deletions OMShell/OMShellGUI/omc_config.h.in
@@ -0,0 +1 @@
#define CONFIG_DEFAULT_OPENMODELICAHOME "@OPENMODELICAHOME@"
2 changes: 1 addition & 1 deletion OMShell/OMShellGUI/omcinteractiveenvironment.cpp
Expand Up @@ -39,7 +39,7 @@

#include "omcinteractiveenvironment.h"
#ifndef WIN32
#include "../../Compiler/runtime/omc_config.h"
#include "omc_config.h"
#endif

using namespace std;
Expand Down
76 changes: 76 additions & 0 deletions configure.ac
@@ -0,0 +1,76 @@
dnl Process this file with autoconf to produce a configure script.

AC_PREREQ([2.63])
AC_INIT([OMShell],[dev],[https://trac.openmodelica.org/OpenModelica],[openmodelica],[https://openmodelica.org])

AC_SUBST(APP)
AC_SUBST(EXE)
AC_SUBST(IDLCMD)
AC_SUBST(RPATH_QMAKE)
AC_SUBST(host_short)

m4_include([common/m4/pre-commit.m4])
cp common/install-sh common/config.guess common/config.sub ./
m4_include([common/m4/ombuilddir.m4])

AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET

dnl Checks for programs.

AC_LANG([C++])
AC_PROG_CXX
AC_PROG_CC

host_short=$host_cpu-$host_os

m4_include([common/m4/qmake.m4])
m4_include([common/m4/omhome.m4])

FIND_OPENMODELICAHOME()

OMNIORB_DEFAULT=yes
m4_include([common/m4/corba.m4])

if test -z "$USE_CORBA"; then
AC_MSG_ERROR([OMOptim requires using the OMC CORBA interface. Configure using --with-omniORB.])
fi

AC_SUBST(LIBREADLINE)
AC_SUBST(OMSHELL_TERMINAL)
AC_MSG_CHECKING([if the user wants to compile OMShell-terminal])
OMSHELL_TERMINAL="mosh"
AC_ARG_ENABLE(omshell-terminal, [ --disable-omshell-terminal Disables compilation of OMShell-terminal (enabled by default)],[test
"xno" = x"$enableval" && OMSHELL_TERMINAL=""])
if test -z "$OMSHELL_TERMINAL" ; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
AC_CHECK_HEADER(readline/readline.h,,AC_MSG_ERROR([readline missing]))
AC_CHECK_HEADER(readline/history.h,,AC_MSG_ERROR([readline missing]))

AC_ARG_WITH(static-readline, [ --with-static-readline=DIR (default to dynamic linking; searches /usr if no other directory is provided)],[WANT_STATIC_READLINE="$withval"],[WANT_STATIC_READLINE="no"])

if test "$WANT_STATIC_READLINE" = "no"; then
LIBS=""
AC_SEARCH_LIBS(readline,readline,,[AC_MSG_ERROR([readline missing])])
LIBREADLINE=$LIBS
LIBS=""
else
if test "$WANT_STATIC_READLINE" = "yes"; then
READLINELIB=/usr/lib;
else
READLINELIB=$WANT_STATIC_READLINE/lib
fi
test -f $READLINELIB/*/libreadline.a && READLINELIB=`dirname $READLINELIB/*/libreadline.a`
LIBS="-lncurses $READLINELIB/libreadline.a -ltermcap"
AC_MSG_CHECKING([for static readline $LIBS])
AC_LINK_IFELSE([AC_LANG_CALL([], [rl_message])], [LIBREADLINE=$LIBS], [AC_MSG_ERROR([failed])])
AC_MSG_RESULT([ok])
LIBS=""
fi
fi

AC_OUTPUT(Makefile OMShell/OMShellGUI/Makefile.unix OMShell/OMShellGUI/OMShell.config mosh/src/Makefile OMShell/OMShellGUI/omc_config.h)
# AC_CONFIG_COMMANDS([Clean qmake stuff],[make clean])
14 changes: 3 additions & 11 deletions mosh/src/Makefile.in
@@ -1,13 +1,5 @@
all: release

top_builddir=../..
builddir_bin=$(top_builddir)/build/bin
builddir_lib=$(top_builddir)/build/lib
builddir_inc=$(top_builddir)/build/include
builddir_doc=$(top_builddir)/build/doc
runtimedir=$(top_builddir)/Compiler/runtime/


CC=@CC@
CXX=@CXX@

Expand Down Expand Up @@ -36,14 +28,14 @@ endif
PROG = OMShell-terminal

release: $(PROG)$(EXEEXT)
cp $(PROG)$(EXEEXT) $(builddir_bin)/
cp $(PROG)$(EXEEXT) @OMBUILDDIR@/bin

$(PROG)$(EXEEXT) : $(OBJS)
$(CXX) -o $(PROG)$(EXEEXT) $(OBJS) $(CORBAOBJS) $(LDFLAGS)

omc_communication.cpp: omc_communication.cc
ln -s $< $@
omc_communication.cc: $(runtimedir)/omc_communication.idl
omc_communication.cc: @OPENMODELICAHOME@/share/omc/omc_communication.idl
@IDLCMD@ $<
omc_communication.h: omc_communication.cc

Expand All @@ -58,4 +50,4 @@ options.o: options.cpp
.PRECIOUS: Makefile

Makefile: Makefile.in
cd $(top_builddir) && ./config.status
cd @top_builddir@ && ./config.status

0 comments on commit 3f8412c

Please sign in to comment.