Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-40743: Clean up build and use cmake #10

Merged
merged 5 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 3 additions & 22 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,29 +1,10 @@
Makefile
config.h
config.status
libtool
man/Makefile
psfex.spec
src/.deps/
src/Makefile
src/fits/.deps/
src/fits/Makefile
src/levmar/.deps/
src/levmar/Makefile
src/wcs/.deps/
src/wcs/Makefile
stamp-h1
autom4te.cache/
src/fits/libfits.a
src/levmar/liblevmar.a
src/psfex
src/wcs/libwcs_c.a
man/psfex.1

# Produced by scons, in building the library
.sconf_temp/
.sconsign.dblite
*.os
python/astromatic/psfex/version.py*
lib/libpsfex.so
ups/psfex.cfgc

# Convention for out-of-source CMake builds
build
79 changes: 79 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
cmake_minimum_required(VERSION 3.5)

project(psfex VERSION "3.0.0" LANGUAGES C CXX)

set(DEFAULT_BUILD_TYPE "Release")

if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.")
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()

include(GNUInstallDirs)

find_library(FFTW3 fftw3 REQUIRED)

find_package(GSL REQUIRED)

set(SOURCE_FILES
src/fits/fitsmisc.c
src/levmar/Axb.c
src/levmar/lm.c
src/levmar/lmbc.c
src/levmar/lmblec.c
src/levmar/lmbleic.c
src/levmar/lmlec.c
src/levmar/misc.c
src/wcs/poly.c
src/context.c
src/diagnostic.c
src/dummies.c
src/fft.c
src/field_utils.c
src/field.c
src/homo.c
src/lapack_stub.cc
src/makeit2.c
src/misc.c
src/pca.c
src/prefs.c
src/psf.c
src/sample_utils.c
src/vignet.c
src/wcs_utils.c
src/xml.c
)

add_library(${PROJECT_NAME} STATIC ${SOURCE_FILES})
set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99)
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wno-unknown-pragmas -Wno-unused-local-typedefs)

target_include_directories(${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:src>
PRIVATE
src
${FFTW3_INCLUDE})

target_link_libraries(${PROJECT_NAME}
PRIVATE
GSL::gslcblas
fftw3 fftw3f)

set_target_properties(${PROJECT_NAME} PROPERTIES
VERSION ${PROJECT_VERSION}
POSITION_INDEPENDENT_CODE ON)

install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib"
)

install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/"
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
FILES_MATCHING
PATTERN "*.h"
)

53 changes: 0 additions & 53 deletions Makefile.am

This file was deleted.