Skip to content

Commit

Permalink
Merge pull request #8 from ratt-ru/issue-6
Browse files Browse the repository at this point in the history
Fixes #6 . This adds support for building under GNU 11 and Ubuntu 22.04
  • Loading branch information
bennahugo authored Jan 31, 2024
2 parents d0ebff8 + 43d176a commit d1ddf7d
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 50 deletions.
File renamed without changes.
38 changes: 38 additions & 0 deletions .ci/ubuntu.22.04.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_PRIORITY critical
RUN apt update && apt install -y libblitz0-dev python3-dev libblas-dev liblapack-dev libqdbm-dev wcslib-dev \
libfftw3-dev python3-numpy libcfitsio-dev libboost-all-dev libboost-system-dev cmake g++ wget gfortran \
libncurses5-dev bison libbison-dev flex libreadline6-dev python3-pip rsync casacore-dev casacore-data

#####################################################################
## CASArest from source
#####################################################################
# BH: TODO - this should go to KERN once that is ready...
WORKDIR /opt
RUN wget https://github.com/casacore/casarest/archive/v1.8.1.tar.gz && \
tar xvf v1.8.1.tar.gz && \
rm v1.8.1.tar.gz && \
cd /opt/casarest-1.8.1 && \
mkdir -p build && \
cd /opt/casarest-1.8.1/build && \
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release ../ && \
make -j 16 && \
make install && \
rm -r /opt/casarest-1.8.1 && \
ldconfig

RUN mkdir -p /src/
ENV BUILD /src
ADD . /src/makems
RUN mkdir -p $BUILD/makems/LOFAR/build/gnu_opt
WORKDIR $BUILD/makems/LOFAR/build/gnu_opt
RUN cmake -DCMAKE_MODULE_PATH:PATH=$BUILD/makems/LOFAR/CMake \
-DUSE_LOG4CPLUS=OFF -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr ../..
RUN make -j 16
RUN make install

WORKDIR $BUILD/makems/test
RUN makems WSRT_makems.cfg
ENTRYPOINT makems
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LOFAR/build
6 changes: 4 additions & 2 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build . --file Dockerfile --tag makems:$(date +%s)
- name: Build on Ubuntu 20.04
run: docker build . --file .ci/ubuntu.20.04.docker --tag makems2004:$(date +%s)
- name: Build on Ubuntu 22.04
run: docker build . --file .ci/ubuntu.22.04.docker --tag makems2204:$(date +%s)
1 change: 0 additions & 1 deletion LOFAR/CEP/MS/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

include(LofarPackageVersion)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w -Wno-deprecated -Wno-write-strings")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w -Wno-deprecated -Wno-write-strings")

Expand Down
8 changes: 4 additions & 4 deletions LOFAR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ include(LofarInit)
project(LOFAR)
include(LofarGeneral)

lofar_find_package(Casacore COMPONENTS casa measures ms tables REQUIRED)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CASACORE_INCLUDE_DIR} -I${CASACORE_INCLUDE_DIR}/../ -w -Wno-deprecated -Wno-write-strings")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${CASACORE_INCLUDE_DIR} -I${CASACORE_INCLUDE_DIR}/../ -w -Wno-deprecated -Wno-write-strings")
## ---------------------------------------------------------------------------
## Subdirectories
## ---------------------------------------------------------------------------
Expand Down Expand Up @@ -59,7 +62,4 @@ if(0)
include(AllVariables)
all_variables()
message(STATUS "^^^^^^^^ Variables ^^^^^^^^")
endif(0)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w -Wno-deprecated -Wno-write-strings")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w -Wno-deprecated -Wno-write-strings")
endif(0)
44 changes: 22 additions & 22 deletions LOFAR/LCS/Common/include/Common/StringUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,17 +301,17 @@ inline std::string toString(long double val, const char* fmt = 0)
// \attention These functions will be deprecated in a next release.
// @{

bool StringToBool (const string& aString) throw(Exception);
int16 StringToInt16 (const string& aString,const char* fmt=0) throw(Exception);
uint16 StringToUint16(const string& aString,const char* fmt=0) throw(Exception);
int32 StringToInt32 (const string& aString,const char* fmt=0) throw(Exception);
uint32 StringToUint32(const string& aString,const char* fmt=0) throw(Exception);
bool StringToBool (const string& aString);
int16 StringToInt16 (const string& aString,const char* fmt=0);
uint16 StringToUint16(const string& aString,const char* fmt=0);
int32 StringToInt32 (const string& aString,const char* fmt=0);
uint32 StringToUint32(const string& aString,const char* fmt=0);
#if HAVE_LONG_LONG
int64 StringToInt64 (const string& aString,const char* fmt=0) throw(Exception);
uint64 StringToUint64(const string& aString,const char* fmt=0) throw(Exception);
int64 StringToInt64 (const string& aString,const char* fmt=0);
uint64 StringToUint64(const string& aString,const char* fmt=0);
#endif
float StringToFloat (const string& aString,const char* fmt=0) throw(Exception);
double StringToDouble(const string& aString,const char* fmt=0) throw(Exception);
float StringToFloat (const string& aString,const char* fmt=0);
double StringToDouble(const string& aString,const char* fmt=0);

