diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d9001a..6df1f64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,16 +1,22 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(SGP4) -file(GLOB SRCS libsgp4/*.cpp) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +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") include_directories(libsgp4) -add_library(sgp4 STATIC ${SRCS}) -add_executable(sattrack sattrack/sattrack.cpp) -target_link_libraries(sattrack sgp4 rt) -add_executable(runtest runtest/runtest.cpp) -target_link_libraries(runtest sgp4 rt) -add_executable(passpredict passpredict/passpredict.cpp) -target_link_libraries(passpredict sgp4 rt) +add_subdirectory(libsgp4) +add_subdirectory(sattrack) +add_subdirectory(runtest) +add_subdirectory(passpredict) file(COPY SGP4-VER.TLE DESTINATION ${PROJECT_BINARY_DIR}) diff --git a/libsgp4/CMakeLists.txt b/libsgp4/CMakeLists.txt new file mode 100644 index 0000000..a58a7c3 --- /dev/null +++ b/libsgp4/CMakeLists.txt @@ -0,0 +1,19 @@ +set(SRCS + CoordGeodetic.cpp + CoordTopocentric.cpp + DateTime.cpp + DecayedException.cpp + Eci.cpp + Globals.cpp + Observer.cpp + OrbitalElements.cpp + SGP4.cpp + SatelliteException.cpp + SolarPosition.cpp + TimeSpan.cpp + Tle.cpp + TleException.cpp + Util.cpp + Vector.cpp) + +add_library(sgp4 STATIC ${SRCS}) diff --git a/libsgp4/Tle.cpp b/libsgp4/Tle.cpp index b7f6cd3..07f62b6 100644 --- a/libsgp4/Tle.cpp +++ b/libsgp4/Tle.cpp @@ -177,7 +177,7 @@ void Tle::ExtractInteger(const std::string& str, unsigned int& val) if (isdigit(*i)) { found_digit = true; - temp = (temp * 10) + (static_cast(*i) - '0'); + temp = (temp * 10) + static_cast(*i - '0'); } else if (found_digit) { diff --git a/passpredict/CMakeLists.txt b/passpredict/CMakeLists.txt new file mode 100644 index 0000000..c0f0b85 --- /dev/null +++ b/passpredict/CMakeLists.txt @@ -0,0 +1,8 @@ +set(SRCS + passpredict.cpp) + +add_executable(passpredict + ${SRCS}) +target_link_libraries(passpredict + sgp4 + rt) diff --git a/runtest/CMakeLists.txt b/runtest/CMakeLists.txt new file mode 100644 index 0000000..c446be3 --- /dev/null +++ b/runtest/CMakeLists.txt @@ -0,0 +1,8 @@ +set(SRCS + runtest.cpp) + +add_executable(runtest + ${SRCS}) +target_link_libraries(runtest + sgp4 + rt) diff --git a/sattrack/CMakeLists.txt b/sattrack/CMakeLists.txt new file mode 100644 index 0000000..c61139f --- /dev/null +++ b/sattrack/CMakeLists.txt @@ -0,0 +1,8 @@ +set(SRCS + sattrack.cpp) + +add_executable(sattrack + ${SRCS}) +target_link_libraries(sattrack + sgp4 + rt) diff --git a/sattrack/sattrack.cpp b/sattrack/sattrack.cpp index 77e5f89..9404dfb 100644 --- a/sattrack/sattrack.cpp +++ b/sattrack/sattrack.cpp @@ -32,7 +32,7 @@ int main() std::cout << tle << std::endl; - while (true) + for (int i = 0; i < 10; ++i) { /* * current time