Skip to content

Commit

Permalink
Use cmake for all target builds (#971)
Browse files Browse the repository at this point in the history
* removes all use of autoconf/automake
  • Loading branch information
molpopgen committed Oct 5, 2022
1 parent fcd3520 commit 9c82dd7
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 131 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/tests.yml
Expand Up @@ -94,8 +94,9 @@ jobs:
run: |
source ~/.bashrc
conda activate anaconda-client-env
cd cpptests && autoreconf --install && ./configure && cd ..
make check -C cpptests
cmake -S. -Bbuild_cpp_tests -DBUILD_CPP_UNIT_TESTS=ON
cmake --build build_cpp_tests -t fwdpy11_cpp_tests -j 4
cmake --build build_cpp_tests -t test
- name: Run Python tests
# shell: bash -l {0}
Expand Down
21 changes: 8 additions & 13 deletions .github/workflows/ubuntu.yml
Expand Up @@ -105,26 +105,21 @@ jobs:
CXX=$CXX CC=$CC python -m pip install -e .
- name: Build C++ tests
working-directory: cpptests
run: |
autoreconf --install
CPPFLAGS=$CPPFLAGS CC=$CC CXX=$CXX ./configure
make -j 3
cmake -E env CPPFLAGS="$CPPFLAGS" \
cmake -E env CC="$CC" \
cmake -E env CXX="$CXX" cmake -S. -Bbuild_cpp_tests -DBUILD_CPP_UNIT_TESTS=ON
cmake --build build_cpp_tests -t fwdpy11_cpp_tests -j 4
- name: Run C++ tests
working-directory: cpptests
run: |
make check
# Clean up so that the next step can work...
make clean
cmake --build build_cpp_tests -t test
- name: Build and run standalone C++ program
working-directory: cpp_neutral_benchmark
run: |
autoreconf --install
CXXFLAGS="-O3 -g" CC=$CC CXX=$CXX ./configure
make -j 3
./cpp_neutral_benchmark
cmake -E env CC=$CC cmake -E env CXX=$CXX cmake -S. -Bbuild_cpp -DBUILD_CPP_BENCHMARK=ON
cmake --build build_cpp -t cpp_neutral_benchmark -j 4
./build_cpp/cpp_neutral_benchmark/cpp_neutral_benchmark
- name: Run Python tests
run: |
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Expand Up @@ -25,6 +25,7 @@ option(USE_WEFFCPP "Use -Weffc++ during compilation" OFF)
option(ENABLE_PROFILING "Compile to enable code profiling" OFF)
option(BUILD_PYTHON_UNIT_TESTS "Build C++ modules for unit tests" ON)
option(BUILD_CPP_UNIT_TESTS "Build C++ unit test suite" OFF)
option(BUILD_CPP_BENCHMARK "Build C++ benchmark program" OFF)
option(DISABLE_LTO "Disable link-time optimization (LTO)" OFF)
option(CMAKE_BUILD "Set to ON when building with cmake. Set to off from, e.g., setup.py." ON)
include_directories(BEFORE
Expand Down Expand Up @@ -62,3 +63,6 @@ if(BUILD_CPP_UNIT_TESTS)
enable_testing()
add_subdirectory(cpptests)
endif(BUILD_CPP_UNIT_TESTS)
if(BUILD_CPP_BENCHMARK)
add_subdirectory(cpp_neutral_benchmark)
endif(BUILD_CPP_BENCHMARK)
23 changes: 23 additions & 0 deletions cpp_neutral_benchmark/CMakeLists.txt
@@ -0,0 +1,23 @@
SET(CPP_NEUTRAL_BENCHMARK_SOURCES
cpp_neutral_benchmark.cc
../fwdpy11/src/evolve_population/remove_extinct_genomes.cc
../fwdpy11/src/evolve_population/remove_extinct_mutations.cc
../fwdpy11/src/evolve_population/diploid_pop_fitness.cc
../fwdpy11/src/evolve_population/runtime_checks.cc
../fwdpy11/src/evolve_population/track_mutation_counts.cc
../fwdpy11/src/evolve_population/track_ancestral_counts.cc
../fwdpy11/src/evolve_population/index_and_count_mutations.cc
../fwdpy11/src/evolve_population/util.cc
../fwdpy11/src/evolve_population/evolvets.cc
../fwdpy11/src/evolve_population/cleanup_metadata.cc)

add_executable(cpp_neutral_benchmark ${CPP_NEUTRAL_BENCHMARK_SOURCES})
add_dependencies(cpp_neutral_benchmark fwdpy11core header)
target_link_directories(cpp_neutral_benchmark PRIVATE ${CMAKE_SOURCE_DIR}/fwdpy11)
target_link_libraries(cpp_neutral_benchmark PRIVATE fwdpy11core boost_program_options GSL::gsl GSL::gslcblas)
if (NOT APPLE)
target_link_options(cpp_neutral_benchmark BEFORE PUBLIC LINKER:--no-as-needed -ldl)
endif()

target_include_directories(cpp_neutral_benchmark BEFORE PUBLIC ${CMAKE_SOURCE_DIR}/fwdpy11/headers ${CMAKE_SOURCE_DIR}/fwdpy11/headers/fwdpp ${CMAKE_SOURCE_DIR}/fwdpy11/src/evolve_population)

22 changes: 0 additions & 22 deletions cpp_neutral_benchmark/Makefile.am

This file was deleted.

25 changes: 0 additions & 25 deletions cpp_neutral_benchmark/configure.ac

This file was deleted.

3 changes: 3 additions & 0 deletions cpptests/CMakeLists.txt
Expand Up @@ -12,6 +12,9 @@ add_executable(fwdpy11_cpp_tests ${CPPTEST_SOURCES})
add_dependencies(fwdpy11_cpp_tests fwdpy11core header)
target_link_directories(fwdpy11_cpp_tests PRIVATE ${CMAKE_SOURCE_DIR}/fwdpy11)
target_link_libraries(fwdpy11_cpp_tests PRIVATE boost_unit_test_framework fwdpy11core GSL::gsl GSL::gslcblas)
if (NOT APPLE)
target_link_options(fwdpy11_cpp_tests BEFORE PUBLIC LINKER:--no-as-needed -ldl)
endif()
set_target_properties(fwdpy11_cpp_tests PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_TEST_DYN_LINK")

add_test(NAME fwdpy11_cpp_tests
Expand Down
35 changes: 0 additions & 35 deletions cpptests/Makefile.am

This file was deleted.

25 changes: 0 additions & 25 deletions cpptests/configure.ac

This file was deleted.

7 changes: 0 additions & 7 deletions cpptests/coverage.sh

This file was deleted.

7 changes: 7 additions & 0 deletions doc/misc/changelog.md
Expand Up @@ -3,6 +3,13 @@
Major changes are listed below. Each release likely contains fiddling with back-end code,
updates to latest `fwdpp` version, etc.

## Next release

Build system and CI

* Remove all use of automake/autoconf.
PR {pr}`971`.

## 0.18.3

Bug fixes:
Expand Down
2 changes: 0 additions & 2 deletions requirements/conda_minimal_deps.txt
Expand Up @@ -8,8 +8,6 @@ tskit
msprime
gsl
boost
autoconf
automake
pytest
pytest-xdist
demes==0.2.0
Expand Down

0 comments on commit 9c82dd7

Please sign in to comment.