Added a Defines File

This commit is contained in:
Aaron Helton
2020-01-16 22:31:24 -05:00
parent 14c83c758e
commit 18fa141b7e
4 changed files with 33 additions and 14 deletions

View File

@@ -6,27 +6,25 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(SOURCES src/main.cpp include/Database.hpp src/Database.cpp)
set(SOURCES src/main.cpp include/Database.hpp src/Database.cpp include/Defines.hpp)
add_executable(JLMG ${SOURCES})
if (CMAKE_CXX_COMPILER_ID STREQUAL Clang OR CMAKE_CXX_COMPILER_ID STREQUAL GNU)
target_compile_options(JLMG PRIVATE
-Wall -Werror -Wextra -pedantic-errors -Wcast-align -Wcast-qual
-Wdisabled-optimization -Wformat=2 -Wlogical-op
-Wmissing-declarations -Wmissing-include-dirs -Wredundant-decls
-Wshadow -Wstrict-overflow=5 -Wswitch-default -Wundef -Wno-unused
-Wpadded -Wno-error=padded)
#if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(JLMG PRIVATE
-Wall -Werror -Wextra -pedantic-errors -Wcast-align -Wcast-qual
-Wdisabled-optimization -Wformat=2 -Wlogical-op
-Wmissing-declarations -Wmissing-include-dirs -Wredundant-decls
-Wshadow -Wstrict-overflow=5 -Wswitch-default -Wundef -Wno-unused
-Wpadded -Wno-error=padded)
#elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
#elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
#endif()
elseif (CMAKE_CXX_COMPILER_ID STREQUAL Intel)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL MSVC)
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
endif()
endif()
find_package(SDL2 REQUIRED)
find_package(SQLite3 REQUIRED)
@@ -35,10 +33,12 @@ target_include_directories(JLMG PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(JLMG PRIVATE ${SQLite3_INCLUDE_DIRS})
target_include_directories(JLMG PRIVATE ${SDL2_INCLUDE_DIR})
target_link_libraries(JLMG PRIVATE stdc++)
target_link_libraries(JLMG PRIVATE ${SQLite3_LIBRARIES})
target_link_libraries(JLMG PRIVATE ${SDL2_LIBRARY})
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_link_libraries(JLMG PRIVATE stdc++)
endif()
# We need to copy the default word database to the executable directory after building
add_custom_command(TARGET JLMG POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy

View File

@@ -82,7 +82,7 @@ SET(SDL2_SEARCH_PATHS
FIND_PATH(SDL2_INCLUDE_DIR SDL.h
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES include/SDL2 ../include
PATH_SUFFIXES include/SDL2 ../include include/
PATHS ${SDL2_SEARCH_PATHS}
)

19
include/Defines.hpp Normal file
View File

@@ -0,0 +1,19 @@
//
// Created by Aaron Helton on 1/16/2020.
//
#ifndef JLMG_DEFINES_HPP
#define JLMG_DEFINES_HPP
#include <cstdint>
typedef uint_least8_t uint8;
typedef uint_least16_t uint16;
typedef uint_least32_t uint32;
typedef uint_least64_t uint64;
typedef int_least8_t int8;
typedef int_least16_t int16;
typedef int_least32_t int32;
typedef int_least64_t int64;
#endif //JLMG_DEFINES_HPP

BIN
lib/SDL2.dll Normal file

Binary file not shown.