Skip to content

Commit

Permalink
removed experimental-library flag, cmake 3.28 changes, temporary no m…
Browse files Browse the repository at this point in the history
…odule for System
  • Loading branch information
superg committed Dec 7, 2023
1 parent b635776 commit b389ae6
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 22 deletions.
22 changes: 13 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
cmake_minimum_required(VERSION 3.26)
# enable scan imports in 3.28 while supporting 3.26
cmake_policy(SET CMP0155 NEW)

# project / version
set(REDUMPER_PROJECT_NAME "redumper" CACHE STRING "Project name")
Expand Down Expand Up @@ -49,22 +51,24 @@ endif()
# C/C++
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(CMAKE_VERSION VERSION_LESS "3.27.0")
set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "2182bf5c-ef0d-489a-91da-49dbc3090d2a")
else()
set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7")
if(CMAKE_VERSION VERSION_LESS "3.28.0")
set(CMAKE_CXX_EXTENSIONS OFF)
if(CMAKE_VERSION VERSION_LESS "3.27.0")
set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "2182bf5c-ef0d-489a-91da-49dbc3090d2a")
else()
set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7")
endif()
set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1)
endif()
set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1)
add_definitions(-DREDUMPER_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}
-DREDUMPER_VERSION_MINOR=${PROJECT_VERSION_MINOR}
-DREDUMPER_VERSION_PATCH=${PROJECT_VERSION_PATCH}
-DREDUMPER_VERSION_BUILD=${REDUMPER_VERSION_BUILD})

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# -fexperimental-library is required for clang-16 as std::format is defined there
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-stdlib=libc++> -fexperimental-library)
add_link_options(-stdlib=libc++ ${REDUMPER_CLANG_LINK_OPTIONS} -fexperimental-library)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-stdlib=libc++>)
add_link_options(-stdlib=libc++ ${REDUMPER_CLANG_LINK_OPTIONS})

# silence implicit modules use warning
# TL;DR, this will be taken cared of by listing module dependencies explicitly (cmake)
Expand Down Expand Up @@ -116,6 +120,7 @@ target_sources(redumper
"dvd/css/css_tables.cc"
"main.cc"
"driveoffsets.txt"
"systems/system.hh"
"utils/throw_line.hh"
"redumper.manifest"
${DRIVEOFFSETS_FN}
Expand Down Expand Up @@ -161,7 +166,6 @@ target_sources(redumper
"systems/psx.ixx"
"systems/ps2.ixx"
"systems/sat.ixx"
"systems/system.ixx"
"systems/systems.ixx"
"utils/animation.ixx"
"utils/endian.ixx"
Expand Down
2 changes: 1 addition & 1 deletion info.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module;
#include <string>
#include <utility>
#include <sstream>
#include "systems/system.hh"
#include "throw_line.hh"

export module info;
Expand All @@ -18,7 +19,6 @@ import readers.image_bin_form1_reader;
import readers.image_iso_form1_reader;
import readers.image_raw_reader;
import readers.sector_reader;
import systems.system;
import systems.systems;
import utils.hex_bin;
import utils.logger;
Expand Down
2 changes: 1 addition & 1 deletion systems/mcd.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ module;
#include <set>
#include <string_view>
#include <vector>
#include "system.hh"

export module systems.mcd;

import filesystem.iso9660;
import readers.sector_reader;
import systems.system;
import utils.hex_bin;
import utils.misc;
import utils.strings;
Expand Down
2 changes: 1 addition & 1 deletion systems/ps2.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ module;
#include <ostream>
#include <regex>
#include <set>
#include "system.hh"
#include "throw_line.hh"

export module systems.ps2;

import filesystem.iso9660;
import readers.sector_reader;
import systems.system;
import utils.misc;
import utils.strings;

Expand Down
2 changes: 1 addition & 1 deletion systems/psx.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module;
#include <ostream>
#include <regex>
#include <set>
#include "system.hh"
#include "throw_line.hh"

export module systems.psx;
Expand All @@ -15,7 +16,6 @@ import cd.subcode;
import dump;
import filesystem.iso9660;
import readers.sector_reader;
import systems.system;
import utils.endian;
import utils.file_io;
import utils.misc;
Expand Down
2 changes: 1 addition & 1 deletion systems/s_cdrom.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module;
#include <fstream>
#include <ostream>
#include <vector>
#include "system.hh"
#include "throw_line.hh"

export module systems.cdrom;
Expand All @@ -13,7 +14,6 @@ import cd.cdrom;
import cd.ecc;
import cd.edc;
import readers.sector_reader;
import systems.system;
import utils.file_io;


Expand Down
2 changes: 1 addition & 1 deletion systems/s_iso.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ module;
#include <format>
#include <fstream>
#include <ostream>
#include "system.hh"

export module systems.iso;

import filesystem.iso9660;
import readers.sector_reader;
import systems.system;
import utils.hex_bin;
import utils.strings;

Expand Down
2 changes: 1 addition & 1 deletion systems/sat.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ module;
#include <format>
#include <ostream>
#include <string_view>
#include "system.hh"

export module systems.sat;

import filesystem.iso9660;
import readers.sector_reader;
import systems.system;
import utils.hex_bin;


Expand Down
2 changes: 1 addition & 1 deletion systems/securom.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module;
#include <fstream>
#include <ostream>
#include <vector>
#include "system.hh"
#include "throw_line.hh"


Expand All @@ -16,7 +17,6 @@ import cd.subcode;
import crc.crc16_gsm;
import dump;
import readers.sector_reader;
import systems.system;
import utils.endian;
import utils.file_io;
import utils.misc;
Expand Down
6 changes: 3 additions & 3 deletions systems/system.ixx → systems/system.hh
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
module;
#include <filesystem>
#include <ostream>
#include <string>

export module systems.system;


import readers.sector_reader;

Expand All @@ -12,7 +11,8 @@ import readers.sector_reader;
namespace gpsxre
{

export class System
//FIXME: switch back to module after correction of CMake Ninja generator issue with cyclic dependencies
class System
{
public:
enum class Type
Expand Down
4 changes: 2 additions & 2 deletions systems/systems.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module;
#include <functional>
#include <list>
#include <memory>
#include "system.hh"

export module systems.systems;

Expand All @@ -12,7 +13,6 @@ import systems.psx;
import systems.ps2;
import systems.securom;
import systems.sat;
import systems.system;



Expand All @@ -29,7 +29,7 @@ public:
static std::list<Creator> get()
{
std::list<Creator> systems;

systems.push_back([](){ return std::make_unique<SystemCDROM>(); });
systems.push_back([](){ return std::make_unique<SystemSecuROM>(); });
systems.push_back([](){ return std::make_unique<SystemISO>(); });
Expand Down

0 comments on commit b389ae6

Please sign in to comment.