Skip to content

Commit

Permalink
91 remove submodules (#92)
Browse files Browse the repository at this point in the history
* correcting fortran build

* install stuff

* correcting python build

* what

* adding lapack to containers

* installating lapack on ubuntu action

* Rename CMakelists.txt to CMakeLists.txt
  • Loading branch information
K20shores authored Apr 23, 2024
1 parent b99af76 commit 229d10f
Show file tree
Hide file tree
Showing 15 changed files with 57 additions and 121 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y liblapack-dev libblas-dev
- uses: actions/setup-python@v5
- run: pip install -r python/requirements.txt

Expand Down
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,6 @@ endif()
################################################################################
# Dependencies

include(musica_util)

# Add submodules
checkout_submodules()

include(dependencies)

################################################################################
Expand Down
29 changes: 19 additions & 10 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,37 @@ endif()
# MICM

if (MUSICA_ENABLE_MICM)
FetchContent_Declare(json
GIT_REPOSITORY https://github.com/nlohmann/json.git
GIT_TAG v3.11.2
FetchContent_Declare(micm
GIT_REPOSITORY https://github.com/NCAR/micm.git
GIT_TAG v3.5.0-release-candidate
)
FetchContent_MakeAvailable(json)
FetchContent_MakeAvailable(micm)
endif()

################################################################################
# TUV-x

if (MUSICA_ENABLE_TUVX)
FetchContent_Declare(
yaml-cpp
GIT_REPOSITORY https://github.com/jbeder/yaml-cpp/
GIT_TAG 0.8.0
FetchContent_Declare(tuvx
GIT_REPOSITORY https://github.com/NCAR/tuv-x.git
GIT_TAG v0.8.0
)
FetchContent_MakeAvailable(yaml-cpp)
FetchContent_MakeAvailable(tuvx)
endif()

################################################################################
# pybind11
if(MUSICA_ENABLE_PYTHON_LIBRARY)
set(PYBIND11_NEWPYTHON ON)
add_subdirectory(${CMAKE_SOURCE_DIR}/lib/pybind11)

FetchContent_Declare(pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11
GIT_TAG v2.12.0
)

FetchContent_GetProperties(pybind11)
if(NOT pybind11_POPULATED)
FetchContent_Populate(pybind11)
add_subdirectory(${pybind11_SOURCE_DIR} ${pybind11_BINARY_DIR})
endif()
endif()
45 changes: 0 additions & 45 deletions cmake/musica_util.cmake

This file was deleted.

10 changes: 5 additions & 5 deletions docker/Dockerfile.fortran-gcc
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ RUN dnf -y update \
curl \
gcc \
gcc-c++ \
gdb \
gcc-gfortran \
gdb \
git \
hdf5-devel \
json-devel \
lapack-devel \
lcov \
libcurl-devel \
hdf5-devel \
netcdf-fortran-devel \
m4 \
make \
json-devel \
netcdf-fortran-devel \
valgrind \
vim \
zlib-devel \
Expand All @@ -35,7 +36,6 @@ RUN cd musica \
&& cmake -S . \
-B build \
-D CMAKE_BUILD_TYPE=Release \
-D MUSICA_ENABLE_TESTS=ON \
-D MUSICA_BUILD_FORTRAN_INTERFACE=ON \
-D MUSICA_ENABLE_MICM=ON \
&& cd build \
Expand Down
9 changes: 5 additions & 4 deletions docker/Dockerfile.fortran-gcc.integration
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ RUN dnf -y update \
curl \
gcc \
gcc-c++ \
gdb \
gcc-gfortran \
gdb \
git \
hdf5-devel \
json-devel \
lapack-devel \
lcov \
libcurl-devel \
hdf5-devel \
netcdf-fortran-devel \
m4 \
make \
json-devel \
netcdf-fortran-devel \
valgrind \
vim \
zlib-devel \
Expand Down
42 changes: 12 additions & 30 deletions fortran/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ target_include_directories(musica-fortran
)

target_link_libraries(musica-fortran
INTERFACE
PUBLIC
musica::musica
)

Expand All @@ -53,40 +53,15 @@ endif()
####################
# TUV-x
if (MUSICA_ENABLE_TUVX)
set(TUVX_MOD_DIR ${MUSICA_MOD_DIR})
set(TUVX_LIB_DIR ${MUSICA_LIB_DIR})

add_subdirectory(${CMAKE_SOURCE_DIR}/lib/tuv-x/src ${MUSICA_LIB_DIR}/tuv-x/src)

# for yaml-cpp
target_compile_features(tuvx_object PRIVATE cxx_std_20)

set_target_properties(tuvx_object PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${MUSICA_LIB_DIR}
Fortran_MODULE_DIRECTORY ${MUSICA_MOD_DIR}
)

target_include_directories(tuvx_object
PUBLIC
$<BUILD_INTERFACE:${MUSICA_MOD_DIR}>
$<INSTALL_INTERFACE:${MUSICA_INSTALL_INCLUDE_DIR}>
)

target_link_libraries(tuvx_object
PUBLIC
musicacore_object
)

target_link_libraries(musica-fortran
PUBLIC
yaml-cpp::yaml-cpp
)

# add the sources to musica
target_sources(musica-fortran
PRIVATE
$<TARGET_OBJECTS:tuvx_object>
)
target_link_libraries(musica-fortran
PUBLIC
tuvx
)
endif()


Expand All @@ -95,4 +70,11 @@ endif()

if(MUSICA_ENABLE_TESTS)
add_subdirectory(test)
endif()

################################################################################
# installation

if(MUSICA_ENABLE_INSTALL AND NOT MUSICA_ENABLE_PYTHON_LIBRARY)
add_subdirectory(packaging)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ include(CMakePackageConfigHelpers)
install(
TARGETS
musica-fortran
tuvx
yaml-cpp
EXPORT
musica_fortran_Exports
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
Expand All @@ -13,6 +15,7 @@ install(
install(
DIRECTORY
${MUSICA_MOD_DIR}/
${tuvx_BINARY_DIR}/include
DESTINATION
${MUSICA_INSTALL_INCLUDE_DIR}/musica/fortran
FILES_MATCHING PATTERN "*.mod"
Expand Down Expand Up @@ -62,4 +65,4 @@ if(NOT TARGET uninstall)

add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()
endif()
1 change: 0 additions & 1 deletion lib/micm
Submodule micm deleted from a833af
1 change: 0 additions & 1 deletion lib/pybind11
Submodule pybind11 deleted from 8b03ff
1 change: 0 additions & 1 deletion lib/tuv-x
Submodule tuv-x deleted from d43b16
2 changes: 1 addition & 1 deletion python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ set_target_properties(musica_python PROPERTIES OUTPUT_NAME musica)

target_include_directories(musica_python
PUBLIC
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/lib/micm/include>
$<BUILD_INTERFACE:${micm_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${MUSICA_INSTALL_INCLUDE_DIR}>
)

Expand Down
10 changes: 1 addition & 9 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,7 @@ target_sources(musica
####################
# MICM
if(MUSICA_ENABLE_MICM)
target_compile_features(musica PUBLIC cxx_std_20)

target_include_directories(musica
PUBLIC
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/lib/micm/include>
$<INSTALL_INTERFACE:${MUSICA_INSTALL_INCLUDE_DIR}>
)

target_link_libraries(musica PUBLIC nlohmann_json::nlohmann_json)
target_link_libraries(musica PUBLIC musica::micm)

add_subdirectory(micm)
endif()
Expand Down
3 changes: 2 additions & 1 deletion src/packaging/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ install(
TARGETS
musica
nlohmann_json
micm
EXPORT
musica_Exports
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
Expand All @@ -28,7 +29,7 @@ install(
if (MUSICA_ENABLE_MICM)
install(
DIRECTORY
${CMAKE_SOURCE_DIR}/lib/micm/include/
${micm_SOURCE_DIR}/include/
DESTINATION
${MUSICA_INSTALL_INCLUDE_DIR}/musica
)
Expand Down
10 changes: 3 additions & 7 deletions src/test/connections/micm_c_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,8 @@ TEST_F(MicmCApiTest, GetSpeciesProperty) {
ASSERT_STREQ(e.what(), "Species 'bad species' not found");
throw;
}}, std::runtime_error);
ASSERT_THROW({
try {
get_species_property_double(micm, "O3", "bad property");
} catch (const std::runtime_error& e) {
ASSERT_STREQ(e.what(), "Species property 'bad property' not found for species 'O3'");
throw;
}}, std::runtime_error);
EXPECT_ANY_THROW(
get_species_property_double(micm, "O3", "bad property")
);
#endif
}

0 comments on commit 229d10f

Please sign in to comment.