mirror of
https://github.com/drewcassidy/quicktex.git
synced 2024-09-13 06:37:34 +00:00
Remove debug wrapper, now that I know how to use a debug python build
This commit is contained in:
parent
9eaaf901f3
commit
5c94782876
@ -1,18 +1,11 @@
|
||||
cmake_minimum_required(VERSION 3.18)
|
||||
include(CheckIPOSupported)
|
||||
include(tools/CompilerWarnings.cmake)
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
|
||||
project(quicktex)
|
||||
|
||||
# Find dependencies
|
||||
if (DEFINED QUICKTEX_MODULE_ONLY)
|
||||
# Not all python installs include the headers necessary for embedding. If we are only building the module,
|
||||
# we can ignore the embed headers
|
||||
find_package(Python COMPONENTS Interpreter Development.Module)
|
||||
else ()
|
||||
find_package(Python COMPONENTS Interpreter Development)
|
||||
endif ()
|
||||
|
||||
find_package(Python COMPONENTS Interpreter Development.Module)
|
||||
find_package(pybind11 CONFIG REQUIRED)
|
||||
find_package(OpenMP)
|
||||
|
||||
@ -37,8 +30,6 @@ file(GLOB HEADER_FILES
|
||||
"quicktex/s3tc/interpolator/*.h"
|
||||
)
|
||||
|
||||
file(GLOB TEST_FILES "tests/*.cpp")
|
||||
|
||||
file(GLOB_RECURSE PYTHON_FILES "src/**/*.py")
|
||||
|
||||
# Organize source files together for some IDEs
|
||||
@ -49,34 +40,24 @@ pybind11_add_module(_quicktex
|
||||
${SOURCE_FILES}
|
||||
${HEADER_FILES})
|
||||
|
||||
add_executable(test_quicktex
|
||||
${SOURCE_FILES}
|
||||
${HEADER_FILES}
|
||||
${TEST_FILES})
|
||||
|
||||
target_link_libraries(test_quicktex PRIVATE pybind11::embed)
|
||||
|
||||
target_compile_definitions(test_quicktex PRIVATE -DCUSTOM_SYS_PATH="${CMAKE_HOME_DIRECTORY}/env/lib/python3.9/site-packages")
|
||||
# Set Quicktex version info
|
||||
target_compile_definitions(_quicktex PRIVATE VERSION_INFO=${QUICKTEX_VERSION_INFO})
|
||||
|
||||
# enable openMP if available
|
||||
if (OpenMP_CXX_FOUND)
|
||||
target_link_libraries(_quicktex PUBLIC OpenMP::OpenMP_CXX)
|
||||
target_link_libraries(test_quicktex PUBLIC OpenMP::OpenMP_CXX)
|
||||
endif ()
|
||||
|
||||
# Set module features, like C/C++ standards
|
||||
target_compile_features(_quicktex PUBLIC cxx_std_17 c_std_11)
|
||||
target_compile_features(test_quicktex PUBLIC cxx_std_17 c_std_11)
|
||||
|
||||
# Set compiler warnings
|
||||
set_project_warnings(_quicktex)
|
||||
set_project_warnings(test_quicktex)
|
||||
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
|
||||
# Clang-specific
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++abi")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -stdlib=libc++ -fsanitize=undefined")
|
||||
set(PROJECT_WARNINGS ${CLANG_WARNINGS})
|
||||
endif ()
|
||||
|
4
setup.py
4
setup.py
@ -31,7 +31,9 @@ class CMakeBuild(build_ext):
|
||||
if not extdir.endswith(os.path.sep):
|
||||
extdir += os.path.sep
|
||||
|
||||
cfg = "Debug" if self.debug else "Release"
|
||||
cfg = "Debug" if self.debug else "RelWithDebInfo"
|
||||
if 'QUICKTEX_DEBUG' in os.environ:
|
||||
cfg = "Debug"
|
||||
|
||||
# CMake lets you override the generator - we need to check this.
|
||||
# Can be set with Conda-Build, for example.
|
||||
|
@ -1,44 +0,0 @@
|
||||
/* Quicktex Texture Compression Library
|
||||
Copyright (C) 2021 Andrew Cassidy <drewcassidy@me.com>
|
||||
Partially derived from rgbcx.h written by Richard Geldreich <richgel99@gmail.com>
|
||||
and licenced under the public domain
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// This file allows for easy debugging in CLion or other IDEs that dont natively support cross-debugging between Python and C++
|
||||
|
||||
#include <pybind11/embed.h>
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
|
||||
namespace py = pybind11;
|
||||
using namespace pybind11::literals;
|
||||
|
||||
#define STRINGIFY(x) #x
|
||||
#define MACRO_STRINGIFY(x) STRINGIFY(x)
|
||||
|
||||
int main() {
|
||||
py::scoped_interpreter guard{};
|
||||
|
||||
py::module_ site = py::module_::import("site");
|
||||
|
||||
site.attr("addsitedir")(CUSTOM_SYS_PATH);
|
||||
|
||||
py::module_ nose = py::module_::import("nose");
|
||||
py::module_ tests = py::module_::import("tests");
|
||||
py::list argv(1);
|
||||
nose.attr("runmodule")("name"_a = "tests.test_bc1", "exit"_a = false);
|
||||
}
|
Loading…
Reference in New Issue
Block a user