Skip to content

Commit 61add34

Browse files
committed
Adjust app4triqs skeleton for python-only projects
1 parent 57425fc commit 61add34

File tree

7 files changed

+12
-111
lines changed

7 files changed

+12
-111
lines changed

CMakeLists.txt

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ cmake_policy(VERSION ${CMAKE_VERSION})
2424

2525
# ############
2626
# Define Project
27-
project(triqs_dft_tools VERSION 3.3.1 LANGUAGES C CXX Fortran)
27+
project(triqs_dft_tools VERSION 3.3.1 LANGUAGES CXX Fortran)
2828
get_directory_property(IS_SUBPROJECT PARENT_DIRECTORY)
2929

3030
# ############
@@ -66,6 +66,11 @@ if(NOT IS_SUBPROJECT)
6666
message(STATUS "-------- BUILD-TYPE: ${CMAKE_BUILD_TYPE} --------")
6767
endif()
6868

69+
# Python Support
70+
if(NOT TRIQS_WITH_PYTHON_SUPPORT)
71+
message(FATAL_ERROR "TRIQS was installed without Python support. Cannot build the Python Interface. Disable the build with -DPythonSupport=OFF")
72+
endif()
73+
6974
# Documentation
7075
option(Build_Documentation "Build documentation" OFF)
7176

@@ -75,44 +80,6 @@ if(Build_Tests)
7580
enable_testing()
7681
endif()
7782

78-
# ############
79-
# Global Compilation Settings
80-
81-
# Build static libraries by default
82-
option(BUILD_SHARED_LIBS "Enable compilation of shared libraries" OFF)
83-
84-
# Export the list of compile-commands into compile_commands.json
85-
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
86-
87-
# Disable compiler extensions
88-
set(CMAKE_CXX_EXTENSIONS OFF)
89-
90-
# Provide additional debugging information for Debug builds
91-
add_compile_options($<$<CONFIG:Debug>:-ggdb3>)
92-
93-
# Create an Interface target for compiler warnings
94-
add_library(${PROJECT_NAME}_warnings INTERFACE)
95-
target_compile_options(${PROJECT_NAME}_warnings
96-
INTERFACE
97-
-Wall
98-
-Wextra
99-
-Wfloat-conversion
100-
-Wpedantic
101-
-Wno-sign-compare
102-
$<$<CXX_COMPILER_ID:GNU>:-Wno-comma-subscript>
103-
$<$<CXX_COMPILER_ID:GNU>:-Wno-psabi> # Disable notes about ABI changes
104-
$<$<CXX_COMPILER_ID:GNU>:-Wshadow=local>
105-
$<$<CXX_COMPILER_ID:GNU>:-Wno-attributes>
106-
$<$<CXX_COMPILER_ID:GNU>:-Wno-deprecated-declarations>
107-
$<$<CXX_COMPILER_ID:AppleClang,Clang,IntelLLVM>:-Wno-deprecated-comma-subscript>
108-
$<$<CXX_COMPILER_ID:AppleClang,Clang,IntelLLVM>:-Wno-unknown-warning-option>
109-
$<$<CXX_COMPILER_ID:AppleClang,Clang,IntelLLVM>:-Wshadow>
110-
$<$<CXX_COMPILER_ID:AppleClang,Clang,IntelLLVM>:-Wno-gcc-compat>
111-
$<$<CXX_COMPILER_ID:AppleClang,Clang,IntelLLVM>:-Wno-c++20-extensions>
112-
$<$<CXX_COMPILER_ID:AppleClang,Clang,IntelLLVM>:-Wno-c++20-compat>
113-
$<$<CXX_COMPILER_ID:IntelLLVM>:-Wno-tautological-constant-compare>
114-
)
115-
11683
# Provide GNU Installation directories
11784
include(GNUInstallDirs)
11885

@@ -144,7 +111,7 @@ add_subdirectory(bin)
144111
# Additional configuration files
145112
add_subdirectory(share)
146113

147-
# add packaging for automatic Versioning
114+
# add packaging for automatic versioning
148115
add_subdirectory(packaging)
149116

150117
# #############

Jenkinsfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ properties([
2424
def platforms = [:]
2525

2626
/****************** linux builds (in docker) */
27-
/* Each platform must have a corresponding Dockerfile.PLATFORM in triqs/packaging */
28-
def dockerPlatforms = ["ubuntu-clang", "ubuntu-gcc", "ubuntu-intel", "sanitize"]
27+
/* Each platform must have a cooresponding Dockerfile.PLATFORM in triqs/packaging */
28+
def dockerPlatforms = ["ubuntu-clang", "ubuntu-gcc"]
2929
/* .each is currently broken in jenkins */
3030
for (int i = 0; i < dockerPlatforms.size(); i++) {
3131
def platform = dockerPlatforms[i]

deps/CMakeLists.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,3 @@ else()
4646
message(WARNING "For builds with llvm sanitizers (ASAN/UBSAN) it is recommended to use -DBuild_Deps=Always to avoid false positives.")
4747
endif()
4848
endif()
49-
50-
# -- GTest --
51-
external_dependency(GTest
52-
GIT_REPO https://github.com/google/googletest
53-
GIT_TAG main
54-
BUILD_ALWAYS
55-
EXCLUDE_FROM_ALL
56-
)

doc/CMakeLists.txt

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,6 @@
11
# Generate the sphinx config file
22
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/conf.py @ONLY)
33

4-
# -----------------------------------------------------------------------------
5-
# Create an optional target that allows us to regenerate the C++ doc with c++2rst
6-
# -----------------------------------------------------------------------------
7-
add_custom_target(${PROJECT_NAME}_docs_cpp2rst)
8-
include(${PROJECT_SOURCE_DIR}/share/cmake/extract_flags.cmake)
9-
extract_flags(${PROJECT_NAME}_c BUILD_INTERFACE)
10-
separate_arguments(${PROJECT_NAME}_c_CXXFLAGS)
11-
macro(generate_docs header_file)
12-
add_custom_command(
13-
TARGET ${PROJECT_NAME}_docs_cpp2rst
14-
POST_BUILD
15-
COMMAND rm -rf ${CMAKE_CURRENT_SOURCE_DIR}/cpp2rst_generated
16-
COMMAND
17-
PYTHONPATH=${CPP2PY_BINARY_DIR}:$ENV{PYTHONPATH}
18-
PATH=${CPP2PY_BINARY_DIR}/bin:${CPP2PY_ROOT}/bin:$ENV{PATH}
19-
c++2rst
20-
${header_file}
21-
-N ${PROJECT_NAME}
22-
--output_directory ${CMAKE_CURRENT_SOURCE_DIR}/cpp2rst_generated
23-
-I${PROJECT_SOURCE_DIR}/c++
24-
--cxxflags="${${PROJECT_NAME}_c_CXXFLAGS}"
25-
)
26-
endmacro(generate_docs)
27-
28-
generate_docs(${PROJECT_SOURCE_DIR}/c++/${PROJECT_NAME}/${PROJECT_NAME}.hpp)
29-
30-
# --------------------------------------------------------
31-
# Build & Run the C++ doc examples and capture the output
32-
# --------------------------------------------------------
33-
34-
add_custom_target(${PROJECT_NAME}_docs_example_output)
35-
file(GLOB_RECURSE ExampleList RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
36-
foreach(example ${ExampleList})
37-
get_filename_component(f ${example} NAME_WE)
38-
get_filename_component(d ${example} DIRECTORY)
39-
add_executable(${PROJECT_NAME}_doc_${f} EXCLUDE_FROM_ALL ${example})
40-
set_property(TARGET ${PROJECT_NAME}_doc_${f} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${d})
41-
target_link_libraries(${PROJECT_NAME}_doc_${f} triqs)
42-
add_custom_command(TARGET ${PROJECT_NAME}_doc_${f} POST_BUILD
43-
COMMAND ${PROJECT_NAME}_doc_${f} > ${CMAKE_CURRENT_SOURCE_DIR}/${d}/${f}.output 2>/dev/null
44-
WORKING_DIRECTORY ${d}
45-
)
46-
add_dependencies(${PROJECT_NAME}_docs_example_output ${PROJECT_NAME}_doc_${f})
47-
endforeach()
48-
494
# ---------------------------------
505
# Top Sphinx target
516
# ---------------------------------
@@ -61,18 +16,6 @@ add_custom_command(
6116
COMMAND PYTHONPATH=${PROJECT_BINARY_DIR}/python:$ENV{PYTHONPATH} ${SPHINXBUILD_EXECUTABLE} -j auto -c . -b html ${CMAKE_CURRENT_SOURCE_DIR} html
6217
)
6318

64-
option(Sphinx_Only "When building the documentation, skip the Python Modules and the generation of C++ Api and example outputs" OFF)
65-
if(NOT Sphinx_Only)
66-
# Autodoc usage requires the python modules to be built first
67-
get_property(CPP2PY_MODULES_LIST GLOBAL PROPERTY CPP2PY_MODULES_LIST)
68-
if(CPP2PY_MODULES_LIST)
69-
add_dependencies(${PROJECT_NAME}_docs_sphinx ${CPP2PY_MODULES_LIST})
70-
endif()
71-
72-
# Generation of C++ Api and Example Outputs
73-
add_dependencies(${PROJECT_NAME}_docs_sphinx ${PROJECT_NAME}_docs_cpp2rst ${PROJECT_NAME}_docs_example_output)
74-
endif()
75-
7619
# ---------------------------------
7720
# Install
7821
# ---------------------------------

doc/install.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ Installation steps
6767

6868
#. Compile the code, run the tests and install the application::
6969

70-
$ make
7170
$ make test
7271
$ make install
7372

share/cmake/triqs_dft_tools-config.cmake.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ set(@PROJECT_NAME@_ROOT @CMAKE_INSTALL_PREFIX@ CACHE STRING "@PROJECT_NAME@ root
2323
#endfunction()
2424
#find_dep(depname 1.0)
2525

26-
# Include the exported targets of this project
27-
include(@CMAKE_INSTALL_FULL_LIBDIR@/cmake/@PROJECT_NAME@/@PROJECT_NAME@-targets.cmake)
26+
## Include the exported targets of this project
27+
#include(@CMAKE_INSTALL_FULL_LIBDIR@/cmake/@PROJECT_NAME@/@[email protected])
2828

2929
message(STATUS "Found @[email protected] with version @PROJECT_VERSION@, hash = @PROJECT_GIT_HASH@, root = @CMAKE_INSTALL_PREFIX@")
3030

test/python/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ foreach(test ${all_tests})
1515
get_filename_component(test_name ${test} NAME_WE)
1616
get_filename_component(test_dir ${test} DIRECTORY)
1717
add_test(NAME Py_${test_name} COMMAND ${TRIQS_PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${test_dir}/${test_name}.py WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir})
18-
set_property(TEST Py_${test_name} APPEND PROPERTY ENVIRONMENT PYTHONPATH=${PROJECT_BINARY_DIR}/python:$ENV{PYTHONPATH} ${SANITIZER_RT_PRELOAD})
18+
set_property(TEST Py_${test_name} APPEND PROPERTY ENVIRONMENT PYTHONPATH=${PROJECT_BINARY_DIR}/python:$ENV{PYTHONPATH})
1919
endforeach()

0 commit comments

Comments
 (0)