Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ include(detect_dependencies)
# ###############################

# Set UNIX (macOS or Linux) compiler flags (clang or gcc). Set optimization level for debug or release.
if(UNIX)
# MinGW is gcc as well, so it takes the same flags.
if(UNIX OR MINGW)
message(STATUS "Checking supported compiler flags...")

enable_c_compile_option_if_supported("-Wall" "" "PRIVATE")
Expand Down Expand Up @@ -229,8 +230,20 @@ if(UNIX)
message(VERBOSE "COMPILE_OPTIONS_PRIVATE: ${COMPILE_OPTIONS_PRIVATE}")
message(VERBOSE "COMPILE_OPTIONS_PUBLIC: ${COMPILE_OPTIONS_PUBLIC}")
message(VERBOSE "COMPILE_OPTIONS_INTERFACE: ${COMPILE_OPTIONS_INTERFACE}")
if(MINGW)
# the python bindings and the gui exceed the default COFF section limit
enable_cxx_compile_option_if_supported("-Wa,-mbig-obj" "" "PUBLIC")

# HAL marks its api with CORE_API/NETLIST_API/PLUGIN_API, which expand to nothing on MinGW,
# so let the linker export everything instead of annotating every symbol by hand.
# ld only exports everything by default while nothing is marked dllexport, and pybind11
# marks its module entry points, so the flag has to be passed explicitly.
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--export-all-symbols")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--export-all-symbols")
endif(MINGW)

message(VERBOSE " ")
endif(UNIX)
endif(UNIX OR MINGW)

# Enable Debug Symbols for Libcpp on macOS
if(${CMAKE_BUILD_TYPE} EQUAL "Debug" AND APPLE AND CMAKE_HOST_APPLE)
Expand Down
4 changes: 4 additions & 0 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
set(SRC main.cpp)

add_executable(hal ${SRC})
if(MINGW)
# UTF-8 active code page, see hal.manifest
target_sources(hal PRIVATE hal.rc)
endif()
set_target_properties(hal PROPERTIES OUTPUT_NAME "hal")
set_target_properties(hal PROPERTIES ENABLE_EXPORTS 1)
set_target_properties(hal PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_RPATH}")
Expand Down
13 changes: 13 additions & 0 deletions app/hal.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
Runs hal with UTF-8 as its active code page. HAL passes paths around as std::string, and libstdc++
treats narrow paths as UTF-8 on Windows, so the narrow Windows APIs have to agree, otherwise any
non-ASCII character in a path (e.g. an install directory below "Einführung") breaks.
-->
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
</windowsSettings>
</application>
</assembly>
2 changes: 2 additions & 0 deletions app/hal.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// embeds hal.manifest as the application manifest (resource type 24 = RT_MANIFEST)
1 24 "hal.manifest"
9 changes: 8 additions & 1 deletion cmake/hal_plugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ function(hal_add_plugin target_name)
message(FATAL_ERROR "Can't be both MODULE and SHARED")
elseif(ARG_SHARED)
set(lib_type SHARED)
elseif(WIN32)
# plugins link against each other, which needs an import library, and Windows does not
# produce one for a MODULE library
set(lib_type SHARED)
else()
set(lib_type MODULE)
endif()
Expand Down Expand Up @@ -54,7 +58,10 @@ function(hal_add_plugin target_name)
if(APPLE AND CMAKE_HOST_APPLE)
set_target_properties(${target_name} PROPERTIES SUFFIX ".so")
set_target_properties(${target_name} PROPERTIES INSTALL_NAME_DIR ${PLUGIN_LIBRARY_INSTALL_DIRECTORY})
endif(APPLE AND CMAKE_HOST_APPLE)
elseif(WIN32)
# Python only imports extension modules with the .pyd suffix on Windows
set_target_properties(${target_name} PROPERTIES SUFFIX ".pyd")
endif()