// @}

Expand All @@ -322,21 +322,21 @@ double StringToDouble(const string& aString,const char* fmt=0) throw(Exception);
// Leading and trailing whitespace is allowed.
// It checks if an integer value does not exceed the data type range.
// @{
long strToLong (const string& aString) throw(Exception);
int strToInt (const string& aString) throw(Exception);
int32 strToInt32 (const string& aString) throw(Exception);
int16 strToInt16 (const string& aString) throw(Exception);
unsigned long strToUlong (const string& aString) throw(Exception);
uint strToUint (const string& aString) throw(Exception);
uint32 strToUint32 (const string& aString) throw(Exception);
uint16 strToUint16 (const string& aString) throw(Exception);
long strToLong (const string& aString);
int strToInt (const string& aString);
int32 strToInt32 (const string& aString);
int16 strToInt16 (const string& aString);
unsigned long strToUlong (const string& aString);
uint strToUint (const string& aString);
uint32 strToUint32 (const string& aString);
uint16 strToUint16 (const string& aString);
#if HAVE_LONG_LONG
int64 strToInt64 (const string& aString) throw(Exception);
uint64 strToUint64 (const string& aString) throw(Exception);
int64 strToInt64 (const string& aString);
uint64 strToUint64 (const string& aString);
#endif
float strToFloat (const string& aString) throw(Exception);
double strToDouble (const string& aString) throw(Exception);
inline bool strToBool (const string& aString) throw(Exception)
float strToFloat (const string& aString);
double strToDouble (const string& aString);
inline bool strToBool (const string& aString)
{ return StringToBool (aString); }
// @}

Expand Down
42 changes: 21 additions & 21 deletions LOFAR/LCS/Common/src/StringUtil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ string toLower(string str)
return str;
}

bool StringToBool(const string& aString) throw(Exception)
bool StringToBool(const string& aString)
{
char firstChar = aString.c_str()[0];
if ((firstChar == 't') || (firstChar == 'T') || (firstChar == '1') || (firstChar == 'Y') || (firstChar == 'y'))
Expand All @@ -188,7 +188,7 @@ bool StringToBool(const string& aString) throw(Exception)
THROW (Exception, aString + " is not a boolean value");
}

