fix system and warnings

v1
Brett 2024-04-25 19:35:05 -04:00
parent c6a54f5106
commit 1772e9a6d7
3 changed files with 39 additions and 25 deletions

View File

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.20) cmake_minimum_required(VERSION 3.20)
include(cmake/color.cmake) include(cmake/color.cmake)
set(BLT_VERSION 0.16.10) set(BLT_VERSION 0.16.11)
set(BLT_TEST_VERSION 0.0.1) set(BLT_TEST_VERSION 0.0.1)
set(BLT_TARGET BLT) set(BLT_TARGET BLT)
@ -38,28 +38,28 @@ configure_file(include/blt/config.h.in config/blt/config.h @ONLY)
message("Enabling library compilation") message("Enabling library compilation")
if (${BUILD_STD} OR ${BUILD_PROFILING}) if (${BUILD_STD} OR ${BUILD_PROFILING})
message("-- Building ${Yellow}standard${ColourReset} cxx files") message(STATUS "Building ${Yellow}standard${ColourReset} cxx files")
file(GLOB_RECURSE STD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/blt/std/*.cpp") file(GLOB_RECURSE STD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/blt/std/*.cpp")
else () else ()
set(STD_FILES "") set(STD_FILES "")
endif () endif ()
if (${BUILD_PROFILING}) if (${BUILD_PROFILING})
message("-- Building ${Yellow}profiling${ColourReset} cxx files") message(STATUS "Building ${Yellow}profiling${ColourReset} cxx files")
file(GLOB_RECURSE PROFILING_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/blt/profiling/*.cpp") file(GLOB_RECURSE PROFILING_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/blt/profiling/*.cpp")
else () else ()
set(PROFILING_FILES "") set(PROFILING_FILES "")
endif () endif ()
if (${BUILD_FS}) if (${BUILD_FS})
message("-- Building ${Yellow}filesystem${ColourReset} cxx files") message(STATUS "Building ${Yellow}filesystem${ColourReset} cxx files")
file(GLOB_RECURSE FS_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/blt/fs/*.cpp") file(GLOB_RECURSE FS_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/blt/fs/*.cpp")
else () else ()
set(FS_FILES "") set(FS_FILES "")
endif () endif ()
if (${BUILD_PARSE}) if (${BUILD_PARSE})
message("-- Building ${Yellow}parser${ColourReset} cxx files") message(STATUS "Building ${Yellow}parser${ColourReset} cxx files")
file(GLOB_RECURSE PARSE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/blt/parse/*.cpp") file(GLOB_RECURSE PARSE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/blt/parse/*.cpp")
else () else ()
set(PARSE_FILES "") set(PARSE_FILES "")
@ -84,17 +84,23 @@ endif ()
include_directories(include/) include_directories(include/)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/config/) include_directories(${CMAKE_CURRENT_BINARY_DIR}/config/)
message("Standard Files ${STD_FILES}") add_library(${BLT_TARGET} ${STD_FILES} ${PROFILING_FILES} ${FS_FILES} ${PARSE_FILES})
message("Profiler Files ${PROFILING_FILES}")
message("FS Files ${FS_FILES}") string(REPLACE "+" "\\+" escaped_source ${CMAKE_CURRENT_SOURCE_DIR})
message("Parser Files ${PARSE_FILES}") string(APPEND escaped_source "/src/blt/.*/")
list(TRANSFORM STD_FILES REPLACE ${escaped_source} "")
list(TRANSFORM PROFILING_FILES REPLACE ${escaped_source} "")
list(TRANSFORM FS_FILES REPLACE ${escaped_source} "")
list(TRANSFORM PARSE_FILES REPLACE ${escaped_source} "")
message("Standard Files ${Magenta}${STD_FILES}${ColourReset}")
message("Profiler Files ${Magenta}${PROFILING_FILES}${ColourReset}")
message("FS Files ${Magenta}${FS_FILES}${ColourReset}")
message("Parser Files ${Magenta}${PARSE_FILES}${ColourReset}")
message("Source: ${CMAKE_SOURCE_DIR}") message("Source: ${CMAKE_SOURCE_DIR}")
message("Current Source: ${CMAKE_CURRENT_SOURCE_DIR}") message("Current Source: ${CMAKE_CURRENT_SOURCE_DIR}")
message("Binary: ${CMAKE_BINARY_DIR}") message("Binary: ${CMAKE_BINARY_DIR}")
message("Current Binary: ${CMAKE_CURRENT_BINARY_DIR}") message("Current Binary: ${CMAKE_CURRENT_BINARY_DIR}")
add_library(${BLT_TARGET} ${STD_FILES} ${PROFILING_FILES} ${FS_FILES} ${PARSE_FILES})
if (${ZLIB_FOUND}) if (${ZLIB_FOUND})
target_link_libraries(${BLT_TARGET} PUBLIC ZLIB::ZLIB) target_link_libraries(${BLT_TARGET} PUBLIC ZLIB::ZLIB)
endif () endif ()

View File

@ -1,19 +1,26 @@
include(cmake/color.cmake) if(NOT WIN32)
message("Enabling platform specific compile options for ${PROJECT_NAME}") string(ASCII 27 Esc)
set(ColourReset "${Esc}[m")
set(Blue "${Esc}[34m")
set(Green "${Esc}[32m")
endif ()
message("Enabling platform specific compile options for ${Blue}${PROJECT_NAME}${ColourReset}")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# using Clang # using Clang
message("-- Clang Compile: ${Green}-Wall -Wextra -Wpedantic -Weverything -fdiagnostics-color=always${ColourReset}") message(STATUS "Clang Compile: ${Green}-Wall -Wextra -Wpedantic -Weverything -fdiagnostics-color=always${ColourReset}")
message("-- Clang Link: ${Green}-export_dynamic${ColourReset}") message(STATUS "Clang Link: ${Green}-export_dynamic${ColourReset}")
message("-- Clang libs: ${Green}stdc++fs${ColourReset}") message(STATUS "Clang libs: ${Green}stdc++fs${ColourReset}")
target_compile_options(${PROJECT_NAME} PUBLIC -Wall -Wextra -Wpedantic -Weverything -fdiagnostics-color=always) target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -fdiagnostics-color=always)
target_link_options(${PROJECT_NAME} PUBLIC -export_dynamic) target_link_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -fdiagnostics-color=always)
target_link_options(${PROJECT_NAME} PUBLIC -export_dynamic -rdynamic)
target_link_libraries(${PROJECT_NAME} PUBLIC stdc++fs) target_link_libraries(${PROJECT_NAME} PUBLIC stdc++fs)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# using GCC # using GCC
message("-- GCC Compile: ${Green}-Wall -Wextra -Wpedantic -fdiagnostics-color=always${ColourReset}") message(STATUS "GCC Compile: ${Green}-Wall -Wextra -Wpedantic -fdiagnostics-color=always${ColourReset}")
message("-- GCC Link: ${Green}-rdynamic${ColourReset}") message(STATUS "GCC Link: ${Green}-rdynamic${ColourReset}")
message("-- GCC libs: ${Green}stdc++fs${ColourReset}") message(STATUS "GCC libs: ${Green}stdc++fs${ColourReset}")
target_compile_options(${PROJECT_NAME} PUBLIC -Wall -Wextra -Wpedantic -fdiagnostics-color=always) target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -fdiagnostics-color=always)
target_link_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -fdiagnostics-color=always)
target_link_options(${PROJECT_NAME} PUBLIC -rdynamic) target_link_options(${PROJECT_NAME} PUBLIC -rdynamic)
target_link_libraries(${PROJECT_NAME} PUBLIC stdc++fs) target_link_libraries(${PROJECT_NAME} PUBLIC stdc++fs)
include(GNUInstallDirs) include(GNUInstallDirs)
@ -21,8 +28,8 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
# using Intel C++ # using Intel C++
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# using Visual Studio C++ # using Visual Studio C++
message("-- MSVC Compile: ${Green}/Wall${ColourReset}") message(STATUS "MSVC Compile: ${Green}/Wall${ColourReset}")
message("-- MSVC Link: ${Green}${ColourReset}") message(STATUS "MSVC Link: ${Green}${ColourReset}")
message("-- MSVC libs: ${Green}${ColourReset}") message(STATUS "MSVC libs: ${Green}${ColourReset}")
target_compile_options(${PROJECT_NAME} PUBLIC /Wall) target_compile_options(${PROJECT_NAME} PUBLIC /Wall)
endif () endif ()

View File

@ -17,6 +17,7 @@
#endif #endif
#else #else
#include <chrono> #include <chrono>
using suseconds_t = int;
#endif #endif
#include <cstdint> #include <cstdint>