Skip to content

Commit

Permalink
Remove superfluous cmake project statements, simplify cmake version h…
Browse files Browse the repository at this point in the history
…andling, add version change scripts
  • Loading branch information
hcstadler committed Jul 8, 2024
1 parent 2a7c187 commit 4ae8f6d
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 19 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ add_subdirectory(indexer)
add_subdirectory(data)
add_subdirectory(tests)
add_subdirectory(python)
add_subdirectory(examples/crystfel-integration)

MESSAGE("ENV ${fast_feedback_indexer_ENV_SETUP}")
configure_file(setup-env.sh.in
Expand Down
2 changes: 0 additions & 2 deletions data/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
project(data_top)

add_subdirectory(simple)
2 changes: 0 additions & 2 deletions data/simple/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
project(simple_data_top)

add_subdirectory(reader)

option(INSTALL_SIMPLE_DATA_FILES "Install simple data files" OFF)
Expand Down
2 changes: 0 additions & 2 deletions data/simple/reader/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
project(simple_data_reader_top "CXX")

add_subdirectory(src)
2 changes: 1 addition & 1 deletion data/simple/reader/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if(BUILD_SIMPLE_DATA_READER)
set(simple_data_PUB_HEADER_LIST ffbidx/simple_data.h)
add_library(simple_data INTERFACE)
set_target_properties(simple_data PROPERTIES
VERSION 1.0.0)
VERSION ${PROJECT_VERSION})
target_compile_features(simple_data INTERFACE cxx_std_17)
target_sources(simple_data INTERFACE ${simple_data_PUB_HEADER_LIST})
target_include_directories(simple_data INTERFACE .)
Expand Down
16 changes: 16 additions & 0 deletions data/simple/reader/src/set-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
function usage() {
echo "usage: $0 [version]"
echo
echo "Replace version strings with new version"
exit -1
}

if (($# == 0)); then
grep VERSION meson.build
elif (($# == 1)); then
echo "replace version strings by $1"
sed -i 's/VERSION\(.*\)\w\.\w\.\w/VERSION\1'"$1"'/' CMakeLists.txt
sed -i 's/VERSION\(.*\)\w\.\w\.\w/VERSION\1'"$1"'/' meson.build
else
usage
fi
2 changes: 0 additions & 2 deletions indexer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
project(indexer_top)

add_subdirectory(src)
8 changes: 4 additions & 4 deletions indexer/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_policy(SET CMP0048 NEW)

project(fast_indexer
DESCRIPTION "Library for fast feedback indexing using brute force sampling"
VERSION 0.1.0
VERSION 1.0.0
LANGUAGES CXX CUDA)

option(BUILD_FAST_INDEXER "Build fast indexer library" ON)
Expand Down Expand Up @@ -74,8 +74,8 @@ if(BUILD_FAST_INDEXER)
add_dependencies(fast_indexer version_txt)
set_target_properties(fast_indexer PROPERTIES
CUDA_RUNTIME_LIBRARY Shared
SOVERSION 0
VERSION 0.1.0
SOVERSION ${PROJECT_VERSION_MAJOR}
VERSION ${PROJECT_VERSION}
POSITION_INDEPENDENT_CODE ON)
target_compile_features(fast_indexer PUBLIC cxx_std_17)
target_include_directories(fast_indexer PUBLIC .)
Expand Down Expand Up @@ -111,7 +111,7 @@ if(BUILD_FAST_INDEXER_STATIC)
add_dependencies(fast_indexer_static version_txt)
set_target_properties(fast_indexer_static PROPERTIES
CUDA_RUNTIME_LIBRARY Static
VERSION 0.1.0)
VERSION ${PROJECT_VERSION})
target_compile_features(fast_indexer_static PUBLIC cxx_std_17)
target_include_directories(fast_indexer_static PUBLIC .)
target_link_libraries(fast_indexer_static
Expand Down
2 changes: 1 addition & 1 deletion indexer/src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if get_option('build-ffbidx').enabled()
endif

conf_data = configuration_data()
conf_data.set('PROJECT_VERSION', '0.1.0')
conf_data.set('PROJECT_VERSION', '1.0.0')
conf_data.set('CMAKE_INSTALL_PREFIX', get_option('prefix'))
conf_data.set('CMAKE_INSTALL_INCLUDEDIR', get_option('includedir'))
conf_data.set('CMAKE_INSTALL_LIBDIR', get_option('libdir'))
Expand Down
16 changes: 16 additions & 0 deletions indexer/src/set-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
function usage() {
echo "usage: $0 [version]"
echo
echo "Replace version strings with new version"
exit -1
}

if (($# == 0)); then
grep VERSION meson.build
elif (($# == 1)); then
echo "replace version strings by $1"
sed -i 's/VERSION\(.*\)\w\.\w\.\w/VERSION\1'"$1"'/' CMakeLists.txt
sed -i 's/VERSION\(.*\)\w\.\w\.\w/VERSION\1'"$1"'/' meson.build
else
usage
fi
2 changes: 0 additions & 2 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
project(python_top)

add_subdirectory(src)
1 change: 1 addition & 0 deletions python/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
project(python_impl
DESCRIPTION "Python module"
VERSION 1.0.0
LANGUAGES CXX)

option(PYTHON_MODULE "Enable python module" OFF)
Expand Down
2 changes: 0 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
project(tests_top)

add_subdirectory(src)
1 change: 1 addition & 0 deletions tests/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
project(tests_impl
DESCRIPTION "Tests"
VERSION 1.0.0
LANGUAGES CXX CUDA)

# ---- Indexer Tests ----
Expand Down

0 comments on commit 4ae8f6d

Please sign in to comment.