Skip to content

Commit b4e83ca

Browse files
committed
attempt to improve throughput and compile times even more
change CMake to stop being such a goddamn fucking menance with the warnings and errors try to get full /W4 clean compliance
1 parent fbf5b48 commit b4e83ca

32 files changed

+1680
-1355
lines changed

CMakeLists.txt

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,6 @@ else()
9595
set(IS_X64 TRUE)
9696
endif()
9797

98-
# # # General project output locations
99-
if (IS_X86 OR CMAKE_SIZEOF_VOID_P EQUAL 4)
100-
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x86/lib")
101-
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x86/bin")
102-
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x86/bin")
103-
else()
104-
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x64/lib")
105-
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x64/bin")
106-
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x64/bin")
107-
endif()
108-
10998

11099
# # # sol2 Source Groups
111100
# # Sources everyone is going to need
@@ -202,6 +191,17 @@ endif()
202191

203192
# # # Tests, Examples and other CI suites that come with sol2
204193
if (DO_TESTS OR DO_EXAMPLES)
194+
# # # General project output locations
195+
if (IS_X86 OR CMAKE_SIZEOF_VOID_P EQUAL 4)
196+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x86/lib")
197+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x86/bin")
198+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x86/bin")
199+
else()
200+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x64/lib")
201+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x64/bin")
202+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x64/bin")
203+
endif()
204+
205205
# # # Libraries
206206
# Here, we pull in all the necessary libraries for building examples and tests
207207
# Find threading library
@@ -214,6 +214,9 @@ if (DO_TESTS OR DO_EXAMPLES)
214214
endif()
215215
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
216216
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
217+
else()
218+
string(REGEX REPLACE "/W[0-4]" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
219+
string(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
217220
endif()
218221
find_package(Threads REQUIRED)
219222

cmake/Modules/FindLuaBuild/LuaVanilla.cmake

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ endif()
165165

166166
# # Potential compiler variables
167167
if (MSVC)
168-
set(LUA_VANILLA_LUA_LUAC_COMPILER_OPTIONS "/W1")
169168
if (BUILD_LUA_AS_DLL)
170169
set(LUA_VANILLA_DLL_DEFINE LUA_BUILD_AS_DLL)
171170
else()
@@ -378,8 +377,6 @@ else()
378377
target_compile_definitions(${luainterpreter}
379378
PRIVATE LUA_USE_LINUX)
380379
endif()
381-
target_compile_options(${luainterpreter}
382-
PRIVATE ${LUA_VANILLA_LUA_LUAC_COMPILER_OPTIONS})
383380
target_link_libraries(${luainterpreter} PRIVATE ${liblua})
384381
if (CMAKE_DL_LIBS)
385382
target_link_libraries(${luainterpreter} PRIVATE ${CMAKE_DL_LIBS})
@@ -403,8 +400,6 @@ set_target_properties(${luacompiler}
403400
OUTPUT_NAME luac-${LUA_VANILLA_VERSION})
404401
target_include_directories(${luacompiler}
405402
PRIVATE "${LUA_VANILLA_INCLUDE_DIRS}")
406-
target_compile_options(${luacompiler}
407-
PRIVATE ${LUA_VANILLA_LUA_LUAC_COMPILER_OPTIONS})
408403
target_compile_definitions(${luacompiler}
409404
PUBLIC LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE}
410405
PRIVATE LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE})

cmake/Modules/FindLuaJIT.cmake

Lines changed: 0 additions & 173 deletions
This file was deleted.

examples/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ function (MAKE_EXAMPLE example_source_file example_suffix target_sol)
8585
else()
8686
target_compile_options(${example_name}
8787
PRIVATE -std=c++1z
88-
-Wno-noexcept-type -Wno-unknown-warning -Wno-unknown-warning-option
89-
-Wall -Wextra -Wpedantic -pedantic -pedantic-errors)
88+
-Wall -Wpendatic -Werror -pedantic -pedantic-errors
89+
-Wno-noexcept-type
90+
-Wno-unknown-warning -Wno-unknown-warning-option)
9091
endif()
9192

