diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..07ed706 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/* \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 169ae92..24f3b47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,30 +1,26 @@ 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) -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) +if(CMAKE_COMPILER_IS_GNUCC) + 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() add_subdirectory(libsgp4) 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}) diff --git a/libsgp4/CMakeLists.txt b/libsgp4/CMakeLists.txt index b816645..87ef0fd 100644 --- a/libsgp4/CMakeLists.txt +++ b/libsgp4/CMakeLists.txt @@ -16,26 +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}) -install( TARGETS sgp4s LIBRARY DESTINATION lib ) +target_include_directories(sgp4s PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +if(WIN32) + install( TARGETS sgp4s RUNTIME DESTINATION lib ) +else() + install( TARGETS sgp4s LIBRARY DESTINATION lib ) +endif() install( FILES ${INCS} DESTINATION include/SGP4 ) diff --git a/libsgp4/DateTime.h b/libsgp4/DateTime.h index 0ddc35e..cb19ea6 100644 --- a/libsgp4/DateTime.h +++ b/libsgp4/DateTime.h @@ -18,6 +18,7 @@ #ifndef DATETIME_H_ #define DATETIME_H_ +#include #include #include #include diff --git a/passpredict/CMakeLists.txt b/passpredict/CMakeLists.txt index 5d6cf00..9975e9d 100644 --- a/passpredict/CMakeLists.txt +++ b/passpredict/CMakeLists.txt @@ -4,5 +4,4 @@ set(SRCS add_executable(passpredict ${SRCS}) target_link_libraries(passpredict - sgp4 - rt) + sgp4) diff --git a/runtest/CMakeLists.txt b/runtest/CMakeLists.txt index 7a1cf26..621d56c 100644 --- a/runtest/CMakeLists.txt +++ b/runtest/CMakeLists.txt @@ -4,5 +4,4 @@ set(SRCS add_executable(runtest ${SRCS}) target_link_libraries(runtest - sgp4 - rt) + sgp4) diff --git a/sattrack/CMakeLists.txt b/sattrack/CMakeLists.txt index 0664458..a8c5027 100644 --- a/sattrack/CMakeLists.txt +++ b/sattrack/CMakeLists.txt @@ -4,5 +4,4 @@ set(SRCS add_executable(sattrack ${SRCS}) target_link_libraries(sattrack - sgp4 - rt) + sgp4)