vcpkg/ports/clrng/001-build-fixup.patch

125 lines
4.5 KiB
Diff
Raw Normal View History

2020-12-17 09:18:20 +01:00
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 65f51db..f010bb8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -31,7 +31,7 @@
# ########################################################################
-cmake_minimum_required( VERSION 2.8.10 )
+cmake_minimum_required( VERSION 3.0 )
if( CMAKE_GENERATOR MATCHES "NMake" )
option( NMAKE_COMPILE_VERBOSE "Print compile and link strings to the console" OFF )
@@ -127,7 +127,6 @@ if( BUILD64 )
set_property( GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE )
message( STATUS "64bit build - FIND_LIBRARY_USE_LIB64_PATHS TRUE" )
- set( SUFFIX_LIB_DEFAULT "64" )
else( )
set_property( GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE )
message( STATUS "32bit build - FIND_LIBRARY_USE_LIB64_PATHS FALSE" )
@@ -161,7 +160,8 @@ set( SUFFIX_BIN ${SUFFIX_BIN_DEFAULT} CACHE STRING "String to append to 'bin' in
#endif( )
# This will define OPENCL_FOUND
-find_package( OpenCL )
+find_package( OpenCL REQUIRED )
+find_package( Threads REQUIRED )
if( (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_LESS 2.8) )
message( STATUS "Cmake version 2.8 or greater needed to use GTest" )
@@ -170,7 +170,7 @@ else()
find_package( GTest )
# Hack to get googletest v1.6 to work with vs2012
- if( MSVC11 )
+ if( 0 )
add_definitions( "/D_VARIADIC_MAX=10" )
endif( )
endif()
@@ -196,7 +196,7 @@ get_filename_component( C_COMPILER_NAME ${CMAKE_C_COMPILER} NAME_WE )
# message( "CMAKE_C_COMPILER: " ${CMAKE_C_COMPILER} )
# Set common compile and link options
-if( MSVC )
+if( 0 )
# Following options for nMake
message( STATUS "Detected MSVS Ver: " ${MSVC_VERSION} )
@@ -206,6 +206,7 @@ if( MSVC )
string( REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}" )
elseif( CMAKE_COMPILER_IS_GNUCXX )
+ if( 0 )
message( STATUS "Detected GNU fortran compiler." )
EXEC_PROGRAM( ${CMAKE_CXX_COMPILER} ARGS --version OUTPUT_VARIABLE vnum )
STRING(REGEX REPLACE ".*([0-9])\\.([0-9])\\.([0-9]).*" "\\1\\2\\3" vnum ${vnum})
@@ -216,6 +217,7 @@ elseif( CMAKE_COMPILER_IS_GNUCXX )
set( CMAKE_CXX_FLAGS "-pthread ${CMAKE_CXX_FLAGS}" )
set( CMAKE_C_FLAGS "-std=c11 -Wall -pedantic-errors -pthread ${CMAKE_C_FLAGS}" )
+ endif()
if( BUILD64 )
set( CMAKE_CXX_FLAGS "-m64 ${CMAKE_CXX_FLAGS}" )
diff --git a/src/library/CMakeLists.txt b/src/library/CMakeLists.txt
index dbe479d..8717e58 100644
--- a/src/library/CMakeLists.txt
+++ b/src/library/CMakeLists.txt
@@ -62,8 +62,6 @@ set( clRNG.Headers private.h
set( clRNG.Files ${clRNG.Source} ${clRNG.Headers} )
-# Include standard OpenCL headers
-include_directories( ${OPENCL_INCLUDE_DIRS} ${PROJECT_BINARY_DIR}/include ../include )
if(BUILD_SHARED_LIBRARY)
add_library( clRNG SHARED ${clRNG.Files} )
@@ -72,6 +70,15 @@ else()
endif()
target_link_libraries( clRNG ${OPENCL_LIBRARIES} )
+target_link_libraries( clRNG PUBLIC
+ OpenCL::OpenCL
+ Threads::Threads
+)
+target_include_directories( clRNG PUBLIC
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
+ $<INSTALL_INTERFACE:include>
+)
+
set_target_properties( clRNG PROPERTIES VERSION ${CLRNG_VERSION} )
set_target_properties( clRNG PROPERTIES SOVERSION ${CLRNG_SOVERSION} )
set_target_properties( clRNG PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging" )
@@ -89,7 +96,7 @@ install( TARGETS clRNG
EXPORT clRNG-Targets
RUNTIME DESTINATION bin${SUFFIX_BIN}
LIBRARY DESTINATION lib${SUFFIX_LIB}
- ARCHIVE DESTINATION lib${SUFFIX_LIB}/import
+ ARCHIVE DESTINATION lib${SUFFIX_LIB}
)
# CMake config files for clRNG
@@ -139,9 +146,9 @@ endif( )
include( InstallRequiredSystemLibraries )
# Install necessary runtime files for debug builds
-install( PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
- CONFIGURATIONS Debug
- DESTINATION ${CLRNG_RUNTIME_DESTINATION} )
+#install( PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
+# CONFIGURATIONS Debug
+# DESTINATION ${CLRNG_RUNTIME_DESTINATION} )
# Install all *.pdb files for debug builds
install( DIRECTORY ${PROJECT_BINARY_DIR}/staging/
@@ -152,6 +159,6 @@ install( DIRECTORY ${PROJECT_BINARY_DIR}/staging/
# Install a snapshot of the source as it was for this build; useful for the .pdb's
install( DIRECTORY ${PROJECT_SOURCE_DIR}
- DESTINATION ${CLRNG_RUNTIME_DESTINATION}
+ DESTINATION "."
OPTIONAL
CONFIGURATIONS Debug )