Skip to content

Commit

Permalink
Merge pull request #21 from Cosmoglobe/hotfix
Browse files Browse the repository at this point in the history
Revert "Merge pull request #20 from Cosmoglobe/cleanup"
  • Loading branch information
hke authored Feb 20, 2021
2 parents b68a57d + 710ad37 commit 1d5c18f
Show file tree
Hide file tree
Showing 153 changed files with 2,840 additions and 371,169 deletions.
61 changes: 12 additions & 49 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,60 +1,23 @@
#---------------------------------------------------------------
# Compiled python modules.
#---------------------------------------------------------------
.Python
*.pyc
# Setuptools distribution folder.
/dist/
/sdist/
# Python egg metadata, regenerated from source files by setuptools.
eggs/
.eggs/
develop-eggs/
*.egg-info/
*.egg
# Python cache files
__pycache__/
#---------------------------------------------------------------
# CMake miscellaneous files
#---------------------------------------------------------------
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
build/
downloads/
lib/
lib64/
#---------------------------------------------------------------
# Fortran compiled output
#---------------------------------------------------------------
*.mod
*.o
*.optrpt
*.a
*.gitignore
*.pyc
*.swp
*.swo
*comm_like_sampler
*comm_like_tools
*comm_like_tools_mpi
*comm_process_resfiles
*commander
*.gitignore

#---------------------------------------------------------------
# Editors
#---------------------------------------------------------------
.vscode/
.idea/
# Vagrant
.vagrant/
# Mac/OSX
.DS_Store
# Windows
Thumbs.db
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
17 changes: 0 additions & 17 deletions .mailmap

This file was deleted.

74 changes: 24 additions & 50 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,76 +18,50 @@
# along with Commander3. If not, see <https://www.gnu.org/licenses/>.
#
#================================================================================
# Ensure out-of-source build
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR
"\n-------------------------------------------------------------------"
"\n IN-SOURCE BUILDS ARE NOT ALLOWED!"
"\nTo sucessfully run CMake configuration, please, do the following:"
"\n1. Delete the CMakeCache.txt file and the CMakeFiles directory"
" created inside current (root) directory. For instance, on Linux do: "
"\n $ rm -r CMakeCache.txt CMakeFiles/"
"\n2. Create new directory (any name will do, but usually it is called build)"
" and re-run CMake configuration from it. For example, on Linux do:"
"\n $ mkdir build && cd build"
"\n $ cmake [CMake variable 1] [...] [CMake variable n] .."
"\n3. Run compilation command to install Commander3, e.g.: "
"\n $ cmake --build . --target install -j n"
"\n where n is the number of processors to utilize."
"\nFor more information, please refer to official documentation: "
"\n https://docs.beyondplanck.science"
"\nIn case you have any questions, feel free to post them on our forum:"
"\n https://forums.beyondplanck.science/"
"\n-------------------------------------------------------------------"
)
endif()
# Just a short message to signify start of configuration script