target_link_libraries(${target_name}
PUBLIC hal::core hal::netlist ${Python3_LIBRARIES} pybind11::pybind11
Expand Down
11 changes: 11 additions & 0 deletions deps/abc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ extract_var(SEPARATOR_LIBS ABC_LIBS ${MAKE_OUTPUT})
extract_var(SEPARATOR_CFLAGS ABC_CFLAGS ${MAKE_OUTPUT})
extract_var(SEPARATOR_CXXFLAGS ABC_CXXFLAGS ${MAKE_OUTPUT})

if(WIN32)
# dlopen and the realtime clock live in the CRT on Windows, there is no -ldl or -lrt
list(REMOVE_ITEM ABC_LIBS "-ldl" "-lrt")
endif()

if(ABC_USE_NAMESPACE)
set_source_files_properties(${ABC_SRC} PROPERTIES LANGUAGE CXX)
endif()
Expand All @@ -90,5 +95,11 @@ list(REMOVE_ITEM ABC_SRC ${ABC_MAIN_SRC})

add_library(libabc-pic EXCLUDE_FROM_ALL ${ABC_SRC})
abc_properties(libabc-pic PUBLIC)

if(WIN32)
# without this abc declares its whole api __declspec(dllimport), including inside the library
# itself; MinGW exports and imports the symbols on its own
target_compile_definitions(libabc-pic PUBLIC WIN32_NO_DLL)
endif()
set_property(TARGET libabc-pic PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET libabc-pic PROPERTY OUTPUT_NAME abc-pic)
2 changes: 1 addition & 1 deletion deps/abc/src/aig/gia/giaKf.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#ifdef ABC_USE_PTHREADS

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "../lib/pthread.h"
#else
#include <pthread.h>
Expand Down
2 changes: 1 addition & 1 deletion deps/abc/src/base/cmd/cmdAuto.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#ifdef ABC_USE_PTHREADS

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "../lib/pthread.h"
#else
#include <pthread.h>
Expand Down
2 changes: 1 addition & 1 deletion deps/abc/src/base/cmd/cmdStarter.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#ifdef ABC_USE_PTHREADS

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "../lib/pthread.h"
#else
#include <pthread.h>
Expand Down
2 changes: 1 addition & 1 deletion deps/abc/src/base/wlc/wlcPth.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#ifdef ABC_USE_PTHREADS

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "../lib/pthread.h"
#else
#include <pthread.h>
Expand Down
2 changes: 1 addition & 1 deletion deps/abc/src/map/if/ifDsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#ifdef ABC_USE_PTHREADS

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "../lib/pthread.h"
#else
#include <pthread.h>
Expand Down
2 changes: 1 addition & 1 deletion deps/abc/src/map/if/ifTest.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#ifdef ABC_USE_PTHREADS

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "../lib/pthread.h"
#else
#include <pthread.h>
Expand Down
2 changes: 1 addition & 1 deletion deps/abc/src/proof/abs/absPth.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#ifdef ABC_USE_PTHREADS

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "../lib/pthread.h"
#else
#include <pthread.h>
Expand Down
2 changes: 1 addition & 1 deletion deps/abc/src/proof/cec/cecSplit.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#ifdef ABC_USE_PTHREADS

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "../lib/pthread.h"
#else
#include <pthread.h>
Expand Down
2 changes: 1 addition & 1 deletion deps/abc/src/sat/bmc/bmcBmcS.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

#ifdef ABC_USE_PTHREADS

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "../lib/pthread.h"
#else
#include <pthread.h>
Expand Down
6 changes: 5 additions & 1 deletion deps/igraph-1.0.x/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ set (IGRAPH_BASE "${CMAKE_BINARY_DIR}/igraph")
set (IGRAPH_DOWNLOAD "${IGRAPH_BASE}/download")
set (IGRAPH_BUILD "${IGRAPH_BASE}/build")
set (IGRAPH_INCLUDES "${IGRAPH_INSTALL}/include")
set (IGRAPH_LIB "${IGRAPH_INSTALL}/lib/libigraph${CMAKE_SHARED_LIBRARY_SUFFIX}")
if(WIN32)
set (IGRAPH_LIB "${IGRAPH_INSTALL}/lib/${CMAKE_IMPORT_LIBRARY_PREFIX}igraph${CMAKE_IMPORT_LIBRARY_SUFFIX}")
else()
set (IGRAPH_LIB "${IGRAPH_INSTALL}/lib/libigraph${CMAKE_SHARED_LIBRARY_SUFFIX}")
endif()
set (HAVE_IGRAPH TRUE)

message("-- IGRAPH version 1.0.1 : download and build libigraph${CMAKE_SHARED_LIBRARY_SUFFIX} in ${IGRAPH_BASE}")
Expand Down
2 changes: 1 addition & 1 deletion deps/subprocess/subprocess/process.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ namespace subprocess
//--------------------------------------------------------------------

//Environment Variable types
#ifndef _MSC_VER
#ifndef __USING_WINDOWS__
using env_string_t = std::string;
using env_char_t = char;
#else
Expand Down
2 changes: 1 addition & 1 deletion include/hal_core/arch/arch_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

#define LIBRARY_FILE_EXTENSION "dll"

#define ALTERNATE_LIBRARY_FILE_EXTENSION ""
#define ALTERNATE_LIBRARY_FILE_EXTENSION "pyd"

#ifdef BUILDING_CORE
#undef CORE_API
Expand Down
4 changes: 4 additions & 0 deletions include/hal_core/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ namespace hal
/* Microsoft */
#define EXPORT __declspec(dllexport)
#define IMPORT __declspec(dllimport)
#elif defined(_WIN32)
/* MinGW: symbols are exported via CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS, not per-symbol attributes */
#define EXPORT
#define IMPORT
#else
/* other */
#define EXPORTED __attribute__((visibility("default")))
Expand Down
4 changes: 2 additions & 2 deletions include/hal_core/netlist/boolean_function/solver.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ namespace hal
* https://smtlib.cs.uiowa.edu/language.shtml
*
* @param[in] was_killed - Indicates whether solver process was killed.
* @param[in] stdout - Stdout of solver process.
* @param[in] solver_output - Stdout of solver process.
* @param[in] config - SMT solver configuration.
* @returns Ok() and SMT solver result on success, Err() otherwise.
*/
static Result<SolverResult> translate_from_smt2(bool was_killed, std::string stdout, const QueryConfig& config);
static Result<SolverResult> translate_from_smt2(bool was_killed, std::string solver_output, const QueryConfig& config);
};
} // namespace SMT
} // namespace hal
9 changes: 7 additions & 2 deletions include/hal_core/plugin_system/runtime_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,20 @@

