diff options
| author | Aiden Woodruff <woodra@rpi.edu> | 2025-10-22 10:38:19 -0400 |
|---|---|---|
| committer | Aiden Woodruff <woodra@rpi.edu> | 2025-10-22 10:38:19 -0400 |
| commit | ff675a7e2b25ed61e95e56c35d70874dc3e63a61 (patch) | |
| tree | 6de570a2fa15952797ebe11709833ed2515988d9 | |
| parent | d4ef0cc41314dfa2bc6fe68970aebadb8681101e (diff) | |
| download | tipping-points-ff675a7e2b25ed61e95e56c35d70874dc3e63a61.tar.gz tipping-points-ff675a7e2b25ed61e95e56c35d70874dc3e63a61.tar.bz2 tipping-points-ff675a7e2b25ed61e95e56c35d70874dc3e63a61.zip | |
add SNAP library
- cmake/GetSNAP.cmake: add module that uses ExternalProject to download and
build (with make) the SNAP library.
- CMakeLists.txt: simple cmake file to use the GetSNAP module.
- src/main.cc: simples possible main file.
- src/CMakeLists.txt: simple cmake file with main executable and linking.
Signed-off-by: Aiden Woodruff <woodra@rpi.edu>
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | CMakeLists.txt | 13 | ||||
| -rw-r--r-- | cmake/GetSNAP.cmake | 21 | ||||
| -rw-r--r-- | src/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/main.cc | 6 |
5 files changed, 45 insertions, 0 deletions
| @@ -1,2 +1,5 @@ | |||
| 1 | # LaTeX auxiliary files | 1 | # LaTeX auxiliary files |
| 2 | .aux/ | 2 | .aux/ |
| 3 | |||
| 4 | # CMake build folder | ||
| 5 | build/ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..da1f520 --- /dev/null +++ b/CMakeLists.txt | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | cmake_minimum_required(VERSION 3.12) | ||
| 2 | project(tipping-points LANGUAGES CXX) | ||
| 3 | |||
| 4 | cmake_policy(SET CMP0135 NEW) | ||
| 5 | |||
| 6 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") | ||
| 7 | |||
| 8 | include(GetSNAP) | ||
| 9 | |||
| 10 | add_subdirectory(src) | ||
| 11 | if(BUILD_TESTING) | ||
| 12 | add_subdirectory(test) | ||
| 13 | endif() | ||
diff --git a/cmake/GetSNAP.cmake b/cmake/GetSNAP.cmake new file mode 100644 index 0000000..87b8c65 --- /dev/null +++ b/cmake/GetSNAP.cmake | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | include(ExternalProject) | ||
| 2 | ExternalProject_Add( | ||
| 3 | SNAP | ||
| 4 | DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR} | ||
| 5 | DOWNLOAD_NO_PROGRESS TRUE | ||
| 6 | URL https://snap.stanford.edu/releases/Snap-6.0.zip | ||
| 7 | URL_MD5 e32a1dbea584ba4f287c616627a71ac5 | ||
| 8 | CONFIGURE_COMMAND "" | ||
| 9 | BUILD_IN_SOURCE TRUE | ||
| 10 | BUILD_COMMAND make | ||
| 11 | COMMAND make -C snap-core lib | ||
| 12 | INSTALL_COMMAND "" | ||
| 13 | LOG_BUILD TRUE | ||
| 14 | ) | ||
| 15 | ExternalProject_Get_Property(SNAP SOURCE_DIR) | ||
| 16 | set(SNAP_SOURCE_DIR "${SOURCE_DIR}") | ||
| 17 | add_library(SNAP::SNAP STATIC IMPORTED) | ||
| 18 | set_property(TARGET SNAP::SNAP | ||
| 19 | PROPERTY IMPORTED_LOCATION | ||
| 20 | ${SNAP_SOURCE_DIR}/snap-core/libsnap.a | ||
| 21 | ) | ||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..c66a468 --- /dev/null +++ b/src/CMakeLists.txt | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | add_executable(main main.cc) | ||
| 2 | target_link_libraries(main PRIVATE SNAP::SNAP) | ||
diff --git a/src/main.cc b/src/main.cc new file mode 100644 index 0000000..6e80c53 --- /dev/null +++ b/src/main.cc | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | #include <iostream> | ||
| 2 | |||
| 3 | int main(int argc, char* argv[]) { | ||
| 4 | std::cout << "Hello world." << std::endl; | ||
| 5 | return 0; | ||
| 6 | } | ||
