Skip to content

Commit

Permalink
Update CMakeLists.txt
Browse files Browse the repository at this point in the history
Get rid of the narrowing conversion warning
Handle signals only if they are supported by OS
  • Loading branch information
DolphyWind committed Feb 22, 2023
1 parent 355d102 commit 2c11ab6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
12 changes: 9 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ set(CMAKE_CXX_STANDARD 20)
project(ElectraLang VERSION 1.0.0)

file(GLOB SOURCE_FILES "./src/*.cpp")
add_executable(electra ${SOURCE_FILES})
if(WIN32)
add_executable(electra WIN32 ${SOURCE_FILES})
else()
add_executable(electra ${SOURCE_FILES})
endif()

target_include_directories(electra PRIVATE include)
install(TARGETS electra DESTINATION bin)
target_include_directories(electra PUBLIC include)
if(NOT WIN32)
install(TARGETS electra DESTINATION bin)
endif()
14 changes: 12 additions & 2 deletions src/Electra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,21 @@ Electra::Electra(int argc, char* argv[])
for(auto &p : m_generatorDataMap)
m_generatorChars.push_back(p.first);

#ifdef SIGTERM
signal(SIGTERM, &Electra::sigHandler);
#endif
#ifdef SIGINT
signal(SIGINT, &Electra::sigHandler);
signal(SIGQUIT, &Electra::sigHandler);
#endif
#ifdef SIGQUIT
signal(SIGQUIT, &Electra::sigHandler);
#endif
#ifdef SIGKILL
signal(SIGKILL, &Electra::sigHandler);
#endif
#ifdef SIGHUP
signal(SIGHUP, &Electra::sigHandler);
#endif
}

Electra::~Electra()
Expand Down Expand Up @@ -234,7 +244,7 @@ void Electra::createPortals()
{
if(!m_portalMap.contains(currentChar))
{
m_portalMap[currentChar] = {x, y};
m_portalMap[currentChar] = {(int)x, (int)y};
}
}

Expand Down

0 comments on commit 2c11ab6

Please sign in to comment.