From 4367ac1360899f26045b56e1031ad90b1965c8ae Mon Sep 17 00:00:00 2001 From: Vlad Gheorghiu Date: Thu, 30 Nov 2023 11:34:38 -0500 Subject: [PATCH] update --- CMakeLists.txt | 4 +--- cmake/FindGMP.cmake | 2 ++ cmake/{staq_grid_synth.cmake => grid_synth.cmake} | 0 cmake/staqConfig.cmake.in | 4 +--- cmake/staq_msvc.cmake | 10 ---------- cmake/staq_msvc_pthread.cmake | 4 ++++ examples/standalone/CMakeLists.txt | 1 + src/tools/CMakeLists.txt | 2 +- unit_tests/CMakeLists.txt | 2 +- 9 files changed, 11 insertions(+), 18 deletions(-) rename cmake/{staq_grid_synth.cmake => grid_synth.cmake} (100%) delete mode 100644 cmake/staq_msvc.cmake create mode 100644 cmake/staq_msvc_pthread.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index c4a9b86b..ca2b1bef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,10 +109,8 @@ if (STAQ_INSTALL_SOURCES) "cmake/staqConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/staqConfig.cmake" INSTALL_DESTINATION "lib/cmake/${PROJECT_NAME}" ) - install(FILES "${CMAKE_SOURCE_DIR}/cmake/FindGMP.cmake" DESTINATION "lib/cmake/${PROJECT_NAME}") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/staqConfig.cmake" DESTINATION "lib/cmake/${PROJECT_NAME}") - install(FILES "${CMAKE_SOURCE_DIR}/cmake/staq_grid_synth.cmake" DESTINATION "lib/cmake/${PROJECT_NAME}") - install(FILES "${CMAKE_SOURCE_DIR}/cmake/staq_msvc.cmake" DESTINATION "lib/cmake/${PROJECT_NAME}") + install(FILES "${CMAKE_SOURCE_DIR}/cmake/staq_msvc_pthread.cmake" DESTINATION "lib/cmake/${PROJECT_NAME}") endif () #### Uninstall diff --git a/cmake/FindGMP.cmake b/cmake/FindGMP.cmake index 8f0d7254..975523ac 100644 --- a/cmake/FindGMP.cmake +++ b/cmake/FindGMP.cmake @@ -1,5 +1,7 @@ set(GMP_PREFIX "" CACHE PATH "path ") +list(APPEND CMAKE_MODULE_PATH "/usr/local/lib/cmake/staq") + find_path(GMP_INCLUDE_DIR gmp.h gmpxx.h PATHS ${GMP_PREFIX}/include /usr/include /usr/local/include /opt/homebrew/include) diff --git a/cmake/staq_grid_synth.cmake b/cmake/grid_synth.cmake similarity index 100% rename from cmake/staq_grid_synth.cmake rename to cmake/grid_synth.cmake diff --git a/cmake/staqConfig.cmake.in b/cmake/staqConfig.cmake.in index 47f01116..fe8ea4af 100644 --- a/cmake/staqConfig.cmake.in +++ b/cmake/staqConfig.cmake.in @@ -1,8 +1,6 @@ @PACKAGE_INIT@ set(STAQ_INSTALL_DIR "@STAQ_INSTALL_DIR@") -include("${CMAKE_CURRENT_LIST_DIR}/FindGMP.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/staq_grid_synth.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/staq_msvc.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/staq_msvc_pthread.cmake") include("${CMAKE_CURRENT_LIST_DIR}/staq_targets.cmake") message(STATUS "Found staq's source code in @STAQ_INSTALL_DIR@") diff --git a/cmake/staq_msvc.cmake b/cmake/staq_msvc.cmake deleted file mode 100644 index 5ae2b835..00000000 --- a/cmake/staq_msvc.cmake +++ /dev/null @@ -1,10 +0,0 @@ -#### Windows issues with Microsoft Visual Studio -if (MSVC) - include_directories(SYSTEM - ${STAQ_INSTALL_DIR}/third_party/pthreadwin32) - add_compile_options(-bigobj) - add_compile_definitions(NOMINMAX) - if (MSVC_VERSION GREATER_EQUAL 1914) - add_compile_options("/Zc:__cplusplus") - endif () -endif () diff --git a/cmake/staq_msvc_pthread.cmake b/cmake/staq_msvc_pthread.cmake new file mode 100644 index 00000000..065b075d --- /dev/null +++ b/cmake/staq_msvc_pthread.cmake @@ -0,0 +1,4 @@ +#### Microsoft Visual Studio lack of pthread.h +if (MSVC) + include_directories(SYSTEM ${STAQ_INSTALL_DIR}/third_party/pthreadwin32) +endif () diff --git a/examples/standalone/CMakeLists.txt b/examples/standalone/CMakeLists.txt index 11917930..09283adb 100644 --- a/examples/standalone/CMakeLists.txt +++ b/examples/standalone/CMakeLists.txt @@ -11,6 +11,7 @@ set(CMAKE_CXX_STANDARD 17) # set(CMAKE_PREFIX_PATH "/path/to/installed/staq") find_package(staq REQUIRED) +#find_package(GMP REQUIRED) add_executable(standalone src/main.cpp) target_link_libraries(standalone PUBLIC libstaq) diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index 7aa39123..69538643 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -3,7 +3,7 @@ file(GLOB FILENAMES *.cpp) add_custom_target(tools COMMENT "Build all binary tools.") message(WARNING "tools") -include(${CMAKE_SOURCE_DIR}/cmake/staq_grid_synth.cmake) +include(${CMAKE_SOURCE_DIR}/cmake/grid_synth.cmake) foreach (filename ${FILENAMES}) get_filename_component(basename ${filename} NAME_WE) diff --git a/unit_tests/CMakeLists.txt b/unit_tests/CMakeLists.txt index 76f1beda..74ab7833 100644 --- a/unit_tests/CMakeLists.txt +++ b/unit_tests/CMakeLists.txt @@ -21,7 +21,7 @@ aux_source_directory(tests/mapping TEST_FILES) aux_source_directory(tests/synthesis TEST_FILES) message(WARNING "unit_tests") -include(${CMAKE_SOURCE_DIR}/cmake/staq_grid_synth.cmake) +include(${CMAKE_SOURCE_DIR}/cmake/grid_synth.cmake) if (${BUILD_GRID_SYNTH}) aux_source_directory(tests/grid_synth TEST_FILES) endif ()