Skip to content

Commit

Permalink
Merge pull request #14 from JohanMabille/cpp17
Browse files Browse the repository at this point in the history
Upgraded to xeus-zmq 1.3.0 and CMakeLists cleanup
  • Loading branch information
JohanMabille committed Feb 9, 2024
2 parents 59084b3 + b8cd32c commit ac90e73
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 34 deletions.
34 changes: 2 additions & 32 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ endif ()
# ============

set(xtl_REQUIRED_VERSION 0.7.0)
set(xeus_REQUIRED_VERSION 3.0.5)
set(xeus_REQUIRED_VERSION 3.2.0)

if (NOT TARGET xtl)
find_package(xtl ${xtl_REQUIRED_VERSION} REQUIRED)
Expand All @@ -74,28 +74,6 @@ endif ()

find_package(nelson)

# Flags
# =====
include(CheckCXXCompilerFlag)

if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251 /wd4141")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4018 /wd4267 /wd4715 /wd4146 /wd4129")
endif ()

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Intel")
if (NOT EMSCRIPTEN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wunused-parameter -Wextra -Wreorder")
endif ()

CHECK_CXX_COMPILER_FLAG("-std=c++17" HAS_CPP_17_FLAG)
if (HAS_CPP_17_FLAG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
else ()
message(FATAL_ERROR "Unsupported compiler -- xeus requires C++17 support!")
endif ()
endif ()

# Source files
# ============

Expand Down Expand Up @@ -123,6 +101,7 @@ string(TOUPPER "${CMAKE_BUILD_TYPE}" U_CMAKE_BUILD_TYPE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib; ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")

macro(xnelson_set_common_options target_name)
target_compile_features(${target_name} PRIVATE cxx_std_17)
if (MSVC)
target_compile_options(${target_name} PUBLIC /wd4251 /wd4141)
target_compile_options(${target_name} PUBLIC /wd4018 /wd4267 /wd4715 /wd4146 /wd4129)
Expand All @@ -133,14 +112,6 @@ macro(xnelson_set_common_options target_name)
CMAKE_CXX_COMPILER_ID MATCHES "Intel")

target_compile_options(${target_name} PUBLIC -Wunused-parameter -Wextra -Wreorder)

# C++17 flag
CHECK_CXX_COMPILER_FLAG("-std=c++17" HAS_CPP_17_FLAG)
if (HAS_CPP_17_FLAG)
target_compile_features(${target_name} PRIVATE cxx_std_17)
else ()
message(FATAL_ERROR "Unsupported compiler -- xeus-nelson requires C++17 support!")
endif ()
endif ()

if (APPLE)
Expand Down Expand Up @@ -264,7 +235,6 @@ endif ()
if (XEUS_NELSON_BUILD_EXECUTABLE)
find_package(xeus-zmq 1.0.2 REQUIRED)
add_executable(xnelson ${XEUS_NELSON_MAIN_SRC})
target_compile_features(xnelson PRIVATE cxx_std_17)
xnelson_set_common_options(xnelson)
xnelson_set_kernel_options(xnelson)
target_link_libraries(xnelson PRIVATE xeus-zmq)
Expand Down
2 changes: 1 addition & 1 deletion environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:
- ninja
- cxx-compiler
# Host dependencies
- xeus-zmq >=1.0.2,<2.0
- xeus-zmq >=1.3.0,<2.0
- nlohmann_json
- cppzmq
- xtl
Expand Down
2 changes: 1 addition & 1 deletion environment-wasm-host.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ dependencies:
- nelson >=0.3,<0.4
- nlohmann_json
- xeus-lite
- xeus >=3.0.5,<4.0
- xeus >=3.2.0,<4.0
- xtl >=0.7,<0.8

0 comments on commit ac90e73

Please sign in to comment.