# just a short message to signify start of configuration script
message(STATUS "===============================================================")
message(STATUS "Welcome to automatic Commander3 installer!")
message(STATUS "Issued under: GNU GPLv3 license")
message(STATUS "Official repo: https://github.com/Cosmoglobe/Commander")
message(STATUS "Documentation: https://docs.beyondplanck.science")
message(STATUS "Forum: https://forums.beyondplanck.science/")
message(STATUS "===============================================================")
message(STATUS "Scanning your system. Please, wait a moment...")
# The necessary minimum to set-up cmake-based project
#message(STATUS "---------------------------------------------------------------")
# the necessary minimum to set-up cmake
cmake_minimum_required(VERSION 3.17 FATAL_ERROR)
project(Commander3
DESCRIPTION "Complete installer for Commander 3."
VERSION 1.3.0
LANGUAGES Fortran CXX C
HOMEPAGE_URL "https://github.com/Cosmoglobe/Commander"
project(CommanderSuperbuild
DESCRIPTION "Complete installer for Commander 3"
VERSION 1.1.0
LANGUAGES Fortran CXX C #Python
)
# Looking for python
find_package(Python REQUIRED COMPONENTS Interpreter)

# Including native cmake commands
# ensuring that we do out-of-source build
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there.")
endif()

# including native cmake commands
include(CMakePrintHelpers)
include(CMakeDependentOption)
# Enables content population at configure time
# enables content population at configure time
include(FetchContent)
# Including external project routines to enable superbuild pattern
# including external project routines to enable superbuild pattern
include(ExternalProject)
# Including useful macro to operate with project options
include(CMakeDependentOption)
# Verify that Fortran and CXX compilers can properly talk to each other
# verify that Fortran and CXX compilers can properly talk to each other
include(FortranCInterface)
FortranCInterface_VERIFY(CXX)
# Check if given fortran source compiles
# check if given fortran source compiles
include(CheckFortranSourceCompiles)
# The -fPIC flag
# the -fPIC flag
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# The -flto
# the -flto

# Adding project modules dir (with .cmake extension)
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/cmake"
"${CMAKE_SOURCE_DIR}/cmake/third_party/cfitsio/cmake"
"${CMAKE_SOURCE_DIR}/cmake/third_party/curl/CMake"
)
# Including custom cmake modules
# adding project modules dir (with .cmake extension)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
# including cmake modules
include(project_instructions)
# Adding commander3 source files
# adding commander3 source files
# Note: I have added commander.cmake as an "independent" project
# so there is no need for other cmake lists. Advantage of this
# approach is that everything located in the same folder (cmake)
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,10 @@ This work has received funding from the European Union's Horizon 2020 research a
## Citation
If used for published results, please cite these papers using the associated bibliography file:
If used for published results, please cite these papers:
- [Jewell et al. 2004, ApJ, 609, 1](https://doi.org/10.1086/383515)
- [Wandelt et al. 2004, Phys. Rev. D, 70, 083511](https://doi.org/10.1103/PhysRevD.70.083511)
- [Eriksen et al. 2004, ApJS, 155, 227 (Commander)](https://doi.org/10.1086/425219)
- [Eriksen et al. 2008, ApJ, 676, 10 (Joint FG + CMB)](https://doi.org/10.1086/525277)
- Jewell et al. 2004, ApJ, 609, 1
- Wandelt et al. 2004, Phys. Rev. D, 70, 083511
- Eriksen et al. 2004, ApJS, 155, 227 (Commander)
- Eriksen et al. 2008, ApJ, 676, 10 (Joint FG + CMB)
[commander.bib](docs/commander.bib)
Binary file added cmake/.doxygen.cmake.swo
Binary file not shown.
117 changes: 117 additions & 0 deletions cmake/FindCFITSIO.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@

#-------------------------------------------------------------------------------
# Copyright (c) 2013-2013, Lars Baehren <[email protected]>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#-------------------------------------------------------------------------------

# - Check for the presence of CFITSIO
#
# The following variables are set when CFITSIO is found:
# CFITSIO_FOUND = Set to true, if all components of CFITSIO have been found.
# CFITSIO_INCLUDES = Include path for the header files of CFITSIO
# CFITSIO_LIBRARIES = Link these to use CFITSIO
# CFITSIO_LFLAGS = Linker flags (optional)

if (NOT CFITSIO_FOUND)

if (NOT CFITSIO_ROOT_DIR)
set (CFITSIO_ROOT_DIR ${CMAKE_INSTALL_PREFIX})
endif (NOT CFITSIO_ROOT_DIR)

##____________________________________________________________________________
## Check for the header files

find_path (CFITSIO_INCLUDES
NAMES fitsio.h fitsio2.h
HINTS ${CFITSIO_ROOT_DIR} ${CMAKE_INSTALL_PREFIX}
PATH_SUFFIXES include cfitsio include/cfitsio
)

##____________________________________________________________________________
## Check for the library

find_library (CFITSIO_LIBRARIES cfitsio
HINTS ${CFITSIO_ROOT_DIR} ${CMAKE_INSTALL_PREFIX}
PATH_SUFFIXES lib
)

##____________________________________________________________________________
## Determine library version

if (CFITSIO_INCLUDES AND CFITSIO_LIBRARIES)

find_file (HAVE_TESTCFITSIO_CC TestCFITSIOLibraryVersion.cc
HINTS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_MODULE_PATH}
)

try_run (run_TestCFITSIO compile_TestCFITSIO
${PROJECT_BINARY_DIR}/TestCFITSIO
${HAVE_TESTCFITSIO_CC}
CMAKE_FLAGS -DINCLUDE_DIRECTORIES=${CFITSIO_INCLUDES} -DLINK_LIBRARIES=${CFITSIO_LIBRARIES}
RUN_OUTPUT_VARIABLE CFITSIO_VERSION
)

if (CFITSIO_VERSION)
## extract partial version numbers
list (GET CFITSIO_VERSION 0 CFITSIO_VERSION_MAJOR)
list (GET CFITSIO_VERSION 1 CFITSIO_VERSION_MINOR)
## assemble full version number
set (CFITSIO_VERSION "${CFITSIO_VERSION_MAJOR}.${CFITSIO_VERSION_MINOR}")
endif (CFITSIO_VERSION)

endif ()

##____________________________________________________________________________
## Actions taken when all components have been found

# [Maksym] I have modified This part
find_package_handle_standard_args(CFITSIO
FOUND_VAR CFITSIO_FOUND
VERSION_VAR CFITSIO_VERSION
REQUIRED_VARS CFITSIO_LIBRARIES CFITSIO_INCLUDES
)

if (CFITSIO_FOUND)
if (NOT CFITSIO_FIND_QUIETLY)
message (STATUS "Found components for CFITSIO")
message (STATUS "CFITSIO_ROOT_DIR = ${CFITSIO_ROOT_DIR}")
message (STATUS "CFITSIO_VERSION = ${CFITSIO_VERSION}")
message (STATUS "CFITSIO_INCLUDES = ${CFITSIO_INCLUDES}")
message (STATUS "CFITSIO_LIBRARIES = ${CFITSIO_LIBRARIES}")
endif (NOT CFITSIO_FIND_QUIETLY)
else (CFITSIO_FOUND)
if (CFITSIO_FIND_REQUIRED)
message (FATAL_ERROR "Could not find CFITSIO!")
endif (CFITSIO_FIND_REQUIRED)
endif (CFITSIO_FOUND)

##____________________________________________________________________________
## Mark advanced variables

mark_as_advanced (
CFITSIO_ROOT_DIR
CFITSIO_INCLUDES
CFITSIO_LIBRARIES
)

endif (NOT CFITSIO_FOUND)
2 changes: 1 addition & 1 deletion cmake/FindHEALPIX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ find_package_handle_standard_args(HEALPIX
FOUND_VAR HEALPIX_FOUND
REQUIRED_VARS HEALPIX_LIBRARIES
HEALPIX_INCLUDE_DIRS
#HEALPIX_DATA_DIR
HEALPIX_DATA_DIR
VERSION_VAR HEALPIX_VERSION
HANDLE_COMPONENTS
)
Expand Down
11 changes: 11 additions & 0 deletions cmake/TestCFITSIOLibraryVersion.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <fitsio.h>
#include <iostream>

int main ()
{

std::cout << CFITSIO_MAJOR << ";"
<< CFITSIO_MINOR;

return 0;
}
Loading

0 comments on commit 1d5c18f

Please sign in to comment.