2013-08-14 07:31:49 -04:00
|
|
|
cmake_minimum_required (VERSION 2.8.9)
|
|
|
|
|
|
|
|
project (wsjtx C CXX Fortran)
|
|
|
|
|
2013-08-15 20:24:32 -04:00
|
|
|
set (WSJTX_VERSION_MAJOR 1)
|
2014-03-06 15:56:29 -05:00
|
|
|
set (WSJTX_VERSION_MINOR 3)
|
2013-08-14 07:31:49 -04:00
|
|
|
|
|
|
|
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")
|
2014-03-10 20:43:02 -04:00
|
|
|
if (WIN32)
|
|
|
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-keep-inline-dllexport")
|
|
|
|
set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -Wl,-subsystem,windows")
|
|
|
|
endif (WIN32)
|
2013-08-14 07:31:49 -04:00
|
|
|
|
|
|
|
|
|
|
|
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
|
2013-08-24 21:48:45 -04:00
|
|
|
decodedtext.cpp
|
2013-08-14 07:31:49 -04:00
|
|
|
getfile.cpp
|
|
|
|
soundout.cpp
|
|
|
|
soundin.cpp
|
|
|
|
meterwidget.cpp
|
|
|
|
signalmeter.cpp
|
|
|
|
plotter.cpp
|
|
|
|
widegraph.cpp
|
|
|
|
devsetup.cpp
|
|
|
|
about.cpp
|
2014-03-05 15:25:01 -05:00
|
|
|
astro.cpp
|
2013-08-14 07:31:49 -04:00
|
|
|
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
|
2014-03-05 15:25:01 -05:00
|
|
|
astro.ui
|
2013-08-14 07:31:49 -04:00
|
|
|
devsetup.ui
|
|
|
|
widegraph.ui
|
|
|
|
logqso.ui
|
|
|
|
)
|
|
|
|
|
|
|
|
#
|
|
|
|
# sort out pre-requisites
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# libfftw3 setup
|
|
|
|
#
|
|
|
|
find_path (fftw3f_INCLUDES fftw3.f)
|
2014-03-06 15:56:29 -05:00
|
|
|
find_library (fftw3f_LIBRARIES NAMES fftw3f fftw3f-3)
|
2013-08-14 07:31:49 -04:00
|
|
|
include_directories (${fftw3f_INCLUDES})
|
|
|
|
|
|
|
|
#
|
|
|
|
# libhamlib setup
|
|
|
|
#
|
|
|
|
find_path (hamlib_INCLUDES hamlib/rig.h)
|
2014-03-06 15:56:29 -05:00
|
|
|
find_library (hamlib_LIBRARIES NAMES hamlib hamlib-2 PATH_SUFFIXES msvc gcc)
|
2013-08-14 07:31:49 -04:00
|
|
|
include_directories (${hamlib_INCLUDES})
|
|
|
|
|
2014-03-06 15:56:29 -05:00
|
|
|
if (WIN32)
|
|
|
|
find_library (hamlib_RUNTIME NAMES hamlib hamlib-2 PATH_SUFFIXES bin)
|
|
|
|
get_filename_component (_hamlib_runtime_path "${hamlib_RUNTIME}" PATH)
|
|
|
|
file (GLOB hamlib_BACKENDS ${_hamlib_runtime_path}/hamlib*.dll)
|
|
|
|
find_library (usb_RUNTIME NAMES usb0 PATH_SUFFIXES bin)
|
|
|
|
endif (WIN32)
|
|
|
|
|
2013-08-14 07:31:49 -04:00
|
|
|
|
|
|
|
#
|
|
|
|
# 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 ()
|
|
|
|
|
2013-08-17 15:21:14 -04:00
|
|
|
# add_definitions (-DWSJT_SOFT_KEYING)
|
2013-08-14 07:31:49 -04:00
|
|
|
set_property (DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT)
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# build the subdirectories
|
|
|
|
#
|
|
|
|
add_subdirectory (lib)
|
|
|
|
|
|
|
|
|
2013-08-17 08:29:10 -04:00
|
|
|
#
|
|
|
|
# fetch kvasd
|
|
|
|
#
|
2013-08-17 15:21:14 -04:00
|
|
|
if (APPLE)
|
|
|
|
set (kvasd_NAME http://svn.berlios.de/wsvn/wsjt/trunk/KVASD_gfortran_Mac${CMAKE_EXECUTABLE_SUFFIX})
|
2013-08-17 08:29:10 -04:00
|
|
|
else ()
|
2013-08-17 15:21:14 -04:00
|
|
|
set (kvasd_NAME http://www.physics.princeton.edu/pulsar/K1JT/kvasd${CMAKE_EXECUTABLE_SUFFIX})
|
2013-08-17 08:29:10 -04:00
|
|
|
endif ()
|
|
|
|
file (
|
2013-08-17 15:21:14 -04:00
|
|
|
DOWNLOAD ${kvasd_NAME} contrib/kvasd${CMAKE_EXECUTABLE_SUFFIX}
|
2013-08-17 08:29:10 -04:00
|
|
|
STATUS kvasd_STATUS
|
|
|
|
LOG kvasd_LOG
|
|
|
|
SHOW_PROGRESS
|
|
|
|
)
|
|
|
|
message (${kvasd_LOG})
|
|
|
|
list (GET kvasd_STATUS 0 kvasd_RC)
|
|
|
|
if (!kvasd_RC)
|
|
|
|
message (FATAL_ERROR "${kvasd_STATUS}")
|
|
|
|
endif (!kvasd_RC)
|
|
|
|
add_custom_target (kvasd DEPENDS contrib/kvasd${CMAKE_EXECUTABLE_SUFFIX})
|
|
|
|
|
|
|
|
|
2013-08-14 07:31:49 -04:00
|
|
|
# UI generation
|
|
|
|
qt5_wrap_ui (GENUISRCS ${UISRCS})
|
|
|
|
|
2013-08-15 20:24:32 -04:00
|
|
|
add_executable (wsjtx ${CXXSRCS} ${GENUISRCS} wsjtx.rc)
|
2014-03-06 15:56:29 -05:00
|
|
|
target_link_libraries (wsjtx jt9impl ${hamlib_LIBRARIES} ${fftw3f_LIBRARIES})
|
2013-08-14 07:31:49 -04:00
|
|
|
if (WIN32)
|
|
|
|
target_link_libraries (wsjtx ${CMAKE_CURRENT_SOURCE_DIR}/libHRDInterface001.a)
|
|
|
|
endif (WIN32)
|
2014-03-06 15:56:29 -05:00
|
|
|
add_dependencies (wsjtx kvasd)
|
2013-08-14 07:31:49 -04:00
|
|
|
qt5_use_modules (wsjtx Widgets Multimedia OpenGL)
|
|
|
|
|
|
|
|
|
|
|
|
install (
|
|
|
|
TARGETS wsjtx
|
|
|
|
RUNTIME DESTINATION bin
|
|
|
|
LIBRARY DESTINATION lib
|
|
|
|
)
|
|
|
|
|
|
|
|
install (DIRECTORY Palettes DESTINATION bin PATTERN *.pal)
|
2013-08-15 20:24:32 -04:00
|
|
|
install (DIRECTORY samples DESTINATION bin/save)
|
2014-03-06 15:56:29 -05:00
|
|
|
install (FILES
|
|
|
|
shortcuts.txt
|
|
|
|
mouse_commands.txt
|
|
|
|
prefixes.txt
|
|
|
|
cty.dat
|
|
|
|
kvasd.dat
|
|
|
|
DESTINATION bin
|
|
|
|
)
|
2013-08-14 07:31:49 -04:00
|
|
|
|
|
|
|
install (
|
2013-08-14 12:57:53 -04:00
|
|
|
PROGRAMS ${CMAKE_BINARY_DIR}/contrib/kvasd${CMAKE_EXECUTABLE_SUFFIX}
|
2013-08-14 07:31:49 -04:00
|
|
|
DESTINATION bin
|
|
|
|
)
|
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
install (
|
2014-03-06 15:56:29 -05:00
|
|
|
FILES ${hamlib_RUNTIME} ${hamlib_BACKENDS} ${fftw3f_LIBRARIES} ${usb_RUNTIME} contrib/HRDInterface001.dll
|
2013-08-14 07:31:49 -04:00
|
|
|
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}")
|