Commit 5686e05e authored by Artem Fedoskin's avatar Artem Fedoskin

Added KStars Lite building script

parent 504a286a
......@@ -17,4 +17,8 @@
# Vim swapfiles
.*.swp
# KStars Lite Android libraries
build_kstarslite/android_libs/*
build_kstarslite/android_libs_src/libnova/build/*
CMakeLists.txt.user
\ No newline at end of file
This diff is collapsed.
PROJECT(CFITSIO)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0)
# Allow the developer to select if Dynamic or Static libraries are built
OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" ON)
OPTION (USE_PTHREADS "Thread-safe build (using pthreads)" OFF)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}")
set (LIB_DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
set (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/")
# Define project version
SET(${PROJECT_NAME}_MAJOR_VERSION 3)
SET(${PROJECT_NAME}_MINOR_VERSION 39)
SET(${PROJECT_NAME}_VERSION ${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION})
SET(LIB_NAME cfitsio)
# Microsoft Visual Studio:
IF(MSVC OR BORLAND)
# Define
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
# Need an empty unistd.h in MSVC for flex-generated eval_l.c:
FILE(WRITE ${CMAKE_SOURCE_DIR}/unistd.h "")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
ENDIF()
IF(BORLAND)
# Suppress spurious Borland compiler warnings about "Suspicious
# pointer arithmetic", "Possibly incorrect assignment", and
# "Comparing signed and unsigned values".
ADD_DEFINITIONS(-w-spa)
ADD_DEFINITIONS(-w-pia)
ADD_DEFINITIONS(-w-csu)
ENDIF()
#add_subdirectory (src)
SET (LIB_TYPE STATIC)
IF (BUILD_SHARED_LIBS)
SET (LIB_TYPE SHARED)
ENDIF (BUILD_SHARED_LIBS)
FILE(GLOB H_FILES "*.h")
IF (USE_PTHREADS)
FIND_PACKAGE(pthreads REQUIRED)
INCLUDE_DIRECTORIES(${PTHREADS_INCLUDE_DIR})
ADD_DEFINITIONS(-D_REENTRANT)
ENDIF()
# Math library (not available in MSVC)
IF (NOT MSVC)
FIND_LIBRARY(M_LIB m)
ELSE()
SET(M_LIB "")
ENDIF()
SET(SRC_FILES
buffers.c cfileio.c checksum.c drvrfile.c drvrmem.c
drvrnet.c drvrsmem.c drvrgsiftp.c editcol.c edithdu.c eval_l.c
eval_y.c eval_f.c fitscore.c getcol.c getcolb.c getcold.c getcole.c
getcoli.c getcolj.c getcolk.c getcoll.c getcols.c getcolsb.c
getcoluk.c getcolui.c getcoluj.c getkey.c group.c grparser.c
histo.c iraffits.c
modkey.c putcol.c putcolb.c putcold.c putcole.c putcoli.c
putcolj.c putcolk.c putcoluk.c putcoll.c putcols.c putcolsb.c
putcolu.c putcolui.c putcoluj.c putkey.c region.c scalnull.c
swapproc.c wcssub.c wcsutil.c imcompress.c quantize.c ricecomp.c
pliocomp.c fits_hcompress.c fits_hdecompress.c zlib/zuncompress.c
zlib/zcompress.c zlib/adler32.c zlib/crc32.c zlib/inffast.c
zlib/inftrees.c zlib/trees.c zlib/zutil.c zlib/deflate.c
zlib/infback.c zlib/inflate.c zlib/uncompr.c simplerng.c
f77_wrap1.c f77_wrap2.c f77_wrap3.c f77_wrap4.c
)
ADD_LIBRARY(${LIB_NAME} ${LIB_TYPE} ${H_FILES} ${SRC_FILES})
TARGET_LINK_LIBRARIES(${LIB_NAME} ${PTHREADS_LIBRARY} ${M_LIB})
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_VERSION} SOVERSION ${${PROJECT_NAME}_MAJOR_VERSION})
install(TARGETS ${LIB_NAME} DESTINATION ${LIB_DESTINATION})
install(FILES ${H_FILES} DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
ENABLE_TESTING()
ADD_EXECUTABLE(TestProg testprog.c)
TARGET_LINK_LIBRARIES(TestProg ${LIB_NAME})
ADD_TEST(TestProg TestProg)
# Copy testprog.tpt to build directory to allow quick test
# of ./TestProg (or .\Release\TestProg.exe in MSVC):
FILE(COPY ${CMAKE_SOURCE_DIR}/testprog.tpt DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
ADD_EXECUTABLE(cookbook cookbook.c)
TARGET_LINK_LIBRARIES(cookbook ${LIB_NAME})
ADD_TEST(cookbook cookbook)
ADD_EXECUTABLE(FPack fpack.c fpackutil.c)
TARGET_LINK_LIBRARIES(FPack ${LIB_NAME})
ADD_EXECUTABLE(Funpack funpack.c fpackutil.c)
TARGET_LINK_LIBRARIES(Funpack ${LIB_NAME})
ADD_EXECUTABLE(Fitscopy fitscopy.c)
TARGET_LINK_LIBRARIES(Fitscopy ${LIB_NAME})
# To expands the command line arguments in Windows, see:
# http://msdn.microsoft.com/en-us/library/8bch7bkk.aspx
if(MSVC)
set_target_properties(FPack Funpack PROPERTIES
LINK_FLAGS "setargv.obj"
)
endif(MSVC)
# - Find the Pthreads library
# This module searches for the Pthreads library (including the
# pthreads-win32 port).
#
# This module defines these variables:
#
# PTHREADS_FOUND
# True if the Pthreads library was found
# PTHREADS_LIBRARY
# The location of the Pthreads library
# PTHREADS_INCLUDE_DIR
# The include path of the Pthreads library
# PTHREADS_DEFINITIONS
# Preprocessor definitions to define
#
# This module responds to the PTHREADS_EXCEPTION_SCHEME
# variable on Win32 to allow the user to control the
# library linked against. The Pthreads-win32 port
# provides the ability to link against a version of the
# library with exception handling. IT IS NOT RECOMMENDED
# THAT YOU USE THIS because most POSIX thread implementations
# do not support stack unwinding.
#
# PTHREADS_EXCEPTION_SCHEME
# C = no exceptions (default)
# (NOTE: This is the default scheme on most POSIX thread
# implementations and what you should probably be using)
# CE = C++ Exception Handling
# SE = Structure Exception Handling (MSVC only)
#
#
# Define a default exception scheme to link against
# and validate user choice.
#
IF(NOT DEFINED PTHREADS_EXCEPTION_SCHEME)
# Assign default if needed
SET(PTHREADS_EXCEPTION_SCHEME "C")
ELSE(NOT DEFINED PTHREADS_EXCEPTION_SCHEME)
# Validate
IF(NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "C" AND
NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "CE" AND
NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "SE")
MESSAGE(FATAL_ERROR "See documentation for FindPthreads.cmake, only C, CE, and SE modes are allowed")
ENDIF(NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "C" AND
NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "CE" AND
NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "SE")
IF(NOT MSVC AND PTHREADS_EXCEPTION_SCHEME STREQUAL "SE")
MESSAGE(FATAL_ERROR "Structured Exception Handling is only allowed for MSVC")
ENDIF(NOT MSVC AND PTHREADS_EXCEPTION_SCHEME STREQUAL "SE")
ENDIF(NOT DEFINED PTHREADS_EXCEPTION_SCHEME)
#
# Find the header file
#
FIND_PATH(PTHREADS_INCLUDE_DIR pthread.h)
#
# Find the library
#
SET(names)
IF(MSVC)
SET(names
pthreadV${PTHREADS_EXCEPTION_SCHEME}2
pthread
)
ELSEIF(MINGW)
SET(names
pthreadG${PTHREADS_EXCEPTION_SCHEME}2
pthread
)
ELSE(MSVC) # Unix / Cygwin / Apple
SET(names pthread)
ENDIF(MSVC)
FIND_LIBRARY(PTHREADS_LIBRARY ${names}
DOC "The Portable Threads Library")
IF(PTHREADS_INCLUDE_DIR AND PTHREADS_LIBRARY)
SET(PTHREADS_FOUND true)
SET(PTHREADS_DEFINITIONS -DHAVE_PTHREAD_H)
SET(PTHREADS_INCLUDE_DIRS ${PTHREADS_INCLUDE_DIR})
SET(PTHREADS_LIBRARIES ${PTHREADS_LIBRARY})
ENDIF(PTHREADS_INCLUDE_DIR AND PTHREADS_LIBRARY)
IF(PTHREADS_FOUND)
IF(NOT PTHREADS_FIND_QUIETLY)
MESSAGE(STATUS "Found Pthreads: ${PTHREADS_LIBRARY}")
ENDIF(NOT PTHREADS_FIND_QUIETLY)
ELSE(PTHREADS_FOUND)
IF(PTHREADS_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find the Pthreads Library")
ENDIF(PTHREADS_FIND_REQUIRED)
ENDIF(PTHREADS_FOUND)
Copyright (Unpublished--all rights reserved under the copyright laws of
the United States), U.S. Government as represented by the Administrator
of the National Aeronautics and Space Administration. No copyright is
claimed in the United States under Title 17, U.S. Code.
Permission to freely use, copy, modify, and distribute this software
and its documentation without fee is hereby granted, provided that this
copyright notice and disclaimer of warranty appears in all copies.
DISCLAIMER:
THE SOFTWARE IS PROVIDED 'AS IS' WITHOUT ANY WARRANTY OF ANY KIND,
EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO,
ANY WARRANTY THAT THE SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, AND FREEDOM FROM INFRINGEMENT, AND ANY WARRANTY THAT THE
DOCUMENTATION WILL CONFORM TO THE SOFTWARE, OR ANY WARRANTY THAT THE
SOFTWARE WILL BE ERROR FREE. IN NO EVENT SHALL NASA BE LIABLE FOR ANY
DAMAGES, INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL OR
CONSEQUENTIAL DAMAGES, ARISING OUT OF, RESULTING FROM, OR IN ANY WAY
CONNECTED WITH THIS SOFTWARE, WHETHER OR NOT BASED UPON WARRANTY,
CONTRACT, TORT , OR OTHERWISE, WHETHER OR NOT INJURY WAS SUSTAINED BY
PERSONS OR PROPERTY OR OTHERWISE, AND WHETHER OR NOT LOSS WAS SUSTAINED
FROM, OR AROSE OUT OF THE RESULTS OF, OR USE OF, THE SOFTWARE OR
SERVICES PROVIDED HEREUNDER.
#
# Makefile for cfitsio library:
#
# Oct-96 : original version by
#
# JDD/WDP
# NASA GSFC
# Oct 1996
#
# 25-Jan-01 : removed conditional drvrsmem.c compilation because this
# is now handled within the source file itself.
# 09-Mar-98 : modified to conditionally compile drvrsmem.c. Also
# changes to target all (deleted clean), added DEFS, LIBS, added
# DEFS to .c.o, added SOURCES_SHMEM and MY_SHMEM, expanded getcol*
# and putcol* in SOURCES, modified OBJECTS, mv changed to /bin/mv
# (to bypass aliasing), cp changed to /bin/cp, add smem and
# testprog targets. See also changes and comments in configure.in
# Default library name:
PACKAGE = cfitsio
# CFITSIO version numbers:
CFITSIO_MAJOR = @CFITSIO_MAJOR@
CFITSIO_MINOR = @CFITSIO_MINOR@
CFITSIO_SONAME = @CFITSIO_SONAME@
prefix = @prefix@
exec_prefix = @exec_prefix@
DESTDIR =
CFITSIO_BIN = ${DESTDIR}@bindir@
CFITSIO_LIB = ${DESTDIR}@libdir@
CFITSIO_INCLUDE = ${DESTDIR}@includedir@
INSTALL_DIRS = @INSTALL_ROOT@ ${CFITSIO_INCLUDE} ${CFITSIO_LIB} ${CFITSIO_LIB}/pkgconfig
SHELL = /bin/sh
ARCHIVE = @ARCHIVE@
RANLIB = @RANLIB@
CC = @CC@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
SSE_FLAGS = @SSE_FLAGS@
FC = @FC@
LDFLAGS = @LDFLAGS@
LDFLAGS_BIN = @LDFLAGS_BIN@
DEFS = @DEFS@
LIBS = @LIBS@
FLEX = flex
BISON = bison
SHLIB_LD = @SHLIB_LD@
SHLIB_SUFFIX = @SHLIB_SUFFIX@
CFITSIO_SHLIB = @CFITSIO_SHLIB@
CFITSIO_SHLIB_SONAME = @CFITSIO_SHLIB_SONAME@
CORE_SOURCES = buffers.c cfileio.c checksum.c drvrfile.c drvrmem.c \
drvrnet.c drvrsmem.c drvrgsiftp.c editcol.c edithdu.c eval_l.c \
eval_y.c eval_f.c fitscore.c getcol.c getcolb.c getcold.c getcole.c \
getcoli.c getcolj.c getcolk.c getcoll.c getcols.c getcolsb.c \
getcoluk.c getcolui.c getcoluj.c getkey.c group.c grparser.c \
histo.c iraffits.c \
modkey.c putcol.c putcolb.c putcold.c putcole.c putcoli.c \
putcolj.c putcolk.c putcoluk.c putcoll.c putcols.c putcolsb.c \
putcolu.c putcolui.c putcoluj.c putkey.c region.c scalnull.c \
swapproc.c wcssub.c wcsutil.c imcompress.c quantize.c ricecomp.c \
pliocomp.c fits_hcompress.c fits_hdecompress.c \
simplerng.c
ZLIB_SOURCES = zlib/adler32.c zlib/crc32.c zlib/deflate.c zlib/infback.c \
zlib/inffast.c zlib/inflate.c zlib/inftrees.c zlib/trees.c \
zlib/uncompr.c zlib/zcompress.c zlib/zuncompress.c zlib/zutil.c
SOURCES = ${CORE_SOURCES} ${ZLIB_SOURCES} @F77_WRAPPERS@
OBJECTS = ${SOURCES:.c=.o}
CORE_OBJECTS = ${CORE_SOURCES:.c=.o} ${ZLIB_SOURCES:.c=.o}
FITSIO_SRC = f77_wrap1.c f77_wrap2.c f77_wrap3.c f77_wrap4.c
# ============ description of all targets =============
# - <<-- ignore error code
all:
@if [ "x${FC}" = x ]; then \
${MAKE} all-nofitsio; \
else \
${MAKE} stand_alone; \
fi
all-nofitsio:
${MAKE} stand_alone "FITSIO_SRC="
stand_alone: lib${PACKAGE}.a
lib${PACKAGE}.a: ${OBJECTS}
${ARCHIVE} $@ ${OBJECTS}; \
${RANLIB} $@;
shared: lib${PACKAGE}${SHLIB_SUFFIX}
lib${PACKAGE}${SHLIB_SUFFIX}: ${OBJECTS}
${SHLIB_LD} ${LDFLAGS} -o ${CFITSIO_SHLIB} ${OBJECTS} -lm ${LIBS}
@if [ "x${CFITSIO_SHLIB_SONAME}" != x ]; then \