Skip to content
Snippets Groups Projects
Commit ca8c9709 authored by Vicki Pfau's avatar Vicki Pfau
Browse files

Allow native building on Windows

parent da18b9d7
No related branches found
No related tags found
No related merge requests found
......@@ -116,11 +116,17 @@ function(add_core PLATFORM CORE_NAME)
if(WIN32)
set(LIBRETRO_PLATFORM platform=win)
endif()
if(WIN32 AND NOT CMAKE_CROSSCOMPILING)
set(CORE_LDFLAGS LDFLAGS="-w ${STATIC_LDFLAGS}")
else()
set(CORE_LDFLAGS "LDFLAGS=-w ${STATIC_LDFLAGS}")
endif()
add_custom_command(OUTPUT "${TARGET_PATH}"
COMMAND CFLAGS=-w CXXFLAGS=-w "LDFLAGS=-w ${STATIC_LDFLAGS}" $(MAKE) -f ${MAKEFILE} CC="${CMAKE_C_COMPILER}" CXX="${CMAKE_CXX_COMPILER}" ${LIBRETRO_PLATFORM}
COMMAND CFLAGS=-w CXXFLAGS=-w "${CORE_LDFLAGS}" $(MAKE) -f ${MAKEFILE} CC="${CMAKE_C_COMPILER}" CXX="${CMAKE_CXX_COMPILER}" ${LIBRETRO_PLATFORM}
COMMAND ${CMAKE_COMMAND} -E copy "${CORE_NAME}_libretro*" "${TARGET_PATH}"
WORKING_DIRECTORY "cores/${PLATFORM}/${SUBDIR}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/retro/cores/${CORE_NAME}-version")
unset(CORE_LDFLAGS)
add_custom_target(${PLATFORM} ALL DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/retro/cores/${CORE_NAME}-version" "${TARGET_PATH}")
list(APPEND CORE_TARGETS "${PLATFORM}")
......
......@@ -36,7 +36,7 @@ class CMakeBuild(build_ext):
if not self.inplace:
pylib_dir = '-DPYLIB_DIRECTORY:PATH=%s' % self.build_lib
python_executable = '-DPYTHON_EXECUTABLE:STRING=%s' % sys.executable
subprocess.check_call(['cmake', '.', pyext_suffix, pylib_dir, python_executable])
subprocess.check_call(['cmake', '.', '-G', 'Unix Makefiles', pyext_suffix, pylib_dir, python_executable])
if self.parallel:
jobs = ['-j%d' % self.parallel]
else:
......
#include <cmath>
#ifdef _WIN32
// pyconfig.h doesn't seem to like hypot, so we need to work around it.
namespace std {
template <typename T>
static inline T _hypot(T x, T y) {
return hypot(x, y);
}
}
#endif
#include <pybind11/pybind11.h>
#include <pybind11/numpy.h>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment