Skip to content

Commit

Permalink
code cleanup: move c++ code to src directory
Browse files Browse the repository at this point in the history
  • Loading branch information
agalasso committed Jul 5, 2024
1 parent ca87ea4 commit 2e1a5eb
Show file tree
Hide file tree
Showing 292 changed files with 35 additions and 33 deletions.
46 changes: 24 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,21 @@ endif()

# root directory of the project
set(PHD_PROJECT_ROOT_DIR ${CMAKE_SOURCE_DIR})
set(phd_src_dir ${PHD_PROJECT_ROOT_DIR})
set(phd_src_dir ${PHD_PROJECT_ROOT_DIR}/src)

# Additional files in the workspace, To improve maintainability
add_custom_target(CmakeAdditionalFiles
SOURCES
${phd_src_dir}/thirdparty/thirdparty.cmake
${phd_src_dir}/cmake_modules/FindASCOM_INTERFACE.cmake
${phd_src_dir}/cmake_modules/FindCFITSIO.cmake
${phd_src_dir}/cmake_modules/FindINDI.cmake
${phd_src_dir}/cmake_modules/FindNova.cmake
${phd_src_dir}/cmake_modules/PHD2BuildDoc.cmake
${phd_src_dir}/cmake_modules/PHD2GenerateDocScript.cmake
${phd_src_dir}/cmake_modules/PHD2Removegettextwarning.cmake
${phd_src_dir}/cmake_modules/compiler_options.cmake
${phd_src_dir}/cmake_modules/PHD2Packaging.cmake)
${PHD_PROJECT_ROOT_DIR}/thirdparty/thirdparty.cmake
${PHD_PROJECT_ROOT_DIR}/cmake_modules/FindASCOM_INTERFACE.cmake
${PHD_PROJECT_ROOT_DIR}/cmake_modules/FindCFITSIO.cmake
${PHD_PROJECT_ROOT_DIR}/cmake_modules/FindINDI.cmake
${PHD_PROJECT_ROOT_DIR}/cmake_modules/FindNova.cmake
${PHD_PROJECT_ROOT_DIR}/cmake_modules/PHD2BuildDoc.cmake
${PHD_PROJECT_ROOT_DIR}/cmake_modules/PHD2GenerateDocScript.cmake
${PHD_PROJECT_ROOT_DIR}/cmake_modules/PHD2Removegettextwarning.cmake
${PHD_PROJECT_ROOT_DIR}/cmake_modules/compiler_options.cmake
${PHD_PROJECT_ROOT_DIR}/cmake_modules/PHD2Packaging.cmake)

# compiler options
include(cmake_modules/compiler_options.cmake)
Expand Down Expand Up @@ -146,10 +146,12 @@ add_subdirectory(contributions/MPI_IS_gaussian_process tmp_gaussian_process)
#################################################################################
#
# Global include directories
# WxWidgets inclusion narrowed to PHD2 project only
# include_directories(${wxWidgets_INCLUDE_DIRS})
include_directories(${phd_src_dir}/cameras/)
include_directories(${phd_src_dir})
include_directories(${PHD_PROJECT_ROOT_DIR}/cameras)
# PROJECT_ROOT_DIR is added as in include directory file code that
# uses: #include "cameras/some_camera.h"
# TODO: would be better to separate cameras/ into per-camera directories
include_directories(${PHD_PROJECT_ROOT_DIR})



Expand Down Expand Up @@ -245,8 +247,8 @@ if(WIN32)
${phd_src_dir}/cam_atik16.cpp
${phd_src_dir}/cam_atik16.h

${phd_src_dir}/cameras/ArtemisHSCAPI.h
${phd_src_dir}/cameras/ArtemisHSCAPI.cpp
${PHD_PROJECT_ROOT_DIR}/cameras/ArtemisHSCAPI.h
${PHD_PROJECT_ROOT_DIR}/cameras/ArtemisHSCAPI.cpp
)
elseif(UNIX AND (NOT APPLE))
set(cam_SRC
Expand Down Expand Up @@ -572,17 +574,17 @@ if(APPLE)
${phd2_SRC}

# resources of the bundle
${phd_src_dir}/${MACOSX_BUNDLE_ICON_FILE}
${PHD_PROJECT_ROOT_DIR}/icons/${MACOSX_BUNDLE_ICON_FILE}

# extra frameworks
${phd2_OSX_FRAMEWORKS}

${phd_src_dir}/run_phd2_macos
${PHD_PROJECT_ROOT_DIR}/run_phd2_macos
)
set_target_properties(
phd2
PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${phd_src_dir}/MacOSXBundleInfo.plist.in
MACOSX_BUNDLE_INFO_PLIST ${PHD_PROJECT_ROOT_DIR}/MacOSXBundleInfo.plist.in
OUTPUT_NAME PHD2 # upper case on OSX
)
target_include_directories(
Expand All @@ -591,13 +593,13 @@ if(APPLE)
)

set_source_files_properties(
${phd_src_dir}/${MACOSX_BUNDLE_ICON_FILE}
${PHD_PROJECT_ROOT_DIR}/icons/${MACOSX_BUNDLE_ICON_FILE}
PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)

set_source_files_properties(
${phd_src_dir}/run_phd2_macos
${PHD_PROJECT_ROOT_DIR}/run_phd2_macos
PROPERTIES
MACOSX_PACKAGE_LOCATION MacOS
)
Expand Down Expand Up @@ -739,7 +741,7 @@ elseif(WIN32)
ADD_MSVC_PRECOMPILED_HEADER("phd.h" "precompiled_header.cpp" phd2_WIN_SRC)

# resource file, some VC do not like the options provided by the precompiled headers
set(phd2_WIN_SRC ${phd2_WIN_SRC} ${phd_src_dir}/phd.rc)
set(phd2_WIN_SRC ${phd2_WIN_SRC} ${PHD_PROJECT_ROOT_DIR}/phd.rc)
source_group(src FILES precompiled_header.cpp)

link_directories("C:/Program Files (x86)/Visual Leak Detector/lib/win32")
Expand Down
2 changes: 1 addition & 1 deletion build/build-mac
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fi

V=$(perl -ne '
/^\s*#\s*define\s+PHDVERSION[^"]+"([^"]*)/ && do { $v = $1; next LINE };
/^\s*#\s*define\s+PHDSUBVER[^"]+"([^"]*)/ && do { $s = $1; print "$v$s"; exit }' phd.h)
/^\s*#\s*define\s+PHDSUBVER[^"]+"([^"]*)/ && do { $s = $1; print "$v$s"; exit }' src/phd.h)

[[ $V ]] || {
echo "could not get version from phd.h!" >&2
Expand Down
2 changes: 1 addition & 1 deletion build/build-win
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ CMAKE_W=$(cygpath -w "$CMAKE")

V=$(perl -ne '
/^\s*#\s*define\s+PHDVERSION[^"]+"([^"]*)/ && do { $v = $1; next LINE };
/^\s*#\s*define\s+PHDSUBVER[^"]+"([^"]*)/ && do { $s = $1; print "$v$s"; exit }' phd.h)
/^\s*#\s*define\s+PHDSUBVER[^"]+"([^"]*)/ && do { $s = $1; print "$v$s"; exit }' src/phd.h)

INSTALLER=phd2-${V}-installer

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion cmake_modules/PHD2BuildDoc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ set(_default_locale "en_EN")
# `VERSION_MAJOR`, `VERSION_MINOR` and `VERSION_PATCH`.
# Raises an error if the version cannot be extracted
function(get_phd_version)
set(filename_to_extract_from ${PHD_PROJECT_ROOT_DIR}/phd.h)
set(filename_to_extract_from ${PHD_PROJECT_ROOT_DIR}/src/phd.h)
file(STRINGS ${filename_to_extract_from} file_content
#REGEX "PHDVERSION[ _T\\(]+\"(.*)\""
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions thirdparty/thirdparty.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1126,8 +1126,8 @@ if(WIN32)
elseif(UNIX OR APPLE)
add_definitions(-DHAVE_SXV_CAMERA=1)
set(SXV_PLATFORM_SRC
${phd_src_dir}/cameras/SXMacLib.h
${phd_src_dir}/cameras/SXMacLib.c)
${PHD_PROJECT_ROOT_DIR}/cameras/SXMacLib.h
${PHD_PROJECT_ROOT_DIR}/cameras/SXMacLib.c)
endif()


Expand All @@ -1137,13 +1137,13 @@ endif()

if(APPLE)
add_definitions(-DHAVE_KWIQGUIDER_CAMERA=1)
include_directories(${phd_src_dir}/cam_KWIQGuider/)
include_directories(${PHD_PROJECT_ROOT_DIR}/cameras/KWIQGuider/)
set(KWIQGuider_PLATFORM_SRC
${phd_src_dir}/cam_KWIQGuider/KWIQGuider.cpp
${phd_src_dir}/cam_KWIQGuider/KWIQGuider.h
${phd_src_dir}/cam_KWIQGuider/KWIQGuider_firmware.h
${phd_src_dir}/cam_KWIQGuider/KWIQGuider_loader.cpp
${phd_src_dir}/cam_KWIQGuider/KWIQGuider_priv.h
${PHD_PROJECT_ROOT_DIR}/cameras/KWIQGuider/KWIQGuider.cpp
${PHD_PROJECT_ROOT_DIR}/cameras/KWIQGuider/KWIQGuider.h
${PHD_PROJECT_ROOT_DIR}/cameras/KWIQGuider/KWIQGuider_firmware.h
${PHD_PROJECT_ROOT_DIR}/cameras/KWIQGuider/KWIQGuider_loader.cpp
${PHD_PROJECT_ROOT_DIR}/cameras/KWIQGuider/KWIQGuider_priv.h
)
endif()

Expand Down

0 comments on commit 2e1a5eb

Please sign in to comment.