9293
target_link_libraries(${example_name}

examples/interop/LuaBridge/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ function (make_luabridge_interop_example target_library example_suffix)
4646
else()
4747
target_compile_options(${example_name}
4848
PRIVATE -std=c++1z -w
49-
-Wno-noexcept-type -Wno-unknown-warning -Wno-unknown-warning-option
50-
-Wall -Wextra -Wpedantic -pedantic -pedantic-errors)
49+
-Wno-unknown-warning -Wno-unknown-warning-option)
5150
endif()
5251

5352
if (CMAKE_DL_LIBS)

examples/interop/kaguya/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ function (make_kaguya_interop_example target_library example_suffix)
4444
_CRT_SECURE_NO_WARNINGS _CRT_SECURE_NO_DEPRECATE)
4545
else()
4646
target_compile_options(${example_name}
47-
PRIVATE -std=c++1z -w
48-
-Wno-noexcept-type -Wno-unknown-warning -Wno-unknown-warning-option
49-
-Wall -Wextra -Wpedantic -pedantic -pedantic-errors)
47+
PRIVATE -std=c++1z -w
48+
-Wno-unknown-warning -Wno-unknown-warning-option)
5049
endif()
5150

5251
if (CMAKE_DL_LIBS)

examples/interop/luwra/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ function (make_luwra_interop_example target_library example_suffix)
4545
else()
4646
target_compile_options(${example_name}
4747
PRIVATE -std=c++1z -w
48-
-Wno-noexcept-type -Wno-unknown-warning -Wno-unknown-warning-option
49-
-Wall -Wextra -Wpedantic -pedantic -pedantic-errors)
48+
-Wno-unknown-warning -Wno-unknown-warning-option)
5049
endif()
5150

5251
if (CMAKE_DL_LIBS)

examples/interop/tolua/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ function(make_tolua_interop_example target_library example_suffix)
4545
else()
4646
target_compile_options(${example_name}
4747
PRIVATE -std=c++1z -w
48-
-Wno-noexcept-type -Wno-unknown-warning -Wno-unknown-warning-option
49-
-Wall -Wextra -Wpedantic -pedantic -pedantic-errors)
48+
-Wno-unknown-warning -Wno-unknown-warning-option)
5049
endif()
5150

5251
if (CMAKE_DL_LIBS)

examples/require_dll_example/CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ function(make_require_from_dll_example target_lib example_lib_name_suffix)
6262
else()
6363
target_compile_options(${example_lib_name}
6464
PRIVATE -std=c++1z
65-
-Wno-noexcept-type -Wno-unknown-warning -Wno-unknown-warning-option
66-
-Wall -Wextra -Wpedantic -pedantic -pedantic-errors)
65+
-Wall -Wextra -Wpedantic -pedantic -pedantic-errors
66+
-Wno-noexcept-type
67+
-Wno-unknown-warning -Wno-unknown-warning-option)
6768
if (IS_X86)
6869
target_compile_options(${example_lib_name} BEFORE PRIVATE -m32)
6970
endif()
@@ -92,8 +93,9 @@ function(make_require_from_dll_example target_lib example_lib_name_suffix)
9293
else()
9394
target_compile_options(${example_name}
9495
PRIVATE -std=c++1z
95-
-Wno-noexcept-type -Wno-unknown-warning -Wno-unknown-warning-option
96-
-Wall -Wextra -Wpedantic -pedantic -pedantic-errors)
96+
-Wall -Wextra -Wpedantic -pedantic -pedantic-errors
97+
-Wno-noexcept-type
98+
-Wno-unknown-warning -Wno-unknown-warning-option)
9799
endif()
98100

99101
if(CMAKE_DL_LIBS)

include/sol/bind_traits.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ namespace meta {
507507

508508
template <typename R, typename T>
509509
struct callable_traits<R(T::*), true> {
510-
typedef std::conditional_t<std::is_array<R>::value, std::add_lvalue_reference_t<T>, R> return_type;
510+
typedef std::conditional_t<std::is_array_v<R>, std::add_lvalue_reference_t<R>, R> return_type;
511511
typedef return_type Arg;
512512
typedef T object_type;
513513
using signature_type = R(T::*);

0 commit comments

Comments
 (0)