@@ -48,7 +48,7 @@ message("Initial BASISU_SAN=${BASISU_SAN}")
4848message ("initial BASISU_TOOL=${BASISU_TOOL} " )
4949message ("initial BASISU_EXAMPLES=${BASISU_EXAMPLES} " )
5050
51- if (WIN32 AND MINGW)
51+ if (MINGW)
5252 # Check if the Threads package is provided; if using Mingw it MIGHT be
5353 find_package (Threads)
5454elseif (LINUX)
8989endif ()
9090
9191if (NOT MSVC )
92- add_compile_options (-g)
92+ add_compile_options ($<$<CONFIG:Debug>:-g>)
93+ # If you want to set an optimization option for non-debug too, use this instead.
94+ #add_compile_options($<IF:$<CONFIG:Debug>,-g,-O3>)
9395
9496 if (BASISU_SAN)
9597 message ("Enabling SAN" )
@@ -98,7 +100,7 @@ if (NOT MSVC)
98100 endif ()
99101
100102 # Add common non-MSVC flags excluding -fPIC.
101- add_compile_options (-fvisibility=hidden -fPIC - fno-strict-aliasing -D_LARGEFILE64_SOURCE=1
103+ add_compile_options (-fvisibility=hidden -fno-strict-aliasing -D_LARGEFILE64_SOURCE=1
102104 -D_FILE_OFFSET_BITS=64 -Wall -Wextra -Wno-unused-local-typedefs
103105 -Wno-unused-value -Wno-unused-parameter -Wno-unused-variable
104106 -Wno-misleading-indentation
@@ -224,12 +226,12 @@ if (NOT MSVC)
224226 if (BASISU_OPENCL AND OPENCL_FOUND)
225227 target_compile_definitions (basisu_encoder PRIVATE BASISU_SUPPORT_OPENCL=1)
226228
227- target_include_directories (basisu_encoder INTERFACE ${OpenCL_INCLUDE_DIRS} )
229+ target_include_directories (basisu_encoder INTERFACE ${OpenCL_INCLUDE_DIRS} )
228230 target_link_libraries (basisu_encoder INTERFACE ${OpenCL_LIBRARIES} )
229231 endif ()
230232 # Only link 'm' on non-Windows platforms (Linux, macOS)
231233 if (NOT WIN32 )
232- target_link_libraries (basisu_encoder INTERFACE m)
234+ target_link_libraries (basisu_encoder INTERFACE m)
233235 endif ()
234236 if (Threads_FOUND AND CMAKE_USE_PTHREADS_INIT)
235237 target_link_libraries (basisu_encoder INTERFACE Threads::Threads)
@@ -243,15 +245,15 @@ else()
243245 # For Windows builds, we use our local copies of the OpenCL import lib and Khronos headers.
244246 if (BASISU_OPENCL)
245247 target_compile_definitions (basisu_encoder PRIVATE BASISU_SUPPORT_OPENCL=1)
246- target_include_directories (basisu_encoder INTERFACE "OpenCL" )
248+ target_include_directories (basisu_encoder INTERFACE "OpenCL" )
247249
248250 if (BASISU_BUILD_X64)
249251 target_link_libraries (basisu_encoder INTERFACE "${CMAKE_CURRENT_SOURCE_DIR} /OpenCL/lib/OpenCL64.lib" )
250252 else ()
251253 target_link_libraries (basisu_encoder INTERFACE "${CMAKE_CURRENT_SOURCE_DIR} /OpenCL/lib/OpenCL.lib" )
252254 endif ()
253255 endif ()
254- endif ()
256+ endif ()
255257
256258macro (set_common_executable_properties target )
257259 #if (MSVC)
@@ -280,10 +282,10 @@ if (BASISU_TOOL AND NOT EMSCRIPTEN)
280282 if (CMAKE_BUILD_TYPE STREQUAL Release)
281283 if (APPLE )
282284 add_custom_command (TARGET basisu POST_BUILD COMMAND strip -X -x ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} /basisu)
283- #message("strip command: strip -X -x ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/basisu")
285+ #message("strip command: strip -X -x ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/basisu")
284286 else ()
285287 add_custom_command (TARGET basisu POST_BUILD COMMAND strip -g -X -x ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} /basisu)
286- #message("strip command: strip -g -X -x ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/basisu")
288+ #message("strip command: strip -g -X -x ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/basisu")
287289 endif ()
288290 endif ()
289291 endif ()
0 commit comments