mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-23 12:48:40 -05:00
Initial commit of a CMake script to build wsjtx.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3548 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
d77d8b5cb7
commit
b8b489ba97
179
CMakeLists.txt
Normal file
179
CMakeLists.txt
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
cmake_minimum_required (VERSION 2.8.9)
|
||||||
|
|
||||||
|
project (wsjtx C CXX Fortran)
|
||||||
|
|
||||||
|
set (wsjtx_VERSION_MAJOR 1)
|
||||||
|
set (wsjtx_VERSION_MINOR 2)
|
||||||
|
|
||||||
|
if (POLICY CMP0020)
|
||||||
|
cmake_policy (SET CMP0020 NEW) # link to Qt winmain on Windows
|
||||||
|
endif (POLICY CMP0020)
|
||||||
|
|
||||||
|
# make sure that the default is a RELEASE
|
||||||
|
if (NOT CMAKE_BUILD_TYPE)
|
||||||
|
set (CMAKE_BUILD_TYPE RELEASE CACHE STRING
|
||||||
|
"Choose the type of build, options are: None Debug Release."
|
||||||
|
FORCE)
|
||||||
|
endif (NOT CMAKE_BUILD_TYPE)
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# C++ setup
|
||||||
|
#
|
||||||
|
|
||||||
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||||
|
|
||||||
|
|
||||||
|
set (CXXSRCS
|
||||||
|
logbook/adif.cpp
|
||||||
|
logbook/countrydat.cpp
|
||||||
|
logbook/countriesworked.cpp
|
||||||
|
logbook/logbook.cpp
|
||||||
|
rigclass.cpp
|
||||||
|
psk_reporter.cpp
|
||||||
|
Modulator.cpp
|
||||||
|
Detector.cpp
|
||||||
|
logqso.cpp
|
||||||
|
displaytext.cpp
|
||||||
|
getfile.cpp
|
||||||
|
soundout.cpp
|
||||||
|
soundin.cpp
|
||||||
|
meterwidget.cpp
|
||||||
|
signalmeter.cpp
|
||||||
|
plotter.cpp
|
||||||
|
widegraph.cpp
|
||||||
|
devsetup.cpp
|
||||||
|
about.cpp
|
||||||
|
mainwindow.cpp
|
||||||
|
main.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
set (CXXSRCS ${CXXSRCS} killbyname.cpp)
|
||||||
|
endif (WIN32)
|
||||||
|
|
||||||
|
set_property (SOURCE ${CXXSRCS} APPEND PROPERTY COMPILE_FLAGS "-include wsjtx_config.h")
|
||||||
|
|
||||||
|
set (UISRCS
|
||||||
|
mainwindow.ui
|
||||||
|
about.ui
|
||||||
|
devsetup.ui
|
||||||
|
widegraph.ui
|
||||||
|
logqso.ui
|
||||||
|
)
|
||||||
|
|
||||||
|
#
|
||||||
|
# sort out pre-requisites
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# libfftw3 setup
|
||||||
|
#
|
||||||
|
find_path (fftw3f_INCLUDES fftw3.f)
|
||||||
|
find_library (fftw3f NAMES fftw3f fftw3f-3)
|
||||||
|
include_directories (${fftw3f_INCLUDES})
|
||||||
|
|
||||||
|
#
|
||||||
|
# libhamlib setup
|
||||||
|
#
|
||||||
|
find_path (hamlib_INCLUDES hamlib/rig.h)
|
||||||
|
find_library (hamlib NAMES hamlib hamlib-2)
|
||||||
|
find_library (usb NAMES usb0)
|
||||||
|
find_file (hamlib-runtime libhamlib-2.dll)
|
||||||
|
find_path (hamlib-runtime-path libhamlib-2.dll)
|
||||||
|
file (GLOB hamlib-backends ${hamlib-runtime-path}/hamlib*.dll)
|
||||||
|
include_directories (${hamlib_INCLUDES})
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Qt5 setup
|
||||||
|
#
|
||||||
|
|
||||||
|
# Widgets finds its own dependencies.
|
||||||
|
find_package (Qt5Widgets REQUIRED)
|
||||||
|
find_package (Qt5Multimedia REQUIRED)
|
||||||
|
|
||||||
|
# Tell CMake to run moc when necessary
|
||||||
|
set (CMAKE_AUTOMOC ON)
|
||||||
|
|
||||||
|
# don't use Qt "keywords" signal, slot, emit in generated files to
|
||||||
|
# avoid compatability issue with other libraries
|
||||||
|
#ADD_DEFINITIONS (-DQT_NO_KEYWORDS)
|
||||||
|
|
||||||
|
# As moc files are generated in the binary dir, tell CMake to always
|
||||||
|
# look for includes there:
|
||||||
|
set (CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
|
||||||
|
# project definitions
|
||||||
|
add_definitions (-DQT5)
|
||||||
|
if (CMAKE_HOST_UNIX)
|
||||||
|
add_definitions (-DUNIX)
|
||||||
|
elseif (CMAKE_HOST_WIN32)
|
||||||
|
add_definitions (-DWIN32)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
add_definitions (-DWSJT_SOFT_KEYING)
|
||||||
|
set_property (DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT)
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# build the subdirectories
|
||||||
|
#
|
||||||
|
add_subdirectory (lib)
|
||||||
|
|
||||||
|
|
||||||
|
# UI generation
|
||||||
|
qt5_wrap_ui (GENUISRCS ${UISRCS})
|
||||||
|
|
||||||
|
add_executable (wsjtx ${CXXSRCS} ${GENUISRCS} ${GENQRC})
|
||||||
|
target_link_libraries (wsjtx jt9impl ${hamlib} ${fftw3f})
|
||||||
|
if (WIN32)
|
||||||
|
target_link_libraries (wsjtx ${CMAKE_CURRENT_SOURCE_DIR}/libHRDInterface001.a)
|
||||||
|
endif (WIN32)
|
||||||
|
add_dependencies (wsjtx hamlib)
|
||||||
|
qt5_use_modules (wsjtx Widgets Multimedia OpenGL)
|
||||||
|
|
||||||
|
file (DOWNLOAD http://physics.princeton.edu/pulsar/K1JT/kvasd contrib/kvasd)
|
||||||
|
add_custom_target (kvasd DEPENDS contrib/kvasd)
|
||||||
|
|
||||||
|
install (
|
||||||
|
TARGETS wsjtx
|
||||||
|
RUNTIME DESTINATION bin
|
||||||
|
LIBRARY DESTINATION lib
|
||||||
|
)
|
||||||
|
|
||||||
|
install (DIRECTORY Palettes DESTINATION bin PATTERN *.pal)
|
||||||
|
|
||||||
|
install (
|
||||||
|
PROGRAMS ${CMAKE_BINARY_DIR}/contrib/kvasd
|
||||||
|
DESTINATION bin
|
||||||
|
)
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
install (
|
||||||
|
FILES ${hamlib-runtime} ${hamlib-backends} ${fftw3f} ${usb} ${Widgets} ${Multimedia}
|
||||||
|
DESTINATION bin COMPONENT Runtime
|
||||||
|
)
|
||||||
|
endif (WIN32)
|
||||||
|
|
||||||
|
|
||||||
|
# a custom target that is always built
|
||||||
|
ADD_CUSTOM_TARGET (revisiontag ALL)
|
||||||
|
|
||||||
|
# creates svnversion.h using cmake script
|
||||||
|
ADD_CUSTOM_COMMAND (TARGET revisiontag COMMAND ${CMAKE_COMMAND}
|
||||||
|
-DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
-P ${CMAKE_CURRENT_SOURCE_DIR}/getsvn.cmake)
|
||||||
|
|
||||||
|
# explicitly say that the executable depends on custom target
|
||||||
|
add_dependencies(wsjtx revisiontag)
|
||||||
|
|
||||||
|
#
|
||||||
|
# versioning
|
||||||
|
#
|
||||||
|
configure_file (
|
||||||
|
"${PROJECT_SOURCE_DIR}/wsjtx_config.h.in"
|
||||||
|
"${PROJECT_BINARY_DIR}/wsjtx_config.h"
|
||||||
|
)
|
||||||
|
|
||||||
|
include_directories ("${PROJECT_BINARY_DIR}")
|
16
getsvn.cmake
Normal file
16
getsvn.cmake
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
find_package (Subversion)
|
||||||
|
if (Subversion_FOUND AND EXISTS ${PROJECT_SOURCE_DIR}/.svn)
|
||||||
|
# the FindSubversion.cmake module is part of the standard distribution
|
||||||
|
include (FindSubversion)
|
||||||
|
# extract working copy information for SOURCE_DIR into MY_XXX variables
|
||||||
|
Subversion_WC_INFO (${SOURCE_DIR} MY)
|
||||||
|
# write a file with the SVNVERSION define
|
||||||
|
file (WRITE svnversion.h.txt "#define SVNVERSION ${MY_WC_REVISION}\n")
|
||||||
|
else (Subversion_FOUND AND EXISTS ${PROJECT_SOURCE_DIR}/.svn)
|
||||||
|
file (WRITE svnversion.h.txt "#define SVNVERSION local\n")
|
||||||
|
endif (Subversion_FOUND AND EXISTS ${PROJECT_SOURCE_DIR}/.svn)
|
||||||
|
|
||||||
|
# copy the file to the final header only if the version changes
|
||||||
|
# reduces needless rebuilds
|
||||||
|
execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
svnversion.h.txt svnversion.h)
|
186
lib/CMakeLists.txt
Normal file
186
lib/CMakeLists.txt
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
cmake_minimum_required (VERSION 2.8.8)
|
||||||
|
|
||||||
|
project (libjt9 C CXX Fortran)
|
||||||
|
|
||||||
|
if (POLICY CMP0020)
|
||||||
|
cmake_policy (SET CMP0020 NEW) # link to Qt winmain on Windows
|
||||||
|
endif (POLICY CMP0020)
|
||||||
|
|
||||||
|
# make sure that the default is a RELEASE
|
||||||
|
if (NOT CMAKE_BUILD_TYPE)
|
||||||
|
set (CMAKE_BUILD_TYPE RELEASE CACHE STRING
|
||||||
|
"Choose the type of build, options are: None Debug Release."
|
||||||
|
FORCE)
|
||||||
|
endif (NOT CMAKE_BUILD_TYPE)
|
||||||
|
|
||||||
|
set (CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Fortran setup
|
||||||
|
#
|
||||||
|
|
||||||
|
# FFLAGS depend on the compiler
|
||||||
|
get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME)
|
||||||
|
|
||||||
|
if (Fortran_COMPILER_NAME MATCHES "gfortran.*")
|
||||||
|
# gfortran
|
||||||
|
set (CMAKE_Fortran_FLAGS_RELEASE "-funroll-all-loops -fno-f2c -O3")
|
||||||
|
set (CMAKE_Fortran_FLAGS_DEBUG "-fno-f2c -O0 -g")
|
||||||
|
elseif (Fortran_COMPILER_NAME MATCHES "ifort.*")
|
||||||
|
# ifort (untested)
|
||||||
|
set (CMAKE_Fortran_FLAGS_RELEASE "-f77rtl -O3")
|
||||||
|
set (CMAKE_Fortran_FLAGS_DEBUG "-f77rtl -O0 -g")
|
||||||
|
elseif (Fortran_COMPILER_NAME MATCHES "g77")
|
||||||
|
# g77
|
||||||
|
set (CMAKE_Fortran_FLAGS_RELEASE "-funroll-all-loops -fno-f2c -O3 -m32")
|
||||||
|
set (CMAKE_Fortran_FLAGS_DEBUG "-fno-f2c -O0 -g -m32")
|
||||||
|
else (Fortran_COMPILER_NAME MATCHES "gfortran.*")
|
||||||
|
message ("CMAKE_Fortran_COMPILER full path: " ${CMAKE_Fortran_COMPILER})
|
||||||
|
message ("Fortran compiler: " ${Fortran_COMPILER_NAME})
|
||||||
|
message ("No optimized Fortran compiler flags are known, we just try -O2...")
|
||||||
|
set (CMAKE_Fortran_FLAGS_RELEASE "-O2")
|
||||||
|
set (CMAKE_Fortran_FLAGS_DEBUG "-O0 -g")
|
||||||
|
endif (Fortran_COMPILER_NAME MATCHES "gfortran.*")
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# C++ setup
|
||||||
|
#
|
||||||
|
|
||||||
|
if (UNIX)
|
||||||
|
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||||
|
endif (UNIX)
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# setup and test Fortran C/C++ interaction
|
||||||
|
#
|
||||||
|
|
||||||
|
include (FortranCInterface)
|
||||||
|
FortranCInterface_VERIFY (CXX QUIET)
|
||||||
|
FortranCInterface_HEADER (FC.h MACRO_NAMESPACE "FC_" SYMBOL_NAMESPACE "FC_"
|
||||||
|
SYMBOLS )
|
||||||
|
|
||||||
|
|
||||||
|
set (FSRCS
|
||||||
|
afc65b.f90
|
||||||
|
afc9.f90
|
||||||
|
analytic.f90
|
||||||
|
azdist.f90
|
||||||
|
ccf2.f90
|
||||||
|
ccf65.f90
|
||||||
|
chkhist.f90
|
||||||
|
chkss2.f90
|
||||||
|
db.f90
|
||||||
|
decode65a.f90
|
||||||
|
decode65b.f90
|
||||||
|
decode9.f90
|
||||||
|
decoder.f90
|
||||||
|
deg2grid.f90
|
||||||
|
demod64a.f90
|
||||||
|
downsam9.f90
|
||||||
|
encode232.f90
|
||||||
|
entail.f90
|
||||||
|
extract.F90
|
||||||
|
f77_wisdom.f90
|
||||||
|
fano232.f90
|
||||||
|
fchisq.f90
|
||||||
|
fchisq65.f90
|
||||||
|
fil3.f90
|
||||||
|
fil6521.f90
|
||||||
|
filbig.f90
|
||||||
|
fillcom.f90
|
||||||
|
flat2.f90
|
||||||
|
flat65.f90
|
||||||
|
four2a.f90
|
||||||
|
gen65.f90
|
||||||
|
genjt9.f90
|
||||||
|
geodist.f90
|
||||||
|
getlags.f90
|
||||||
|
getpfx1.f90
|
||||||
|
getpfx2.f90
|
||||||
|
graycode.f90
|
||||||
|
graycode65.f90
|
||||||
|
grid2deg.f90
|
||||||
|
grid2k.f90
|
||||||
|
grid2n.f90
|
||||||
|
indexx.f90
|
||||||
|
interleave63.f90
|
||||||
|
interleave9.f90
|
||||||
|
jt65a.f90
|
||||||
|
k2grid.f90
|
||||||
|
morse.f90
|
||||||
|
move.f90
|
||||||
|
n2grid.f90
|
||||||
|
nchar.f90
|
||||||
|
packbits.f90
|
||||||
|
packcall.f90
|
||||||
|
packgrid.f90
|
||||||
|
packmsg.f90
|
||||||
|
packtext.f90
|
||||||
|
pctile.f90
|
||||||
|
peakdt9.f90
|
||||||
|
pfxdump.f90
|
||||||
|
sec_midn.f90
|
||||||
|
setup65.f90
|
||||||
|
sleep_msec.f90
|
||||||
|
smo121.f90
|
||||||
|
softsym.f90
|
||||||
|
sort.f90
|
||||||
|
ssort.f90
|
||||||
|
stdmsg.f90
|
||||||
|
symspec.f90
|
||||||
|
symspec2.f90
|
||||||
|
symspec65.f90
|
||||||
|
sync9.f90
|
||||||
|
timer.f90
|
||||||
|
twkfreq.f90
|
||||||
|
twkfreq65.f90
|
||||||
|
unpackbits.f90
|
||||||
|
unpackcall.f90
|
||||||
|
unpackgrid.f90
|
||||||
|
unpackmsg.f90
|
||||||
|
unpacktext.f90
|
||||||
|
zplot9.f90
|
||||||
|
)
|
||||||
|
|
||||||
|
set (CSRCS
|
||||||
|
cutil.c
|
||||||
|
decode_rs.c
|
||||||
|
encode_rs.c
|
||||||
|
gran.c
|
||||||
|
igray.c
|
||||||
|
init_rs.c
|
||||||
|
wrapkarn.c
|
||||||
|
)
|
||||||
|
|
||||||
|
set (CXXSRCS
|
||||||
|
ipcomm.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
add_definitions (-DBIGSYM=1)
|
||||||
|
|
||||||
|
#
|
||||||
|
# build our targets
|
||||||
|
#
|
||||||
|
add_library (jt9impl STATIC ${FSRCS} ${CSRCS} ${CXXSRCS})
|
||||||
|
qt5_use_modules (jt9impl Core)
|
||||||
|
|
||||||
|
add_executable (jt9sim jt9sim.f90)
|
||||||
|
target_link_libraries (jt9sim jt9impl)
|
||||||
|
|
||||||
|
add_executable (jt9code jt9code.f90)
|
||||||
|
target_link_libraries (jt9code jt9impl)
|
||||||
|
|
||||||
|
add_executable (jt9 jt9.f90 jt9a.f90 jt9b.f90 jt9c.f90)
|
||||||
|
target_link_libraries (jt9 jt9impl ${fftw3f})
|
||||||
|
add_dependencies (jt9 fftw3f)
|
||||||
|
qt5_use_modules (jt9 Core)
|
||||||
|
|
||||||
|
install (
|
||||||
|
TARGETS jt9
|
||||||
|
RUNTIME DESTINATION bin
|
||||||
|
LIBRARY DESTINATION lib
|
||||||
|
)
|
4
wsjtx_config.h.in
Normal file
4
wsjtx_config.h.in
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#include "svnversion.h"
|
||||||
|
|
||||||
|
#define WSJTX_VERSION_MAJOR @WSJTX_VERSION_MAJOR@
|
||||||
|
#define WSJTX_VERSION_MINOR @WSJTX_VERSION_MINOR@
|
Loading…
Reference in New Issue
Block a user