Skip to content

Commit

Permalink
Some cmake files cleanup and first try to get git version
Browse files Browse the repository at this point in the history
  • Loading branch information
sflis committed Feb 20, 2020
1 parent 239c1ea commit 68ada32
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 70 deletions.
13 changes: 12 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
cmake_minimum_required(VERSION 3.11...3.16)


#Get git version number
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --abbrev=7
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
OUTPUT_VARIABLE SSTCAM_COMMON_VERSION
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
configure_file(sstcam_common_version.h.in ${CMAKE_BINARY_DIR}/generated/sstcam_common_version.h )
include_directories("${CMAKE_BINARY_DIR}/generated/")

message(STATUS "SSTCam-common version: ${SSTCAM_COMMON_VERSION}")

project(sstcam-common)
message(STATUS "Configuring sstcam-constants")
add_subdirectory(constants)
Expand All @@ -15,7 +27,6 @@ add_subdirectory(calibration)
# -----------------------------------------------------------------------------
include ( CMakePackageConfigHelpers )


## Make importable from build directory
#write_basic_package_version_file(
# "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
Expand Down
20 changes: 1 addition & 19 deletions calibration/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,10 @@
cmake_minimum_required(VERSION 3.11...3.16)

project(sstcam_calibration VERSION 1.0 LANGUAGES CXX)
project(sstcam_calibration VERSION ${SSTCAM_COMMON_VERSION} LANGUAGES CXX)
set(LIBTARGET ${PROJECT_NAME}_c)
set(PYTARGET ${PROJECT_NAME})
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

# Save executables to bin directory
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

# Dependencies
# find_package(pybind11 REQUIRED)
find_package(Doxygen)

# if(Doxygen_FOUND)
# add_subdirectory(docs)
# else()
# message(STATUS "Doxygen not found, not building docs")
# endif()

include(CTest)

# src
set(HEADER_LIST include/sstcam/calibration/Calibrator.h)
add_library(${LIBTARGET} SHARED src/Calibrator.cc ${HEADER_LIST})
Expand Down
19 changes: 1 addition & 18 deletions constants/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,10 @@
cmake_minimum_required(VERSION 3.11...3.16)

project(sstcam_constants VERSION 1.0 LANGUAGES CXX)
project(sstcam_constants VERSION ${SSTCAM_COMMON_VERSION} LANGUAGES CXX)
set(LIBTARGET ${PROJECT_NAME}_c)
set(PYTARGET ${PROJECT_NAME})
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

# Save executables to bin directory
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

# Dependencies
# find_package(pybind11 REQUIRED)
find_package(Doxygen)

# if(Doxygen_FOUND)
# add_subdirectory(docs)
# else()
# message(STATUS "Doxygen not found, not building docs")
# endif()

include(CTest)

# src
set(HEADER_LIST include/sstcam/constants/Geometry.h)
Expand Down
19 changes: 1 addition & 18 deletions descriptions/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,10 @@
cmake_minimum_required(VERSION 3.11...3.16)

project(sstcam_descriptions VERSION 1.0 LANGUAGES CXX)
project(sstcam_descriptions VERSION ${SSTCAM_COMMON_VERSION} LANGUAGES CXX)
set(LIBTARGET ${PROJECT_NAME}_c)
set(PYTARGET ${PROJECT_NAME})
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

# Save executables to bin directory
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

# Dependencies
find_package(Doxygen)

# if(Doxygen_FOUND)
# add_subdirectory(docs)
# else()
# message(STATUS "Doxygen not found, not building docs")
# endif()

include(CTest)

# src
set(HEADER_LIST include/sstcam/descriptions/WaveformDataPacket.h include/sstcam/descriptions/Waveform.h include/sstcam/descriptions/WaveformEvent.h)
add_library(${LIBTARGET} SHARED src/WaveformDataPacket.cc src/Waveform.cc src/WaveformEvent.cc ${HEADER_LIST})
Expand Down
15 changes: 2 additions & 13 deletions io/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
cmake_minimum_required(VERSION 3.11...3.16)

project(sstcam_io VERSION 1.0 LANGUAGES CXX)
project(sstcam_io VERSION ${SSTCAM_COMMON_VERSION} LANGUAGES CXX)
set(LIBTARGET ${PROJECT_NAME}_c)
set(PYTARGET ${PROJECT_NAME})
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
include_directories("${CMAKE_BINARY_DIR}/generated/")

# Save executables to bin directory
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

#if(CMAKE_INSTALL_PREFIX)
# set(CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX})
#endif(CMAKE_INSTALL_PREFIX)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
find_package(CFITSIO REQUIRED)
#list(APPEND EXTLIBS ${CFITSIO_LIBRARIES})

include(CTest)

# src
set(HEADER_LIST include/sstcam/io/TIOReader.h include/sstcam/io/FitsUtils.h)
Expand Down
3 changes: 2 additions & 1 deletion io/pybind/module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// This software is distributed under the terms of the BSD-3-Clause license.

#include <pybind11/pybind11.h>

#include "sstcam_common_version.h"
namespace sstcam {
namespace io {

Expand All @@ -11,6 +11,7 @@ namespace py = pybind11;
void tio_reader(py::module &m);

PYBIND11_MODULE(sstcam_io, m) {
m.def("_get_version",&getSSTCamCommonGitVersion);
tio_reader(m);
}

Expand Down

0 comments on commit 68ada32

Please sign in to comment.