Skip to content

Commit

Permalink
Explicitly set and check c++11 compiler support
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatisko committed Jul 26, 2021
1 parent 334323b commit a4ad4aa
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
2 changes: 2 additions & 0 deletions recipes/libbasisu/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ def validate(self):
def configure(self):
if self.options.shared:
del self.options.fPIC
if self.settings.compiler.get_safe("cppstd"):
tools.check_min_cppstd(self, 11)

def source(self):
tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder)
Expand Down
31 changes: 18 additions & 13 deletions recipes/libbasisu/all/patches/cmakelist_build_lib.patch
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@

set(CMAKE_CXX_FLAGS -std=c++11)
- set(GCC_COMPILE_FLAGS "-fvisibility=hidden -fPIC -fno-strict-aliasing -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -Wall -Wextra -Wno-unused-local-typedefs -Wno-unused-value -Wno-unused-parameter -Wno-unused-variable")
-
+ set(GCC_COMPILE_FLAGS "-fPIC -fno-strict-aliasing -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -Wall -Wextra -Wno-unused-local-typedefs -Wno-unused-value -Wno-unused-parameter -Wno-unused-variable")

- if (NOT BUILD_X64)
- set(GCC_COMPILE_FLAGS "${GCC_COMPILE_FLAGS} -m32")
- endif()
-
- if (EMSCRIPTEN)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -DBASISU_SUPPORT_SSE=0")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -DBASISU_SUPPORT_SSE=0")
+ set(GCC_COMPILE_FLAGS "-fPIC -fno-strict-aliasing -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -Wall -Wextra -Wno-unused-local-typedefs -Wno-unused-value -Wno-unused-parameter -Wno-unused-variable")

-
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_LINK_FLAGS}")
- elseif (STATIC)
- if (SSE)
Expand Down Expand Up @@ -97,7 +97,7 @@
encoder/basisu_backend.cpp
encoder/basisu_basis_file.cpp
encoder/basisu_comp.cpp
@@ -115,42 +101,24 @@ set(BASISU_SRC_LIST ${COMMON_SRC_LIST}
@@ -115,42 +101,30 @@ set(BASISU_SRC_LIST ${COMMON_SRC_LIST}
encoder/jpgd.cpp
encoder/basisu_kernels_sse.cpp
transcoder/basisu_transcoder.cpp
Expand Down Expand Up @@ -129,8 +129,14 @@

-if (NOT MSVC)
- target_link_libraries(basisu m pthread)
-endif()
-
+if (WIN32)
+ set_target_properties(${PROJECT_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
+else()
+ set(THREADS_PREFER_PTHREAD_FLAG ON)
+ find_package(Threads REQUIRED)
+ target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads m)
endif()

-if (NOT EMSCRIPTEN)
- install(TARGETS basisu DESTINATION bin)
-
Expand All @@ -143,10 +149,9 @@
- endif()
- endif()
- endif()
+if (WIN32)
+ set_target_properties(${PROJECT_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
+else()
+ set(THREADS_PREFER_PTHREAD_FLAG ON)
+ find_package(Threads REQUIRED)
+ target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads m)
endif()
-endif()
+set_target_properties(${PROJECT_NAME} PROPERTIES
+ CXX_STANDARD 11
+ CXX_STANDARD_REQUIRED ON
+ CXX_EXTENSIONS NO
+)
1 change: 1 addition & 0 deletions recipes/libbasisu/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::libbasisu)
set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS NO
)

0 comments on commit a4ad4aa

Please sign in to comment.