#include <string>

// operating system headers have to be included at global scope, not inside namespace hal
#ifdef _WIN32
#include <windows.h>
#else
#include <dlfcn.h>
#endif

namespace hal
{
// operating systems independent type definitions for function and handle access
#ifdef _WIN32
#include <windows.h>
using lib_fn_ptr_t = FARPROC;
using handle_ptr_t = HINSTANCE;
#else
#include <dlfcn.h>
using lib_fn_ptr_t = void (*)();
using handle_ptr_t = void*;
#endif
Expand Down
2 changes: 1 addition & 1 deletion plugins/dot_viewer/src/dot_viewer_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace hal {

QJsonObject dvObj;
std::filesystem::path relDotPath = ProjectManager::instance()->get_project_directory().get_relative_file_path(dv->filename().toStdString());
dvObj["filename"] = QString::fromStdString(relDotPath);
dvObj["filename"] = QString::fromStdString(relDotPath.string());
dvObj["creator"] = dv->creatorPlugin();

dvFile.write(QJsonDocument(dvObj).toJson(QJsonDocument::Compact));
Expand Down
7 changes: 5 additions & 2 deletions plugins/gate_libraries/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ if(PL_GATE_LIBRARIES OR BUILD_ALL_PLUGINS)
set_property(GLOBAL PROPERTY GATE_LIBS_DEFINITIONS "${CMAKE_CURRENT_SOURCE_DIR}/definitions")
message(STATUS "GATE_LIBS: ${GATE_LIBS}")
foreach(file ${GATE_LIBS})
if(IS_DIRECTORY ${file})
continue()
endif()
get_filename_component(f ${file} NAME)
list(APPEND SOURCE_GATE_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/definitions/${f})
list(APPEND DESTINATION_GATE_LIBS ${CMAKE_BINARY_DIR}/share/hal/gate_libraries/${f})
Expand All @@ -24,8 +27,8 @@ if(PL_GATE_LIBRARIES OR BUILD_ALL_PLUGINS)

add_custom_target(update_internal_gate_library_definitions ALL
BYPRODUCTS ${DESTINATION_GATE_LIBS} ${DESTINATION_HELPER_GATE_LIBS}
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/definitions/* ${CMAKE_BINARY_DIR}/share/hal/gate_libraries/
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/definitions/helper_libs/* ${CMAKE_BINARY_DIR}/share/hal/gate_libraries/
COMMAND ${CMAKE_COMMAND} -E copy ${SOURCE_GATE_LIBS} ${CMAKE_BINARY_DIR}/share/hal/gate_libraries/
COMMAND ${CMAKE_COMMAND} -E copy ${SOURCE_HELPER_GATE_LIBS} ${CMAKE_BINARY_DIR}/share/hal/gate_libraries/
DEPENDS ${SOURCE_GATE_LIBS} ${SOURCE_HELPER_GATE_LIBS}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Update gate library definitions")
Expand Down
5 changes: 4 additions & 1 deletion plugins/gexf_writer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ if(PL_GEXF_WRITER OR BUILD_ALL_PLUGINS)
if(APPLE AND CMAKE_HOST_APPLE)
set_target_properties(gexf_writer PROPERTIES SUFFIX ".so")
set_target_properties(gexf_writer PROPERTIES INSTALL_NAME_DIR ${PLUGIN_LIBRARY_INSTALL_DIRECTORY})
endif(APPLE AND CMAKE_HOST_APPLE)
elseif(WIN32)
# Python only imports extension modules with the .pyd suffix on Windows
set_target_properties(gexf_writer PROPERTIES SUFFIX ".pyd")
endif()

target_link_libraries(gexf_writer
PUBLIC gui
Expand Down
2 changes: 1 addition & 1 deletion plugins/gexf_writer/src/gexf_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace hal
{
return ERR("could not write netlist to GEXF file '" + file_path.string() + "': file path is empty");
}
QString filename = QString::fromStdString(file_path);
QString filename = QString::fromStdString(file_path.string());

if (!filename.endsWith(".gexf"))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ namespace hal
* @enum Direction
* @brief The direction of exploration within the graph.
*/
// windows.h defines IN and OUT as empty SAL annotation macros
#ifdef _WIN32
#undef IN
#undef OUT
#endif

enum class Direction
{
/**
Expand Down
5 changes: 4 additions & 1 deletion plugins/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ if(PL_GUI OR BUILD_ALL_PLUGINS)
set_target_properties(gui PROPERTIES PREFIX "")
if(APPLE AND CMAKE_HOST_APPLE)
set_target_properties(gui PROPERTIES SUFFIX ".so")
endif(APPLE AND CMAKE_HOST_APPLE)
elseif(WIN32)
# Python only imports extension modules with the .pyd suffix on Windows
set_target_properties(gui PROPERTIES SUFFIX ".pyd")
endif()
target_include_directories(gui
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Expand Down
2 changes: 2 additions & 0 deletions plugins/gui/include/gui/content_manager/content_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ namespace hal
QString mPluginName;
public:
ContentFactory(const QString& nam=QString()) : mPluginName(nam) {;}
// factories are deleted through this base, and may have further bases such as ProjectSerializer
virtual ~ContentFactory() {;}
QString name() const {return mPluginName; }
virtual ExternalContentWidget* contentFactory() const = 0;
};
Expand Down
5 changes: 5 additions & 0 deletions plugins/gui/src/content_manager/content_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ namespace hal
auto it = begin();
while (it != end())
if ((*it)->name() == pluginName)
{
// the factory lives as long as its plugin, deleting it here (while the plugin is still loaded)
// also unregisters it from everything it registered with, e.g. as a project serializer
delete *it;
it = erase(it);
}
else
++it;

Expand Down
2 changes: 1 addition & 1 deletion plugins/gui/src/export/export_project_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace hal
ExportProjectDialog::ExportProjectDialog(QWidget *parent)
: QFileDialog(parent), mStatus(NoExport)
{
QFileInfo pinfo(QString::fromStdString(ProjectManager::instance()->get_project_directory().get_default_filename()));
QFileInfo pinfo(QString::fromStdString(ProjectManager::instance()->get_project_directory().get_default_filename().string()));
mProjectName = pinfo.baseName().simplified();
mProjectName.replace(" ","");
setDefaultSuffix(".zip");
Expand Down
Loading