Skip to content

Commit

Permalink
Fix compile not on GCC
Browse files Browse the repository at this point in the history
  • Loading branch information
h3x4n1um committed Feb 5, 2021
1 parent 5e95ed8 commit 8d295f3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 15 deletions.
15 changes: 2 additions & 13 deletions rton-json/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,14 @@ set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os")

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS}\
-Os\
-Wall -Wextra -Werror -pedantic\
-static\
-s")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS}\
-W4 -WX\
-MT")
endif()

include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
Expand All @@ -35,13 +30,7 @@ endif()
set(JSON_BuildTests OFF CACHE INTERNAL "")

# require fifo_map
find_package(nlohmann-fifo-map QUIET)
if (nlohmann-fifo-map_FOUND)
message(STATUS "FOUND nlohmann-fifo-map ${nlohmann-fifo-map_VERSION}")
else()
add_subdirectory(third_party/fifo_map)
message(STATUS "Using external nlohmann-fifo-map")
endif()
add_subdirectory(third_party/fifo_map)

set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
add_executable(rton-json ${SOURCES})
Expand Down
2 changes: 1 addition & 1 deletion rton-json/include/rton-json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "include/json_fifo.hpp"

const std::string architecture = std::to_string(uint16_t(log2(INTPTR_MAX))+1) + "-bit";
const std::string architecture = std::to_string(uint16_t(round(log2(UINTPTR_MAX)))) + "-bit";
const std::string ver = "3.1.0";

std::string to_hex_string(const uint64_t &q);
Expand Down
1 change: 1 addition & 0 deletions rton-json/src/json2rton.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "include/json2rton.hpp"

#include <sstream>
#include <regex>

#include "include/error.hpp"
Expand Down
2 changes: 1 addition & 1 deletion rton-json/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ int main(const int argc, const char *argv[]){
std::cout << std::endl
<< "rton-json made by H3x4n1um" << std::endl
<< std::endl
<< "Version: " << ver << " " << architecture << " executable" << std::endl
<< "Version: " << ver << " " << architecture << std::endl
<< "Compiled on " << __DATE__ << " at " << __TIME__ << std::endl
<< "Credits: nlohmann for his awesome JSON parser and fifo_map" << std::endl
<< std::endl;
Expand Down

0 comments on commit 8d295f3

Please sign in to comment.