Skip to content

Commit

Permalink
Remove c++ modules support (for now) (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
bugdea1er authored Jul 9, 2024
1 parent 133c77b commit 83b168a
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 69 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,3 @@ jobs:
run: cmake --build build
- name: Run tests
run: ctest --output-on-failure --test-dir build

test-modules:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-24.04
- windows-2022
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Configure CMake (LLVM Clang)
if: ${{ matrix.os == 'ubuntu-24.04' }}
run: |
sudo apt install ninja-build
cmake -B build \
-DTMP_USE_MODULES:BOOL=ON \
-DCMAKE_CXX_COMPILER=clang++-17 \
-G Ninja
- name: Configure CMake (MSVC)
if: ${{ matrix.os == 'windows-2022' }}
run: cmake -B build -DTMP_USE_MODULES:BOOL=ON
- name: Build tests
run: cmake --build build
- name: Run tests
run: ctest --output-on-failure --test-dir build
18 changes: 1 addition & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
cmake_minimum_required(VERSION 3.14)
project(tmp VERSION 0.9)

option(TMP_USE_MODULES "Build C++20 modules" OFF)
if(TMP_USE_MODULES)
cmake_minimum_required(VERSION 3.28)
endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")

include(GNUInstallDirs)
Expand All @@ -14,15 +9,6 @@ find_package(Filesystem REQUIRED)
add_library(${PROJECT_NAME} STATIC src/tmp.cpp)
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17)

if(TMP_USE_MODULES)
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20)
target_sources(
${PROJECT_NAME}
PUBLIC FILE_SET CXX_MODULES
FILES src/tmp.cppm
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src)
endif()

target_link_libraries(${PROJECT_NAME} PUBLIC std::filesystem)
set_target_properties(${PROJECT_NAME} PROPERTIES EXPORT_NAME tmp)
target_include_directories(
Expand Down Expand Up @@ -61,9 +47,7 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)

install(
TARGETS ${PROJECT_NAME}
EXPORT tmp-targets
FILE_SET CXX_MODULES
DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
EXPORT tmp-targets)
install(
EXPORT tmp-targets
FILE tmp-targets.cmake
Expand Down
14 changes: 0 additions & 14 deletions src/tmp.cppm

This file was deleted.

4 changes: 1 addition & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ find_package(GTest)
add_executable(${PROJECT_NAME} directory.cpp file.cpp)
target_link_libraries(${PROJECT_NAME} tmp::tmp GTest::gtest_main)
target_compile_definitions(
${PROJECT_NAME}
PRIVATE PREFIX="com.github.bugdea1er.tmp"
$<$<BOOL:${TMP_USE_MODULES}>:TMP_USE_MODULES>)
${PROJECT_NAME} PRIVATE PREFIX="com.github.bugdea1er.tmp")

include(GoogleTest)
gtest_discover_tests(${PROJECT_NAME} EXTRA_ARGS --gtest_color=yes)
4 changes: 0 additions & 4 deletions tests/directory.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#ifdef TMP_USE_MODULES
import tmp;
#else
#include <tmp/directory>
#include <tmp/file>
#endif

#include <gtest/gtest.h>

Expand Down
4 changes: 0 additions & 4 deletions tests/file.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#ifdef TMP_USE_MODULES
import tmp;
#else
#include <tmp/directory>
#include <tmp/file>
#endif

#include <gtest/gtest.h>

Expand Down

0 comments on commit 83b168a

Please sign in to comment.