Skip to content

Commit

Permalink
Merge pull request #143 from ECLAIRWaveS/develop-pkg
Browse files Browse the repository at this point in the history
CMake: remove unused packaging script
  • Loading branch information
cburstedde authored Nov 16, 2023
2 parents 3947f7f + 5480520 commit c984104
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 113 deletions.
24 changes: 21 additions & 3 deletions .github/workflows/ci_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@ jobs:
- shared: true
cc: gcc
mpi: true
- shared: false
cc: clang-14
- cc: clang-14
mpi: false
shared: false
- cc: clang-15
mpi: false
shared: false
# Clang is ABI-incompatible with the libmpich on the CI Ubuntu images.

env:
CC: ${{ matrix.cc }}
Expand All @@ -52,7 +56,20 @@ jobs:
libmpich-dev mpich
- name: CMake configure
run: cmake --preset default -Dmpi:BOOL=${{ matrix.mpi }} --install-prefix=${{ runner.temp }} -DBUILD_SHARED_LIBS:BOOL=${{ matrix.shared }}
run: >-
cmake --preset default
-Dmpi:BOOL=${{ matrix.mpi }}
--install-prefix=${{ runner.temp }}
-DBUILD_SHARED_LIBS:BOOL=${{ matrix.shared }}
- name: CMake print debug find
if: failure()
run: >-
cmake --preset default
-Dmpi:BOOL=${{ matrix.mpi }}
--install-prefix=${{ runner.temp }}
-DBUILD_SHARED_LIBS:BOOL=${{ matrix.shared }}
--debug-find --fresh
- name: CMake build
run: cmake --build --preset default --parallel
Expand Down Expand Up @@ -90,6 +107,7 @@ jobs:
./build/Testing/Temporary/LastTest.log
linux-valgrind:
needs: linux
runs-on: ubuntu-22.04
name: CMake with Valgrind
timeout-minutes: 15
Expand Down
6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.14...3.28)
cmake_minimum_required(VERSION 3.15...3.28)

include(cmake/git.cmake)

Expand Down Expand Up @@ -80,10 +80,6 @@ endif(BUILD_TESTING)

# --- packaging

install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindSC.cmake
DESTINATION cmake)

include(cmake/pkgconf.cmake)
include(cmake/install.cmake)

Expand Down
19 changes: 19 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,24 @@
}
}
}
],
"workflowPresets": [
{
"name": "default",
"steps": [
{
"type": "configure",
"name": "default"
},
{
"type": "build",
"name": "default"
},
{
"type": "test",
"name": "default"
}
]
}
]
}
86 changes: 0 additions & 86 deletions cmake/FindSC.cmake

This file was deleted.

15 changes: 4 additions & 11 deletions cmake/compilers.cmake
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
include(CheckCCompilerFlag)

# --- compiler options

check_c_compiler_flag(-Wall _has_wall)
if(_has_wall)
add_compile_options(-Wall)
if(MSVC)
add_compile_options(/W4)
else()
check_c_compiler_flag(/Wall _has_msvc_wall)
if(_has_msvc_wall)
add_compile_options(/Wall)
endif()
add_compile_options(-Wall
$<$<COMPILE_LANG_AND_ID:C,AppleClang,Clang>:-Wno-unused-but-set-variable>)
endif()

# disable nuisance warnings from Visual Studio
Expand Down
13 changes: 9 additions & 4 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

include(GNUInstallDirs)

option(mpi "use MPI library" off)
option(openmp "use OpenMP" off)
option(zlib "build ZLIB" on)
Expand All @@ -10,7 +7,15 @@ option(BUILD_SHARED_LIBS "build shared libsc")

# --- default install directory under build/local
# users can specify like "cmake -B build -DCMAKE_INSTALL_PREFIX=~/mydir"
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

if(CMAKE_VERSION VERSION_LESS 3.21)
get_property(_not_top DIRECTORY PROPERTY PARENT_DIRECTORY)
if(NOT _not_top)
set(PROJECT_IS_TOP_LEVEL true)
endif()
endif()

if(PROJECT_IS_TOP_LEVEL AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
# will not take effect without FORCE
set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/local" CACHE PATH "Install top-level directory" FORCE)
endif()
Expand Down
2 changes: 2 additions & 0 deletions cmake/sc_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#define SC_CPPFLAGS @SC_CPPFLAGS@
#endif

#cmakedefine SC_HAVE_ZLIB 1

/* Define to 1 if we are using threads */
#cmakedefine SC_ENABLE_PTHREAD 1

Expand Down
10 changes: 7 additions & 3 deletions cmake/zlib.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
include(GNUInstallDirs)
include(ExternalProject)

# default zlib source archive
if (NOT DEFINED SC_BUILD_ZLIB_ARCHIVE_FILE)
if (NOT DEFINED SC_BUILD_ZLIB_VERSION)
set(SC_BUILD_ZLIB_VERSION 2.1.3)
set(SC_BUILD_ZLIB_VERSION 2.1.4)
endif()
set(SC_BUILD_ZLIB_ARCHIVE_FILE https://github.com/zlib-ng/zlib-ng/archive/refs/tags/${SC_BUILD_ZLIB_VERSION}.tar.gz CACHE STRING "zlib source archive (URL or local filepath).")
endif()
Expand All @@ -13,7 +12,7 @@ set(ZLIB_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include)

if(BUILD_SHARED_LIBS)
if(WIN32)
set(ZLIB_LIBRARIES ${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}zlib1${CMAKE_SHARED_LIBRARY_SUFFIX})
set(ZLIB_LIBRARIES ${CMAKE_INSTALL_PREFIX}/bin/${CMAKE_SHARED_LIBRARY_PREFIX}zlib1${CMAKE_SHARED_LIBRARY_SUFFIX})
else()
set(ZLIB_LIBRARIES ${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}z${CMAKE_SHARED_LIBRARY_SUFFIX})
endif()
Expand Down Expand Up @@ -43,6 +42,11 @@ BUILD_BYPRODUCTS ${ZLIB_LIBRARIES}
TLS_VERIFY true
CONFIGURE_HANDLED_BY_BUILD ON
INACTIVITY_TIMEOUT 60
USES_TERMINAL_DOWNLOAD true
USES_TERMINAL_UPDATE true
USES_TERMINAL_BUILD true
USES_TERMINAL_INSTALL true
USES_TERMINAL_TEST true
)


Expand Down
5 changes: 4 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ foreach(t IN LISTS sc_tests)

add_executable(sc_test_${t} test_${t}.c)
target_link_libraries(sc_test_${t} PRIVATE SC::SC)
target_compile_definitions(sc_test_${t} PRIVATE $<$<BOOL:${TEST_WITH_VALGRIND}>:SC_ENABLE_VALGRIND=1>)
target_compile_definitions(sc_test_${t} PRIVATE
$<$<BOOL:${TEST_WITH_VALGRIND}>:SC_ENABLE_VALGRIND=1>
$<$<BOOL:${SC_HAVE_ZLIB}>:SC_HAVE_ZLIB>
)

add_test(NAME ${t} COMMAND ${MPI_WRAPPER} ${VALGRIND_COMMAND} $<TARGET_FILE:sc_test_${t}>)

Expand Down

0 comments on commit c984104

Please sign in to comment.