Skip to content

Commit

Permalink
Changes to allow for CMake build.
Browse files Browse the repository at this point in the history
  • Loading branch information
toastisme committed Dec 13, 2023
1 parent 6065277 commit 0a07bac
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .conda-envs/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ conda-forge::jinja2
conda-forge::jpeg
conda-forge::matplotlib-base>=3.0.2
conda-forge::mrcfile
conda-forge::msgpack-c
conda-forge::msgpack-cxx
conda-forge::msgpack-python
conda-forge::numpy>=1.19,<1.21|>=1.21.5
conda-forge::orderedset
Expand Down
2 changes: 1 addition & 1 deletion .conda-envs/macos.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ conda-forge::jpeg
conda-forge::libcxx
conda-forge::matplotlib-base>=3.0.2
conda-forge::mrcfile
conda-forge::msgpack-c
conda-forge::msgpack-cxx
conda-forge::msgpack-python
conda-forge::numpy>=1.19,<1.21|>=1.21.5
conda-forge::orderedset
Expand Down
2 changes: 1 addition & 1 deletion .conda-envs/windows.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ conda-forge::jinja2
conda-forge::jpeg
conda-forge::matplotlib-base>=3.0.2
conda-forge::mrcfile
conda-forge::msgpack-c
conda-forge::msgpack-cxx
conda-forge::msgpack-python
conda-forge::numpy>=1.19,<1.21|>=1.21.5
conda-forge::orderedset
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repos:

# Automatically sort imports
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
args: [
Expand Down
14 changes: 10 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,28 @@ cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
project(dials)

# Add the included modules
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")

# General cmake environment configuration
include(SetDefaultBuildRelWithDebInfo) # Default builds to release with debug info
include(CoverageBuildConfiguration) # Custom module to make turning coverage on easy
include(AlwaysColourCompilation) # Always show coloured compiler output
include(CheckCXXSymbolExists)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # Generate compile_commands.json
set(CMAKE_CXX_STANDARD 14)

find_package(Python REQUIRED COMPONENTS Interpreter Development)
find_package(CCTBX COMPONENTS cctbx scitbx ccp4io annlib REQUIRED)
find_package(DXTBX REQUIRED)
find_package(msgpack REQUIRED)
find_package(OpenMP)
# Handle msgpack.. between versions 3 and 6, split into separate packages.
# While we still support both, look for both names
find_package(msgpack-cxx REQUIRED NAMES msgpack-cxx msgpack)
if (TARGET msgpackc AND NOT TARGET msgpack-cxx)
# If the old version of the library, let us refer to the new name
add_library(msgpack-cxx ALIAS msgpackc)
endif()

# Find the boost::python library for this version of python
set(Boost_USE_STATIC_LIBS OFF) # This is the default everywhere except Windows
Expand All @@ -26,8 +33,7 @@ find_package(Boost COMPONENTS thread "python${Python_VERSION_MAJOR}${Python_VERS
# Create Boost::python alias so we don't need to carry the python version around
if(NOT TARGET Boost::python)
add_library(Boost::python INTERFACE IMPORTED)
set_target_properties(Boost::python PROPERTIES
INTERFACE_LINK_LIBRARIES "python${Python_VERSION_MAJOR}${Python_VERSION_MINOR}" )
set_target_properties(Boost::python PROPERTIES INTERFACE_LINK_LIBRARIES Python::Module)
endif()

# Put the libraries into lib/ so that we can run this in-place in a TBX install
Expand Down
2 changes: 1 addition & 1 deletion cmake/Modules/AlwaysColourCompilation.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Add compiler flags to always output coloured diagnostics
#
# This is an issue with Ninja where it captures the output to avoid
# intermixing output like the makefile generator. Unfortuantely,
# intermixing output like the makefile generator. Unfortunately,
# the compiler detects it's being captured and doesn't output the
# coloured diagnostics.
#
Expand Down
2 changes: 1 addition & 1 deletion cmake/Modules/FindCCTBX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function(_cctbx_read_module MODULE)
endif()
endforeach()
else()
# We didn't have any speciic override. If include/ exists
# We didn't have any specific override. If include/ exists
# then use that, otherwise use the module parent directory.
if (EXISTS "${_dist_path}/include")
list(APPEND _include_paths "${_dist_path}/include")
Expand Down
4 changes: 2 additions & 2 deletions src/dials/array_family/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ target_link_libraries(
CCTBX::cctbx
Boost::python
CCTBX::scitbx::boost_python
msgpackc
)
msgpack-cxx
)

0 comments on commit 0a07bac

Please sign in to comment.