diff --git a/CMakeLists.txt b/CMakeLists.txt index 358bb9fd0fd49a8d7a4e65518acc8314ef4303ab..d29954b471e9923641c3ac71b27cae26305b9bf5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,9 @@ project(Vivy VERSION 0.1 LANGUAGES CXX) cmake_policy(SET CMP0100 NEW) # Let cmake use moc and uic for .hh files cmake_policy(SET CMP0009 NEW) # Do not follow symlinks with GLOB_RECURSE +# Pass -fPIC +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + # For Qt set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) diff --git a/README.md b/README.md index e4a74754eb1a08f03bdb876755146a853b5e4f78..7f1ab8e160f13557401474e31427e293fef1d57e 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Simply use cmake to build in another folder of the source folder: ``` -cmake -Bbuild -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_COMPILER=clang +cmake -Bbuild -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang ``` If you want to use the `compile_commands.json`, use the diff --git a/src/VivyApplication.cc b/src/VivyApplication.cc index 07e9c6576e32b95bc1715a9c1deeb3df34452554..db7350047f6b4ae9e1e9e8b6050e71d873eac85e 100644 --- a/src/VivyApplication.cc +++ b/src/VivyApplication.cc @@ -1,12 +1,13 @@ #include "VivyApplication.hh" #include "UI/MainWindow.hh" +#include <QtGlobal> #include <QIcon> #include <QFontDatabase> using namespace Vivy; -VivyApplication::VivyApplication(int argc, char **argv) +VivyApplication::VivyApplication(int &argc, char **argv) : QApplication(argc, argv) { } @@ -60,4 +61,7 @@ VivyApplication::getApplicationFont(Font id) const noexcept case Font::Default: return QFont(QFontDatabase::applicationFontFamilies(fontIdRegular).at(0)); } + + // Let the program crash + qFatal("UNREACHABLE"); } diff --git a/src/VivyApplication.hh b/src/VivyApplication.hh index 86c7404115cb3db9bb786e3f69962a3e23f43bc6..cdae52b44d8944f17418d9a8d476b30528a6bf0f 100644 --- a/src/VivyApplication.hh +++ b/src/VivyApplication.hh @@ -43,7 +43,7 @@ private: int fontIdBoldItalic; public: - VivyApplication(int argc, char **argv); + VivyApplication(int &argc, char **argv); ~VivyApplication() = default; int exec() noexcept; diff --git a/vendor/lua-5.4.3/CMakeLists.txt b/vendor/lua-5.4.3/CMakeLists.txt index 8e5865107302aa06e3b5b3a554c516c413272d2a..e4cfda6f5ff442807c3c787958b44d340025d750 100644 --- a/vendor/lua-5.4.3/CMakeLists.txt +++ b/vendor/lua-5.4.3/CMakeLists.txt @@ -5,6 +5,9 @@ if(WIN32) add_definitions(-D_CRT_SECURE_NO_WARNINGS) endif() +# Pass -fPIC +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + file(GLOB Lua_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/*.c") file(GLOB Lua_INC "${CMAKE_CURRENT_SOURCE_DIR}/src/*.h") list(REMOVE_ITEM Lua_SRC "src/lua.c" "src/luac.c") @@ -12,5 +15,9 @@ list(REMOVE_ITEM Lua_SRC "src/lua.c" "src/luac.c") add_library(lua STATIC ${Lua_SRC} ${Lua_INC}) target_include_directories(lua PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src/") +if(UNIX) + target_link_libraries(lua m) +endif() + add_executable(lua-cli src/lua.c) target_link_libraries(lua-cli PRIVATE lua)