int16 StringToInt16(const string& aString, const char* fmt) throw(Exception)
int16 StringToInt16(const string& aString, const char* fmt)
{
int16 theShort;
if ((fmt ? std::sscanf(aString.c_str(), fmt, &theShort) :
Expand All @@ -199,7 +199,7 @@ int16 StringToInt16(const string& aString, const char* fmt) throw(Exception)
return (theShort);
}

uint16 StringToUint16(const string& aString, const char* fmt) throw(Exception)
uint16 StringToUint16(const string& aString, const char* fmt)
{
uint16 theUshort;
if ((fmt ? std::sscanf(aString.c_str(), fmt, &theUshort) :
Expand All @@ -210,7 +210,7 @@ uint16 StringToUint16(const string& aString, const char* fmt) throw(Exception)
return (theUshort);
}

int32 StringToInt32(const string& aString, const char* fmt) throw(Exception)
int32 StringToInt32(const string& aString, const char* fmt)
{
int32 theInt;
if ((fmt ? std::sscanf(aString.c_str(), fmt, &theInt) :
Expand All @@ -220,7 +220,7 @@ int32 StringToInt32(const string& aString, const char* fmt) throw(Exception)
return (theInt);
}

uint32 StringToUint32(const string& aString, const char* fmt) throw(Exception)
uint32 StringToUint32(const string& aString, const char* fmt)
{
uint32 theUint;
if ((fmt ? std::sscanf(aString.c_str(), fmt, &theUint) :
Expand All @@ -232,7 +232,7 @@ uint32 StringToUint32(const string& aString, const char* fmt) throw(Exception)
}

#if HAVE_LONG_LONG
int64 StringToInt64(const string& aString, const char* fmt) throw(Exception)
int64 StringToInt64(const string& aString, const char* fmt)
{
int64 theLong;
if ((fmt ? std::sscanf(aString.c_str(), fmt, &theLong) :
Expand All @@ -243,7 +243,7 @@ int64 StringToInt64(const string& aString, const char* fmt) throw(Exception)
return (theLong);
}

uint64 StringToUint64(const string& aString, const char* fmt) throw(Exception)
uint64 StringToUint64(const string& aString, const char* fmt)
{
uint64 theUlong;
if ((fmt ? std::sscanf(aString.c_str(), fmt, &theUlong) :
Expand All @@ -255,7 +255,7 @@ uint64 StringToUint64(const string& aString, const char* fmt) throw(Exception)
}
#endif

float StringToFloat(const string& aString, const char* fmt) throw(Exception)
float StringToFloat(const string& aString, const char* fmt)
{
float theFloat;
if ((fmt ? std::sscanf(aString.c_str(), fmt, &theFloat) :
Expand All @@ -267,7 +267,7 @@ float StringToFloat(const string& aString, const char* fmt) throw(Exception)
}


double StringToDouble(const string& aString, const char* fmt) throw(Exception)
double StringToDouble(const string& aString, const char* fmt)
{
double theDouble;
if ((fmt ? std::sscanf(aString.c_str(), fmt, &theDouble) :
Expand All @@ -279,7 +279,7 @@ double StringToDouble(const string& aString, const char* fmt) throw(Exception)
}


long strToLong (const string& aString) throw(Exception)
long strToLong (const string& aString)
{
const char* str = aString.c_str();
int st = lskipws(aString, 0, aString.size());
Expand All @@ -300,7 +300,7 @@ long strToLong (const string& aString) throw(Exception)
return val;
}

int strToInt (const string& aString) throw(Exception)
int strToInt (const string& aString)
{
long val = strToLong (aString);
if (sizeof(int) != sizeof(long)) {
Expand All @@ -312,7 +312,7 @@ int strToInt (const string& aString) throw(Exception)
return val;
}

int32 strToInt32 (const string& aString) throw(Exception)
int32 strToInt32 (const string& aString)
{
long val = strToLong (aString);
if (sizeof(int32) != sizeof(long)) {
Expand All @@ -322,15 +322,15 @@ int32 strToInt32 (const string& aString) throw(Exception)
return val;
}

int16 strToInt16 (const string& aString) throw(Exception)
int16 strToInt16 (const string& aString)
{
long val = strToLong (aString);
ASSERTSTR (val >= -32768L && val <= 32767L,
val << " is outside int16 range");
return val;
}

unsigned long strToUlong (const string& aString) throw(Exception)
unsigned long strToUlong (const string& aString)
{
const char* str = aString.c_str();
int st = lskipws(aString, 0, aString.size());
Expand All @@ -351,7 +351,7 @@ unsigned long strToUlong (const string& aString) throw(Exception)
return val;
}

uint strToUint (const string& aString) throw(Exception)
uint strToUint (const string& aString)
{
unsigned long val = strToUlong (aString);
if (sizeof(uint) != sizeof(unsigned long)) {
Expand All @@ -363,7 +363,7 @@ uint strToUint (const string& aString) throw(Exception)
return val;
}

uint32 strToUint32 (const string& aString) throw(Exception)
uint32 strToUint32 (const string& aString)
{
unsigned long val = strToUlong (aString);
if (sizeof(uint32) != sizeof(unsigned long)) {
Expand All @@ -373,15 +373,15 @@ uint32 strToUint32 (const string& aString) throw(Exception)
return val;
}

uint16 strToUint16 (const string& aString) throw(Exception)
uint16 strToUint16 (const string& aString)
{
unsigned long val = strToUlong (aString);
ASSERTSTR (val <= 65535UL,
val << " is outside uint16 range");
return val;
}

float strToFloat (const string& aString) throw(Exception)
float strToFloat (const string& aString)
{
const char* str = aString.c_str();
int st = lskipws(aString, 0, aString.size());
Expand All @@ -396,7 +396,7 @@ float strToFloat (const string& aString) throw(Exception)
return val;
}

double strToDouble (const string& aString) throw(Exception)
double strToDouble (const string& aString)
{
const char* str = aString.c_str();
int st = lskipws(aString, 0, aString.size());
Expand All @@ -412,7 +412,7 @@ double strToDouble (const string& aString) throw(Exception)
}

#if HAVE_LONG_LONG
int64 strToInt64 (const string& aString) throw(Exception)
int64 strToInt64 (const string& aString)
{
if (sizeof(int64) == sizeof(long)) return strToLong(aString);
ASSERTSTR (sizeof(int64)==sizeof(long long),
Expand All @@ -436,7 +436,7 @@ int64 strToInt64 (const string& aString) throw(Exception)
return val;
}

uint64 strToUint64 (const string& aString) throw(Exception)
uint64 strToUint64 (const string& aString)
{
if (sizeof(uint64) == sizeof(unsigned long)) return strToUlong(aString);
ASSERTSTR (sizeof(uint64)==sizeof(unsigned long long),
Expand Down

0 comments on commit d1ddf7d

Please sign in to comment.