Browse Source

Generate list of available data sources

interpolate
Michael Uleysky 11 months ago
parent
commit
153045016d
  1. 3
      .gitignore
  2. 20
      CMakeLists.txt
  3. 11
      include/data.h
  4. 0
      sources/AVISO.h
  5. 0
      sources/AVISOLOCAL.cpp
  6. 0
      sources/AVISOLOCAL.h
  7. 0
      sources/BINFILE.cpp
  8. 0
      sources/BINFILE.h
  9. 0
      sources/HYCOM.h
  10. 0
      sources/MODISBINLOCAL.cpp
  11. 0
      sources/MODISBINLOCAL.h
  12. 0
      sources/NEMO.h
  13. 0
      sources/NEMOBIO.h
  14. 30
      src/CMakeLists.txt

3
.gitignore vendored

@ -2,4 +2,5 @@
*.so
*.kdev4
.kdev4/*
actions-add/*
actions-add/*
sources-add/*

20
CMakeLists.txt

@ -13,6 +13,24 @@ if(${srcdir} STREQUAL ${bindir})
" Please remove them.")
endif()
string(ASCII 27 Esc)
set(ColorReset "${Esc}[m")
set(ColorBold "${Esc}[1m")
set(Red "${Esc}[31m")
set(Green "${Esc}[32m")
set(Yellow "${Esc}[33m")
set(Blue "${Esc}[34m")
set(Magenta "${Esc}[35m")
set(Cyan "${Esc}[36m")
set(White "${Esc}[37m")
set(BoldRed "${Esc}[1;31m")
set(BoldGreen "${Esc}[1;32m")
set(BoldYellow "${Esc}[1;33m")
set(BoldBlue "${Esc}[1;34m")
set(BoldMagenta "${Esc}[1;35m")
set(BoldCyan "${Esc}[1;36m")
set(BoldWhite "${Esc}[1;37m")
set(STATIC_ANALYZER OFF CACHE BOOL "Using GCC static analyzer if available")
project(odm C CXX)
@ -20,7 +38,7 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
include_directories(include GSW-C)
include_directories(include sources sources-add GSW-C)
add_compile_options(-Wall)
# Dwarf-4 support check

11
include/data.h

@ -1,14 +1,9 @@
#pragma once
#include "AVISO.h"
#include "AVISOLOCAL.h"
#include "BINFILE.h"
#include "HYCOM.h"
#include "MODISBINLOCAL.h"
#include "NEMO.h"
#include "NEMOBIO.h"
#include "datalist.h"
#include "varhelpers.h"
#include <utility>
using DataVariants = std::variant<NEMOData, NEMOBIOData, HYCOMData, AVISOData, AVISOLOCALData, BINFILEData, MODISBINLOCALData>;
using DataVariants = std::variant<DATALIST>;
class Data: public DataVariants
{
public:

0
include/AVISO.h → sources/AVISO.h

0
src/AVISOLOCAL.cpp → sources/AVISOLOCAL.cpp

0
include/AVISOLOCAL.h → sources/AVISOLOCAL.h

0
src/BINFILE.cpp → sources/BINFILE.cpp

0
include/BINFILE.h → sources/BINFILE.h

0
include/HYCOM.h → sources/HYCOM.h

0
src/MODISBINLOCAL.cpp → sources/MODISBINLOCAL.cpp

0
include/MODISBINLOCAL.h → sources/MODISBINLOCAL.h

0
include/NEMO.h → sources/NEMO.h

0
include/NEMOBIO.h → sources/NEMOBIO.h

30
src/CMakeLists.txt

@ -1,12 +1,13 @@
set(EXENAME odm)
set(ACTIONLISTINC ${CMAKE_CURRENT_BINARY_DIR}/../include/actionlist.h) # Include actions files and define the actions classes list
set(DATALISTINC ${CMAKE_CURRENT_BINARY_DIR}/../include/datalist.h) # Include data sources files and define the data sources classes list
find_library(netcdf netcdf REQUIRED)
find_package(OpenMP REQUIRED)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
file(GLOB srcs CONFIGURE_DEPENDS *.cpp)
add_executable(${EXENAME} ${srcs} ${ACTIONLISTINC})
add_executable(${EXENAME} ${srcs} ${ACTIONLISTINC} ${SOURCELISTINC})
target_include_directories(${EXENAME} PRIVATE ../michlib/michlib ${CMAKE_CURRENT_BINARY_DIR}/../include)
target_link_libraries(${EXENAME} ${linker_options} ${netcdf} OpenMP::OpenMP_CXX teos)
@ -25,7 +26,7 @@ foreach(actfile ${actfiles})
string(REGEX MATCH "ADD ACTION CLASS: [^ ;\n]+" outstr "${outfull}")
string(REGEX REPLACE ".+: " "" act "${outstr}")
if(NOT (("${act}" EQUAL "") OR ("${act}" IN_LIST excluded)))
message("Action: ${act} in file ${actfile}")
message("Action: ${Yellow}${act}${ColorReset} in file ${actfile}")
list(APPEND actlist ${act})
list(APPEND actfilelist ${actfile})
endif()
@ -39,3 +40,28 @@ foreach(actfile ${actfilelist})
file(APPEND ${ACTIONLISTINC} "#include \"${actfile}\"\n")
endforeach(actfile)
# End generation of actions list
# Begin generation of data sources list
separate_arguments(excluded UNIX_COMMAND "${EXCLUDE_SOURCES}")
file(GLOB sourcefiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CONFIGURE_DEPENDS ../sources/*.h ../sources-add/*.h)
foreach(sourcefile ${sourcefiles})
string(REGEX REPLACE "(\.h$|.*/)" "" source "${sourcefile}")
string(REGEX REPLACE "\.h$" ".cpp" sourcecpp "${sourcefile}")
if(NOT (("${source}" EQUAL "") OR ("${source}" IN_LIST excluded)))
message("Source: ${Cyan}${source}${ColorReset} in file ${sourcefile}")
list(APPEND sourcelist ${source})
list(APPEND sourcefilelist ${sourcefile})
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${sourcecpp} )
target_sources(${EXENAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/${sourcecpp})
endif()
endif()
endforeach(sourcefile)
list(TRANSFORM sourcelist APPEND "Data")
string(REPLACE ";" "," sourceclist "${sourcelist}")
file(WRITE ${DATALISTINC} "#define DATALIST ${sourceclist}\n")
foreach(sourcefile ${sourcefilelist})
file(APPEND ${DATALISTINC} "#include \"${sourcefile}\"\n")
endforeach(sourcefile)
# End generation of sources list

Loading…
Cancel
Save