chore(cmake): cmake license header, update a bit

Instead of using set_target_properties on all tool binaries,
instead we can use target_compile_features([xxx] PUBLIC cxx_std_20).

This properly alienates projects which depend on libeuropa, allowing the src/tools CMakeLists to be trimmed down quite a bit.

Also fixes a build break I accidentally introduced.
This commit is contained in:
Lily Tsuru 2022-09-21 02:55:57 -05:00
parent 6228bf77e8
commit 8d607675d0
7 changed files with 42 additions and 32 deletions

View File

@ -1,3 +1,11 @@
#
# EuropaTools
#
# (C) 2021-2022 modeco80 <lily.modeco80@protonmail.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
cmake_minimum_required(VERSION 3.10)
# Prohibit in-source tree builds.
@ -7,7 +15,11 @@ endif()
include(cmake/Policies.cmake)
project(EuropaTools)
project(EuropaTools
VERSION 0.0.1 # Placeholder for sem-ver usage. Replace with real value later.
LANGUAGES C CXX
DESCRIPTION "Tools for working with LEC Europa based games (Star Wars: Starfighter & Star Wars: Jedi Starfighter)"
)
add_subdirectory(third_party/libpixel)
add_subdirectory(third_party/indicators)

View File

@ -1,3 +1,11 @@
#
# EuropaTools
#
# (C) 2021-2022 modeco80 <lily.modeco80@protonmail.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# CMake policy configuration
# Macro to enable new CMake policy.

View File

@ -21,7 +21,7 @@ namespace europa::io {
* Writer for package files.
*/
struct PakWriter {
void Init(structs::PakVersion version);
void Init(structs::PakHeader::Version version);
std::unordered_map<std::string, PakFile>& GetFiles();

View File

@ -1,4 +1,10 @@
#
# EuropaTools
#
# (C) 2021-2022 modeco80 <lily.modeco80@protonmail.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
add_library(libeuropa
# Implementation details
@ -15,10 +21,7 @@ add_library(libeuropa
target_include_directories(libeuropa PUBLIC ${PROJECT_SOURCE_DIR}/include)
set_target_properties(libeuropa PROPERTIES
CXX_STANDARD 20
CXX_STANDARD_REQUIRED ON
)
target_compile_features(libeuropa PUBLIC cxx_std_20)
# Projects which libeuropa depends on
target_link_libraries(libeuropa PUBLIC

View File

@ -17,7 +17,7 @@
namespace europa::io {
void PakWriter::Init(structs::PakVersion version) {
void PakWriter::Init(structs::PakHeader::Version version) {
// for now.
pakHeader.Init(version);
}
@ -87,7 +87,7 @@ namespace europa::io {
// Version 5 paks seem to have an additional bit of reserved data
// (which is all zeros.)
if(pakHeader.version == structs::PakVersion::Ver2) {
if(pakHeader.version == structs::PakHeader::Version::Ver5) {
os.seekp(6, std::ostream::cur);
}

View File

@ -1,3 +1,11 @@
#
# EuropaTools
#
# (C) 2021-2022 modeco80 <lily.modeco80@protonmail.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
add_executable(europa_pack_extractor europa_pack_extractor.cpp)
target_link_libraries(europa_pack_extractor PUBLIC
@ -5,11 +13,6 @@ target_link_libraries(europa_pack_extractor PUBLIC
indicators::indicators
)
set_target_properties(europa_pack_extractor PROPERTIES
CXX_STANDARD 20
CXX_STANDARD_REQUIRED ON
)
add_executable(pakcreate pakcreate.cpp)
target_link_libraries(pakcreate PUBLIC
@ -17,30 +20,14 @@ target_link_libraries(pakcreate PUBLIC
indicators::indicators
)
set_target_properties(pakcreate PROPERTIES
CXX_STANDARD 20
CXX_STANDARD_REQUIRED ON
)
add_executable(texdump texdump.cpp)
target_link_libraries(texdump PUBLIC
libeuropa
)
set_target_properties(texdump PROPERTIES
CXX_STANDARD 20
CXX_STANDARD_REQUIRED ON
)
add_executable(paktest paktest.cpp)
target_link_libraries(paktest PUBLIC
libeuropa
)
set_target_properties(paktest PROPERTIES
CXX_STANDARD 20
CXX_STANDARD_REQUIRED ON
)

View File

@ -32,11 +32,11 @@ int main(int argc, char** argv) {
if(argv[3] != nullptr) {
if(!strcmp(argv[3], "--jedi")) {
std::cout << "Writing Jedi Starfighter archive\n";
writer.Init(structs::PakVersion::Ver2);
writer.Init(structs::PakHeader::Version::Ver5);
}
} else {
std::cout << "Writing Starfighter archive\n";
writer.Init(structs::PakVersion::Starfighter);
writer.Init(structs::PakHeader::Version::Ver4);
}
for(auto& ent : fs::recursive_directory_iterator(argv[1])) {