Skip to content

Commit

Permalink
Fix ubuntu 20.04 build with gcc9 (#128)
Browse files Browse the repository at this point in the history
* Add arm profiles

* Add check depending on arch

* Bump benchmark version

* Fix "aarch64" -> "arm64" on conan Setup.py

* Fix RPi support

* Add  	ubuntu-20.04 to test.yml

* Update everything to c++17

* change naming convention of profiles and adjust build script

* Rename profiles

* Get gcc version from command line

* add gcc 9 profiles

* Add gcc 13 profiles

* add build missing to workflow and build script

* run conan profile detect

* use arm preset on mac

---------

Co-authored-by: Philipp Basler <[email protected]>
Co-authored-by: João Viana <[email protected]>
  • Loading branch information
3 people authored Apr 27, 2024
1 parent 54de6bd commit 829317f
Show file tree
Hide file tree
Showing 26 changed files with 159 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
tests-fullSetup:
strategy:
matrix:
setup: [ {os: ubuntu-latest}, {os: windows-latest}, {os: macos-latest}]
setup: [ {os: ubuntu-latest}, {os: windows-latest}, {os: macos-latest}, {os: ubuntu-20.04}]
runs-on: ${{matrix.setup.os}}
if: "!contains(github.event.head_commit.message, 'skip-ci')"

Expand All @@ -38,7 +38,7 @@ jobs:
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v2
id: cpu-cores
- run: python3 Setup.py --options CompileBaryo=True
- run: python3 Setup.py --options CompileBaryo=True --build-missing

- name: Set cmake preset name
run: python3 .github/GetProfile.py
Expand Down
2 changes: 1 addition & 1 deletion Build.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def build(preset):

def main():
Setup.setup_profiles()
Setup.conan_install_all(Setup.BuildMode.release)
Setup.conan_install_all(Setup.BuildMode.release,build_missing=True)
build(get_preset())

if __name__ == "__main__":
Expand Down
21 changes: 21 additions & 0 deletions Setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ class BuildMode(ArgTypeEnum, Enum):
release = (1,)
debug = 2

def get_compiler():
compiler=""

if sys.platform != "linux":
return compiler

compiler += "-gcc-"
compiler += get_gcc_version()



return compiler

def get_profile(os: str, arch: str, build_type: BuildMode):
profile = ""
if os == "win32":
Expand All @@ -43,8 +56,16 @@ def get_profile(os: str, arch: str, build_type: BuildMode):
profile += "-"
profile += arch

profile += get_compiler()


return profile

def get_gcc_version():
version_response = subprocess.check_output('gcc --version'.split(), encoding="UTF-8").partition("\n")[0]
semver_string=version_response[version_response.rfind(' ')+1:]
major = semver_string.partition('.')[0]
return major

def get_arch():
arch = "x86_64"
Expand Down
10 changes: 10 additions & 0 deletions profiles/BSMPT/linux-debug-armv8-gcc-11
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[settings]
arch=armv8
build_type=Debug
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=11
os=Linux


10 changes: 10 additions & 0 deletions profiles/BSMPT/linux-debug-armv8-gcc-13
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[settings]
arch=armv8
build_type=Debug
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=13
os=Linux


10 changes: 10 additions & 0 deletions profiles/BSMPT/linux-debug-armv8-gcc-9
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[settings]
arch=armv8
build_type=Debug
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=9
os=Linux


10 changes: 10 additions & 0 deletions profiles/BSMPT/linux-debug-x86_64-gcc-11
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[settings]
arch=x86_64
build_type=Debug
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=11
os=Linux


10 changes: 10 additions & 0 deletions profiles/BSMPT/linux-debug-x86_64-gcc-13
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[settings]
arch=x86_64
build_type=Debug
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=13
os=Linux


10 changes: 10 additions & 0 deletions profiles/BSMPT/linux-debug-x86_64-gcc-9
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[settings]
arch=x86_64
build_type=Debug
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=9
os=Linux


9 changes: 9 additions & 0 deletions profiles/BSMPT/linux-release-armv8-gcc-11
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[settings]
arch=armv8
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=11
os=Linux

9 changes: 9 additions & 0 deletions profiles/BSMPT/linux-release-armv8-gcc-13
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[settings]
arch=armv8
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=13
os=Linux

9 changes: 9 additions & 0 deletions profiles/BSMPT/linux-release-armv8-gcc-9
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[settings]
arch=armv8
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=9
os=Linux

9 changes: 9 additions & 0 deletions profiles/BSMPT/linux-release-x86_64-gcc-11
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=11
os=Linux

9 changes: 9 additions & 0 deletions profiles/BSMPT/linux-release-x86_64-gcc-13
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=13
os=Linux

9 changes: 9 additions & 0 deletions profiles/BSMPT/linux-release-x86_64-gcc-9
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=9
os=Linux

22 changes: 11 additions & 11 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,48 +20,48 @@ add_subdirectory(utility)

add_executable(BSMPT prog/BSMPT.cpp)
target_link_libraries(BSMPT Minimizer Models Utility)
target_compile_features(BSMPT PUBLIC cxx_std_14)
target_compile_features(BSMPT PUBLIC cxx_std_17)

add_executable(VEVEVO prog/VEVEVO.cpp)
target_link_libraries(VEVEVO Minimizer Models Utility)
target_compile_features(VEVEVO PUBLIC cxx_std_14)
target_compile_features(VEVEVO PUBLIC cxx_std_17)

add_executable(NLOVEV prog/NLOVEV.cpp)
target_link_libraries(NLOVEV Minimizer Models Utility)
target_compile_features(NLOVEV PUBLIC cxx_std_14)
target_compile_features(NLOVEV PUBLIC cxx_std_17)

add_executable(CalcCT prog/CalcCT.cpp)
target_link_libraries(CalcCT Models Utility)
target_compile_features(CalcCT PUBLIC cxx_std_14)
target_compile_features(CalcCT PUBLIC cxx_std_17)

add_executable(TripleHiggsCouplingsNLO prog/TripleHiggsNLO.cpp)
target_link_libraries(TripleHiggsCouplingsNLO Models Utility)
target_compile_features(TripleHiggsCouplingsNLO PUBLIC cxx_std_14)
target_compile_features(TripleHiggsCouplingsNLO PUBLIC cxx_std_17)

add_executable(Test prog/Test.cpp)
target_link_libraries(Test Minimizer Models Utility)
target_compile_features(Test PUBLIC cxx_std_14)
target_compile_features(Test PUBLIC cxx_std_17)

if(BSMPTCompileBaryo)
add_executable(CalculateEWBG prog/CalculateEWBG.cpp)
target_link_libraries(CalculateEWBG Minimizer Models Baryo Utility)
target_compile_features(CalculateEWBG PUBLIC cxx_std_14)
target_compile_features(CalculateEWBG PUBLIC cxx_std_17)
else(BSMPTCompileBaryo)
message("CalculateEWBG will not compile as Boost is missing")
endif(BSMPTCompileBaryo)

if(BSMPTCompileBaryo)
add_executable(PlotEWBG_vw prog/PlotEWBG_vw.cpp)
target_link_libraries(PlotEWBG_vw Minimizer Models Baryo Utility)
target_compile_features(PlotEWBG_vw PUBLIC cxx_std_14)
target_compile_features(PlotEWBG_vw PUBLIC cxx_std_17)
else(BSMPTCompileBaryo)
message("PlotEWBG_vw will not compile as Boost is missing")
endif(BSMPTCompileBaryo)

if(BSMPTCompileBaryo)
add_executable(PlotEWBG_nL prog/PlotEWBG_nL.cpp)
target_link_libraries(PlotEWBG_nL Minimizer Models Baryo Utility)
target_compile_features(PlotEWBG_nL PUBLIC cxx_std_14)
target_compile_features(PlotEWBG_nL PUBLIC cxx_std_17)
else(BSMPTCompileBaryo)
message("PlotEWBG_nL will not compile as Boost is missing")
endif(BSMPTCompileBaryo)
Expand All @@ -74,15 +74,15 @@ if(MakeAdditionalTesting)
if(BSMPTCompileBaryo)
add_executable(CreateMuGrid prog/CreateMuGrid.cpp)
target_link_libraries(CreateMuGrid Minimizer Models Baryo Utility)
target_compile_features(CreateMuGrid PUBLIC cxx_std_14)
target_compile_features(CreateMuGrid PUBLIC cxx_std_17)
else(BSMPTCompileBaryo)
message("CreateMuGrid will not compile as Boost is missing")
endif(BSMPTCompileBaryo)

if(BSMPTCompileBaryo)
add_executable(Kfactor_grid prog/Kfactor_grid.cpp)
target_link_libraries(Kfactor_grid Minimizer Models Kfactors Utility)
target_compile_features(Kfactor_grid PUBLIC cxx_std_14)
target_compile_features(Kfactor_grid PUBLIC cxx_std_17)
else(BSMPTCompileBaryo)
message("Kfactor_grid will not compile as Boost is missing")
endif(BSMPTCompileBaryo)
Expand Down
2 changes: 1 addition & 1 deletion src/Kfactors/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ if(OpenMP_FOUND)
target_link_libraries(Kfactors PUBLIC OpenMP::OpenMP_CXX)
endif()
target_include_directories(Kfactors PUBLIC ${BSMPT_SOURCE_DIR}/include)
target_compile_features(Kfactors PUBLIC cxx_std_14)
target_compile_features(Kfactors PUBLIC cxx_std_17)
2 changes: 1 addition & 1 deletion src/ThermalFunctions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ add_library(ThermalFunctions ${header} ${src})

target_link_libraries(ThermalFunctions PUBLIC GSL::gsl)
target_include_directories(ThermalFunctions PUBLIC ${BSMPT_SOURCE_DIR}/include)
target_compile_features(ThermalFunctions PUBLIC cxx_std_14)
target_compile_features(ThermalFunctions PUBLIC cxx_std_17)
2 changes: 1 addition & 1 deletion src/WallThickness/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ target_link_libraries(
LibWallThickness PUBLIC Eigen3::Eigen GSL::gsl Minimizer Utility Boost::boost
Threads::Threads)
target_include_directories(LibWallThickness PUBLIC ${BSMPT_SOURCE_DIR}/include)
target_compile_features(LibWallThickness PUBLIC cxx_std_14)
target_compile_features(LibWallThickness PUBLIC cxx_std_17)
2 changes: 1 addition & 1 deletion src/baryo_calculation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ target_link_libraries(
Boost::boost)
# target_compile_options(Baryo PUBLIC ${OpenMP_CXX_FLAGS})
target_include_directories(Baryo PUBLIC ${BSMPT_SOURCE_DIR}/include)
target_compile_features(Baryo PUBLIC cxx_std_14)
target_compile_features(Baryo PUBLIC cxx_std_17)
2 changes: 1 addition & 1 deletion src/minimizer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ endif()
target_include_directories(Minimizer PUBLIC ${BSMPT_SOURCE_DIR}/include
${BSMPT_BINARY_DIR}/include)
target_include_directories(Minimizer PUBLIC ${BSMPT_SOURCE_DIR}/include)
target_compile_features(Minimizer PUBLIC cxx_std_14)
target_compile_features(Minimizer PUBLIC cxx_std_17)
2 changes: 1 addition & 1 deletion src/utility/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ target_compile_features(Utility PUBLIC cxx_std_17)
if(nlohmann_json_FOUND)
target_link_libraries(Utility PRIVATE nlohmann_json::nlohmann_json)
endif()
target_compile_features(Utility PUBLIC cxx_std_14)
target_compile_features(Utility PUBLIC cxx_std_17)
2 changes: 1 addition & 1 deletion tests/GenerateTestCompares/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ set(header C2HDM.h R2HDM.h RN2HDM.h CPINTHEDARK.h CXSM.h)
set(src C2HDM.cpp R2HDM.cpp RN2HDM.cpp CPINTHEDARK.cpp CXSM.cpp)

add_library(TestCompares ${header} ${src})
target_compile_features(TestCompares PUBLIC cxx_std_14)
target_compile_features(TestCompares PUBLIC cxx_std_17)
target_link_libraries(TestCompares PRIVATE Minimizer)
target_include_directories(TestCompares PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
2 changes: 1 addition & 1 deletion tests/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if(benchmark_FOUND)
target_link_libraries(benchmarks Minimizer Models Utility TestCompares
ThermalFunctions)
target_link_libraries(benchmarks benchmark::benchmark)
target_compile_features(benchmarks PUBLIC cxx_std_14)
target_compile_features(benchmarks PUBLIC cxx_std_17)

if(BSMPTCompileBaryo)
target_link_libraries(benchmarks Baryo)
Expand Down
2 changes: 1 addition & 1 deletion tests/catcheventlistener/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ add_library(CatchEventListener catcheventlistener.cpp)
target_link_libraries(CatchEventListener PRIVATE Utility Catch2::Catch2WithMain)
target_include_directories(CatchEventListener
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_features(CatchEventListener PUBLIC cxx_std_14)
target_compile_features(CatchEventListener PUBLIC cxx_std_17)
2 changes: 1 addition & 1 deletion tests/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ target_link_libraries(
Utility
TestCompares
ThermalFunctions)
target_compile_features(GenericTests PUBLIC cxx_std_14)
target_compile_features(GenericTests PUBLIC cxx_std_17)

include(Catch)
catch_discover_tests(GenericTests)
Expand Down

0 comments on commit 829317f

Please sign in to comment.