Allow proper compiling of libjpeg for windows.
This expands on #777 to work with jconfig.h properly. To facilitate these operations, a new macro was added for doing compile tests. Note that this commit does NOT bring in the other files associated with this version of libjpeg. At some point, it would be desirable to automatically get the files as part of the cmake configuration step, similar to ffmpeg.
This commit is contained in:
@@ -56,3 +56,29 @@ function(disable_project_warnings projectName)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
macro(check_compile_features BIN_DIR SOURCE_FILE GREETER GREET_SUCCESS GREET_FAILURE TARGET_VAR ON_SUCCESS)
|
||||
if(NOT DEFINED "${TARGET_VAR}")
|
||||
message(STATUS "${GREETER}")
|
||||
try_compile(${TARGET_VAR} "${BIN_DIR}"
|
||||
SOURCES "${SOURCE_FILE}"
|
||||
)
|
||||
if(${TARGET_VAR})
|
||||
if (${ON_SUCCESS})
|
||||
message(STATUS "${GREETER} - ${GREET_SUCCESS}")
|
||||
set(${TARGET_VAR} 1 CACHE INTERNAL "${GREETER}")
|
||||
else()
|
||||
message(STATUS "${GREETER} - ${GREET_FAILURE}")
|
||||
set(${TARGET_VAR} "" CACHE INTERNAL "${GREETER}")
|
||||
endif()
|
||||
else()
|
||||
if(${ON_SUCCESS})
|
||||
message(STATUS "${GREETER} - ${GREET_FAILURE}")
|
||||
set(${TARGET_VAR} 1 CACHE INTERNAL "${GREETER}")
|
||||
else()
|
||||
message(STATUS "${GREETER} - ${GREET_SUCCESS}")
|
||||
set(${TARGET_VAR} "" CACHE INTERNAL "${GREETER}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
/* Borrowed from libjpeg. */
|
||||
typedef struct undefined_structure * undef_struct_ptr;
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int very_long_name_here_one() { return 0; }
|
||||
int very_long_name_here_two() { return 1; }
|
||||
|
||||
int main() {
|
||||
printf("%d\n", very_long_name_here_one());
|
||||
printf("%d\n", very_long_name_here_two());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/* Borrowed from Wikipedia: Function prototype page. */
|
||||
#include <stdio.h>
|
||||
|
||||
int myfunction(int n);
|
||||
|
||||
int main(void) {
|
||||
printf("%d\n", myfunction()); /* Intentional: we want this to fail. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
int myfunction(int n) {
|
||||
if (n == 0) {
|
||||
return 1;
|
||||
}
|
||||
return n * myfunction(n - 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user