Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplified Windows build fix + some modernization of CMakeBuild files #16

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(SGP4)

include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else()
message(SEND_ERROR "The compiler ${CMAKE_CXX_COMPILER} doesnt support C++11.")
endif()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-long-long")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wcast-align")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsign-conversion")
if(CMAKE_COMPILER_IS_GNUCC)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again is this compatible with clang?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I forgot about this. I will try to motivate the change request in the following days. (Just to mention: I actually use my branch of your code in a ground segment tool for satellites that will launch during 2020.)

add_compile_options(-Wall)
add_compile_options(-Wextra)
add_compile_options(-Wshadow)
add_compile_options(-Wnon-virtual-dtor)
add_compile_options(-pedantic)
add_compile_options(-Wno-long-long)
add_compile_options(-Wcast-align)
add_compile_options(-Wsign-conversion)
endif()

include_directories(libsgp4)
Expand All @@ -29,4 +25,4 @@ add_subdirectory(sattrack)
add_subdirectory(runtest)
add_subdirectory(passpredict)

file(COPY SGP4-VER.TLE DESTINATION ${PROJECT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/SGP4-VER.TLE DESTINATION ${PROJECT_BINARY_DIR})
44 changes: 22 additions & 22 deletions libsgp4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,32 @@ set(SRCS
Util.cc
Vector.cc)

set(INCS
CoordGeodetic.h
CoordTopocentric.h
DateTime.h
DecayedException.h
Eci.h
Globals.h
Observer.h
OrbitalElements.h
SatelliteException.h
SGP4.h
SolarPosition.h
TimeSpan.h
TleException.h
Tle.h
Util.h
Vector.h
)
set(INCS
CoordGeodetic.h
CoordTopocentric.h
DateTime.h
DecayedException.h
Eci.h
Globals.h
Observer.h
OrbitalElements.h
SatelliteException.h
SGP4.h
SolarPosition.h
TimeSpan.h
TleException.h
Tle.h
Util.h
Vector.h)

add_library(sgp4 STATIC ${SRCS} ${INCS})
target_include_directories(sgp4 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
add_library(sgp4s SHARED ${SRCS} ${INCS})
target_include_directories(sgp4s PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

if(WIN32)
install(TARGETS sgp4s
RUNTIME DESTINATION lib)
install( TARGETS sgp4s RUNTIME DESTINATION lib )
else()
install(TARGETS sgp4s
LIBRARY DESTINATION lib)
install( TARGETS sgp4s LIBRARY DESTINATION lib )
endif()
install( FILES ${INCS} DESTINATION include/SGP4 )